Jump to content
  • Advertisement
Sign in to follow this  
vhxonline

Keeping track/updating data between players

This topic is 1055 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

Hello, just some questions on how to handle updating data between players. More of a design and implementation question.

 

When it comes to keeping track of players near each other, In my game, I only want characters in a certain range to be shown, as such the server only sends data to other players in X range around the player.

 

Right now, the server stores who we've sent player data to so we don't keep sending the full player state constantly (after the full player state, I just send position updates). But I'm running into problems with people going out of range, having their states changed, then moving back into view and the out of view clients obviously don't know (since the player state changed out of view). I figured the solution might be to delete the reference to the known player from the other player, so when it goes out of view so it refreshes.  However, if someone is just moving in and out of view I don't want it sending full states constantly. It's been suggested to use a timer, so that once it goes out of view it has say, 1 minute before you delete the fact the other players know about you. Which is a good idea, but I'm getting wary of the server handling things like this that seem like it belongs in the client operation? I am not sure how other games handle this interaction.

 

What is the best way to go about this? Should the server be keeping track of which player knows about your player data and handling timeouts and view distances? I've also read some people have the client request data from the server. Example: You get movement data from a character that doesn't exist, so the client asks the server for info on this player. However, that starts having problems of queuing the initial request, waiting for the server to get the state data and send it back, then playing all of the queued up commands meant for that player when we create it.. Of course I'm not sure if that's correct as well. I guess I just need guidance on proper setup when it comes to this.

 

Thanks.

 

Share this post


Link to post
Share on other sites
Advertisement
Who can see whom is absolutely a server operation.

An alternative to a timer is a distance hysterisis where you drop something if it's further than X*1.05 away, and you introduce something if it's closer than X*0.95 away, for some value of X.

Share this post


Link to post
Share on other sites

Thanks, so to clarify, you would say my approach of tracing which players know about who has X data from a player, then managing it from the server is the right way to go? 

 

I'll look into the hysterisis, seems like a viable option as well.

Share this post


Link to post
Share on other sites
Yes. Typically, you will have a single "world state," and then a separate state for each connection, which manages what particular bits are "known" on that connection. That sounds like what you're doing.

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!