gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Pre-recorded Input

#22610 - sgeos - Fri Jun 25, 2004 5:03 am

What is the best way hook various game objects to either the keypad or various prerecorded (and other) input streams? Hooking everything to one or the other is easy- just use a different key state update function. (ie Do not read from KEYINPUT directly.)

Do I want to keep a list of input streams and point each object to a member of the list? (Update each stream every frame.)

Is there a better way of doing this?

-Brendan

#22618 - keldon - Fri Jun 25, 2004 12:28 pm

sorry I'm in a rush, but ...


http://www.dkauk.com/klogic/concept.htm -describes concept a little
http://www.dkauk.com/klogic/projects.htm -go to sequencer, and has ASM sourcecode + theory

#26050 - keldon - Sun Sep 05, 2004 1:23 am

did you get your answer in the end?

#26052 - sgeos - Sun Sep 05, 2004 4:22 am

Page 223 of Design Patterns (chain of responsibility) gives a pretty good object oriented solution. It's basically the same problem that OS GUI writers face when they send messages to various window objects.

-Brendan

#26062 - phonymike - Mon Sep 06, 2004 8:49 am

just an idea for pre-recorded input for say a demo mode:

have a mode where the game plays as normal, only in this mode a variable is set to record input. you simply play through for however long, and while playing the input is recorded every 60th of a second. then to replay your inputs, reset the game and use the recorded input instead of the key input.

#26068 - DekuTree64 - Mon Sep 06, 2004 5:56 pm

Yeah, that sounds like the easiest way to do it. I was thinking it would soak up a lot of space to be storing the register value every frame, but simple RLE compression would cut it down to only a few bytes each time to actually press/release a key, so it wouldn't take much at all.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#26077 - DialogPimp - Mon Sep 06, 2004 11:15 pm

phonymike wrote:
just an idea for pre-recorded input for say a demo mode:


Yep that's how Andre Lamothe did it in "Tricks of the Game Programming Gurus".