Sign in to follow this  

position updater

This topic is 3721 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 there. I am making a server client game where its a small MMORPG with a small map as a prototype in a tcp connection type. If a player moves the player position should be updated to all subscribed players in the server in addition to the server itself. The thing i am confused of is that i thought of 2 ways of updating the position of a player. The first is that every player sends a message every 10msec to the server and the server checks the availability of the position and sends the position of this player if available to all players connected to the server. The second one is that every player sends his position to the server, checks availability and update position but won't send another update unless the server sends acknowledgment to the first player (position sender) that the position is sent successfully. These are the two ways for position updating that i thought of and i don't know which one should i use and if there is a better way for this small MMORPG map i would appreciate it. Note this is a position updater not an action message. tnx in advance...

Share this post


Link to post
Share on other sites
First one, you mean send player commands and the server moves the player himself?

If you do not mind lag in the controls (the time it takes to send the commands and the time it takes for the server to send the position back).

I'll add a third.

1) Player process the command message locally. Calculate the position.
2) Player sends the command, and the resulting position to the server.
3) server uses the player commands to calculate the position he thinks the client should be.
4) send position of the player to all other clients.
5) server checks if the position he calculated and the position found by the client match (by some threshold).
6) if the positions diverge too much, sends a correction packet to the client.
7) client receives the correction packet and corrects his position accordingly.

=> see gaffer's network physics article. You need some sort of command stack to work with corrections.

Personnaly, for a small RPG, the first solution should be viable. Guild wars seems to do this roughly, with some small amount of prediction code. It's probably the simplest solution. You can always add the prediciton code later on on top of the command packet.

Share this post


Link to post
Share on other sites
tnx for the info alot. Unfortunately this didn't answer my question but u gave me good info and a link which clarified alot of unclear things about network physics. so tnx alot...

[Edited by - muster on October 3, 2007 8:41:21 PM]

Share this post


Link to post
Share on other sites
You didn't actually have an explicit question, although the question might be inferred as "which of these two systems should I use?"

First, every 10 milliseconds is at least 10 times too often, if not 50, for an MMORPG. Let's suppose you send the position 10 times a second (every 100 milliseconds).

Now, there needs be no synchronization or acknowledgments of that packet. If the packet was dropped, the next packet will likely make it. Or, if you're using TCP, then the packet will get there, in order, at some point, unless the connection is broken.

Each time a person moves is not necessarily the best time to tell other people about that move, because the "MM" means that you have to manage more people on the server than you can update in full resolution on the clients. Instead, each packet you receive in should update the world state. At regularly scheduled intervals (say, 2 or 4 times a second), the server figures out what data to send to each client, and sends that data. It's more important to update characters that are close to the client, than characters that are far away, so you should come up with a scheduling strategy that accomplishes that, as a start. Later, you can improve it by sending group members more often to each other, etc.

Interest management, as this problem is called, is one of the things that makes MMO development different from regular online games.

Share this post


Link to post
Share on other sites

This topic is 3721 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this