Question about game replay(combat replay)

Started by
3 comments, last by h3xl3r 9 years, 11 months ago

I am working on game replay 2 weeks,but there are some questions trouble me here.

this function just like combat replay of COC.

I use cocos2d-x engine,in order to keep game performance on different device,engine use dt(time interval between 2 frames) to adjust animations,actions, move,jump,etc.

The trouble is that dt is so different on different device,it's big on slow device and small on quick device,for example,I check collide of someobject when it's moving, in a key time,the x position of object is 1.05 on slow device,the collide occured,but at this moment,the x position of object is 1.04 on quick device,the collide not occur,the logic is different on different device at same moment.the replay is incorrect.

If I not use dt, replace it to frame or I kept the dt in a const value(like 0.5),the replay is ok,but the performance is suck,game is running not smooth on slow device,so,this is not a good idea.

any suggestion or idea?

thanks very much for your help!!

Advertisement
I'd recommend this article.

I'm not certain if COC replay is like this, but in a previous game of mine, when I recorded and replayed some gameplay, i used a method where I sampled the location of every object every X mS (say, 60 mS), and stored it, and when something happened (a shot was fired, an enemy damaged, etc.), it was recorded as well. Then, when replaying this, I simple redrew the screen with the coordinates of the objects, on when special events happen , they were simulated (ie, play a gun fire, play a enemy hit sound, play an explosion, etc.).

This takes away having to be 100% accurate on simulation replays, which can be difficult.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

I would reference the Warcraft 3 replay format, which is very robust.

- http://johnhforrest.com/wp-content/uploads/2009/10/w3g_format.txt
- http://johnhforrest.com/wp-content/uploads/2009/10/w3g_actions.txt

It records player actions and major match events (the start, pause etc.) in relation to time, so every time you watch a replay, the engine is "playing" a new match but with the actions that were recorded, so theoretically the replay engine uses the same method as the AI players for making orders.
It doesn't record when a unit is killed, for instance. It merely records the players' orders for attacks and simulates the game as if it were happening right then.

It certainly needs a solid game loop code, and needs to make use of the same random seed that was used on the original match.
Sounds like your problem is more with the time-step of your physics simulation rather than anything to do with replaying the action? If so, the article rip-off suggested is exactly what you need to fix it.

After your physics are not going wild anymore because of the variable timestep, recording/replaying should simply be a matter of keeping a record of all user input (key/mouse/net) with timestamps and then running the simulation again with the same initial state and firing the input events from your recording according to their timestamps.

Pretty much like you would record a piece of music on a MIDI keyboard (recording key events + time) and then play it back later.

This topic is closed to new replies.

Advertisement