Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recording a demo
#1
I wish to record a demo of myself playing my game in order to put it at the title page. I think I know how it's done. Let me know if this is how? To record, when the game starts, the time is taken for a main start time. The buttons you push are recorded into a file including the start time of when you pushed it relative to the main start time. When you let go of the button, it jots down the finish time. In all, at the end, you have a file telling you when you pushed what button, and when you released it based on the main start time. If there's any randomness in the ennemies, etc, the random numbers that were chosen that affects their behavior must be recorded too. Now, to play back the demo, the engine reads the file instead of waiting for the user to input. When it reads that a key is pressed at this time, it triggers the routine that is accociated with pressing that button, etc. This all seems right. There's a problem I need to figure out though. There's several buttons that need to be recorded, but the start time and finish times of each will all get mixed up if they are recorded in the file. There has to be something saying that this start time is with this button, etc. For this I would have to record strings into the file, and that would take longer to read and disect them on what button is pushed, etc. But is there a way to simulate a multi track file so each button have their own track so I don't have to include info on what button was pressed? What's the best way of going about this? Thanks
Reply
#2
Just use IDs. You can use a simple protocol that especifies the scancode of the key pressed and two events: keydown and keyup.

Imagine you assign "keydown" as 1, keyup as 2. If ESC is pressed you record to a file 1 (scancode for ESC), 1 (keydown) and a timestamp. When it is depressed you record 1 (scancode for ESC), 2 (keyup) and a timestamp. You'll need a precise timer (if you are using TIMER things can become a bit unaccurate), tho'.

That's the way how emulators record sessions, for example. In emulators it is easy 'cause they use the emulated CPU cycles (T-states) for the timestamps, so the accuracy is 100% guaranteed.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
hmm, that's a good idea, but that would create many files, wouldn't it? I would rather have 1 file per recording. Ya, I thought the timer would be inacurate. How about those very precise timer routines that can flag sooner than .05? Maybe that?
Reply
#4
added..I know that's how John Carmack did it in Wolfenstein because when I redid one of the original maps using a map editor that one of the demos used, the guy's movements where all the same but he wasn't shooting at anything, he was banging into walls, etc. But do you by any chance know how the engine recorded the movements?
Reply
#5
I'd say forget recording time down. I would make a record for each frame. Put something in your main loop that records the input and random events. But do it every frame. May be expensive in memory and speed but time is inaccurate. Especially on different machines.
hat were we arguing about again?
Reply
#6
Quote:hmm, that's a good idea, but that would create many files, wouldn't it? I would rather have 1 file per recording. Ya, I thought the timer would be inacurate. How about those very precise timer routines that can flag sooner than .05? Maybe that?

I meant just 1 file. And you could use the frame number as timestamp as suggested, but you don't need to record every frame. Just have a counter (LONG) and everytime a key is pressed or depressed just write the info to the file, using the counter as timestamp. Just increment the counter each loop.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)