Jump to content
  • Advertisement
Sign in to follow this  
_Flecko

Demo files

This topic is 4972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I posted a thread recently in which I asked about applying encryption to a demo file that records the input a player gives during a game so that they can be played back by the game engine. It turns out that the demo file is giving me more trouble than the encryption. The game is written in C# using DirectX, and it works by constantly invalidating the window so that OnPaint() is called and checking how long it's been since the last frame using DXUtil.Timer. The ghost records the time that each event occurs at and stores them in a queue. This should work because the game is completely deterministic besides the one user's input. Of course, when replaying, the frames won't fall on exactly the same times, especially since different computers might get wildly varying framerates. So, when one or more inputs fall in the middle of a frame, the update routine is run multiple times, once for each time segment that the inputs split it into. This approach is not working, and I suspect it will not. Small inaccuracies occur, and inevitably lead to a collision ocurring when it shouldn't (or not when it should). The slightest divergence completely destroys it. At the same time, I know this method must work somehow, because I've read about networked games being run that way, with each networked game only receiving the input for other players, and I've seen demo files for other games (like the classic descent games, for example) that appeared to be done this way. Does anyone have any ideas what I could be doing wrong, or what a better approach might be?

Share this post


Link to post
Share on other sites
Advertisement
Flecko,

have you considered using a fixed timestep for the game state (and decoupled from the frame rate)? It's generally considered a good idea, and I think it should help solve your problem. This and this are some good explanations of how it all works and what the benefits are.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!