Replay's/Demos

Started by
4 comments, last by Sloth 21 years, 8 months ago
Im currently working on a 2d racing game. Eventually I am aiming to make the game multiplayer. Ive been wondering how games record replays/demos. eg: first person shooters (Quake3/CS/HL/etc..) can record a demo of what you see. sports games allow you to play back bits of action. So what im wanting to do is record a race from start to finish. Is it a matter of timing all the actions that happen? So when a key is pressed it records the time it was pressed and then the time is was released? This is how I would approach it: -Load same map -Load player data -Play mins/secs/milisecs Action 0:00:00 Game starts 0:01:01 Player 01 presses accelerate 0:02:00 Player 01 releases accelerate button -Finish EOF This is only a guess of how they work, if you know please yet me know. cheers simon
Advertisement
Don''t record button presses. Record movement.

If you record button presses, the demo won''t play back the same every time.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
quote:Original post by siaspete
Don''t record button presses. Record movement.

If you record button presses, the demo won''t play back the same every time.


Recording button presses can work as long you record all the external inputs to the game (that includes the random number generator seed, amongst other things). It''s more work than recording movement, but it will probably take less space in the recording. Also, you can use it to throw in a simple peer to peer multiplayer facility.

If you want to try it, a good place to start would be: Instant Replay : Building a Game Engine with Reproducible Behavior.
Recording input only works if your game runs in identical timesteps each frame.

Most don''t (and shouldn''t - I like vsync off thanks!)

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
quote:Original post by siaspete
Recording input only works if your game runs in identical timesteps each frame.

Most don't (and shouldn't - I like vsync off thanks!)


I agree that fixing the graphics update rate is a bad thing. That said, you don't have to use identical timesteps for each frame if you want to record inputs. That's just one way of doing it.

My current system records the time steps with each batch of inputs, and duplicates those steps on replay. Another possability is to run the physics system at a fixed rate (say, 100Hz) and run the rendering at a variable rate. If rendering a frame takes longer than 100th of a second, you just do multiple physics updates as required. I seem to remember hearing that fixed rate physics is good if you're doing rigid body physics, though I haven't looked into that too much yet.

EDIT: Just to clarify, I'm not saying that recording inputs is the perfect way to record a game, just that it is one of the possibilities. Take a look at the link and see whether its advantages and disadvantages are appropriate to your game.

[edited by - Krunk on September 8, 2002 7:59:26 AM]
Thanks for the link to that article by the way, it''s pretty good.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

This topic is closed to new replies.

Advertisement