Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


How to handle oject creation while replaying past gamesates


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
1 reply to this topic

#1 simonlourson   Members   -  Reputation: 140

Like
0Likes
Like

Posted 25 June 2013 - 06:13 AM

Hi.

 

I'm developing a fast paced networked action game. In my game, the server keeps a circular buffer of past gamestates, so I can replay client input in the past (for client prediction)

 

My question is, how do i handle object creation in the circular buffer?

 

For example, let's say the server has received an input from client A, telling it to fire bullets (my bullets are ballistic types, not instantaneous) at frame 10. 3 bullets are created, and I send these objects creation to each of the clients.

 

When I'll be replaying my circular buffer during the next timestep, those bullets will be re-created, and not necessarily with the same ids, which is a problem, because I don't want to resend the creation of these bullets to each client!

 

Is my question clear enough ? How can I handle the fact that some actions need to be definitive (object creation), while at the same time replaying my circular buffer of past gamestates according to new user input?



Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5507

Like
0Likes
Like

Posted 25 June 2013 - 11:09 AM

You need to deal with the fact that objects aren't existing in the past, and those objects can get un-created if it turns out re-play doesn't re-create them.

 

One way of doing this is to give each object a "created on step number" value, and if you rewind to step S, delete all objects that were created on step S or later. Assuming networking/inputs are correct, those objects will get re-created again. This can probably be optimized by saving the "uncreated" objects as cached copies to use for re-creating them, assuming they will actually be re-created. Any cached copy that wasn't re-created during its original creation step can be destroyed.


enum Bool { True, False, FileNotFound };




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