Movement in an online RPG

Started by
3 comments, last by hello2k1 21 years, 9 months ago
Well I''m now working on planning the network code for my upcoming demo, and one thing that''s really stumping me is how to handle unit movement in a client/server situation. For starters, there simply isn''t enough processing power to spare on the servers, so pathfinding would have to be done on the client. Also, the client can''t be sending hundreds of packets a second updating it''s position, but still has to be acurate enough to support battles. Anyone have any ideas as to how to track the player acurately without wasting bandwidth/processing power? Thank you.
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
Advertisement
I would let the player do its own movement, but check it periodically. not 100 times a second. maybe 2 times a second(you should tweak with this number). and if the player has done something impossible log the event and move the player back to where it should be. If the log shows that a player is in impossible positions frequently, you might want to consider investigating or punish them. Or you could just punish them on their first offense if you are confident your code is bug-free. just an idea.

note: since i dont know what kind of game you are making, i dont know what kind of punishment would be nesesary. but always remember, dont trust the client at all!
Just send a "change direction" buffer to the server.

Let's say you want this unit to move from (x,y) to (x+10,y):

Just tell the server you're going down, the client AND the server will calculate you going down at the same time. If you stop moving or if you change your direction, tell the server you're just "changing your state".

And that will work for the pathfinding stuff too. Let the client calculate all waypoints, and tell the server (I arrived to the X waypoint, now I'm going to this direction).
The server will eventually checks if the new move is legal (possible) or not.

You would probably check if the coordinates on both sides are synchronized by giving the last word to the server.

[edited by - Cahaan on July 25, 2002 12:27:40 AM]
Darkhaven Beta-test stage coming soon.
Cahaan:
Actually, that''s what I was first thinking.. But if there are many units in the way, that can get very costly.

Anonymous Poster:
Your method was the first I thought of, be the problem is that it would be difficult (or cpu intensive) to check whether the player has done something impossible. Also, that would mean that every other client would have to calculate the pathfinding, which can get problematic in many, many ways. ie. De-Syncs
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
Yes but since the server will always be right, you just have to send a resync from time to time to all the clients. (once or twice every 5 seconds would be fine I guess). Well you have to try several possibilites and see which one suits the best with your engine :-)
Darkhaven Beta-test stage coming soon.

This topic is closed to new replies.

Advertisement