Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Question about game replay(combat replay)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 wanzi215   Members   -  Reputation: 101

Like
0Likes
Like

Posted 16 May 2014 - 02:27 AM

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!!



Sponsor:

#2 rip-off   Moderators   -  Reputation: 8526

Like
5Likes
Like

Posted 16 May 2014 - 03:32 AM

I'd recommend this article.

#3 BeerNutts   Crossbones+   -  Reputation: 2980

Like
3Likes
Like

Posted 16 May 2014 - 09:11 AM

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)

#4 Kryzon   Prime Members   -  Reputation: 3243

Like
0Likes
Like

Posted 16 May 2014 - 06:49 PM

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.

#5 h3xl3r   Members   -  Reputation: 167

Like
0Likes
Like

Posted 17 May 2014 - 12:27 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS