Game Development Community

How do demo recording works?

by Manoel Neto · in Torque Game Engine · 01/19/2005 (9:21 am) · 6 replies

Hi,

I am working on a game where the character can pilot a vehicle with boost and jump capability. There will be races, and I need the opponents to jump and use boost properly. I can encode the boost and jumping setttings on the path markers, but I would like to know if I can record a "demo" and playback it on a bot. That way I could run the same track many times and record several demos, and have the opponents movement appear less mechanic.

But I never used demo recording, and I don't see much references on how it works. Can anyone help?

#1
01/19/2005 (12:50 pm)
Demo recording records the network stream from client to server, allowing you to replay game sessions. If you need to record this sort of data, I'd suggest adding code to dump state from the object every few dozen ms to a file, then play it back. The demo stuff is going to be overwhelmingly too much for this task, as it records _everything_. :)
#2
01/20/2005 (9:38 am)
Ah, I see. So I need a custom solution.

Maybe I can add some code to the keybind functions to store the key values and the time elapsed since the recording began into a scriptObject, dump it to a text file, and then add code to the AiPlayers to parse the data and update the aiMove according.
#3
01/20/2005 (11:11 am)
I would suggest storing the car's position, steering value, etc. once a tick as a starting point. Then find a way to play it back. That might be efficient enough of a representation that you can use it as is, or you might have to do do some optimization.
#4
01/20/2005 (11:22 am)
Well, the problem is that this ins't a car, it's a horse. The player can slap it for boost and it can jump. How do I store those actions too?
#5
01/20/2005 (11:19 pm)
Write 'em out as values into the stream. For the tick where the slap or jump happens, write a bit out as high, otherwise low. Then read back and when you get to a high bit trigger the same action that frame.
#6
01/21/2005 (5:00 am)
Ah, I see. Thanks.

Now, onto studying how the stream stuff works...