Skip to main content
GameDev.net gamedev.net
🔒 Locked

Tile-Based Game Movement

Started by stormwarestudios Dec 28, 2006 at 2:24 PM 1 replies 3.1k views
Original Post
stormwarestudios
stormwarestudios
Hi all, I have been working on my game for a long while now, and have a decent framework and engine running. The game is a 2D tile-based RPG, using fine movement (e.g. players move by pixels, not tiles). Collision with the map is done on a tile-basis, and collision with objects is done on a fine- (e.g. per-pixel) basis. I have progressed in its development such that I am at the point where I am adding player movement. I have read up on various algorithms and theories for synchronized network movement (dead reckoning in particular), but I don't know much about these, so I'm sure my research is primitive at best. In my game, players may move one of eight cardinal directions. What I am considering as a basic system of movement is: 1) Movement Request Client to Server - client requests to move in a particular direction - server checks position+velocity, and notifies all nearby players of the movement change 2) Movement Update Server to Clients - server performs movement of all players X iterations per second, using time-based velocity - if a player *should* stop moving due to collision with an object/player or collision with an impassable map tile, nearby players are updated with that player's new position and velocity - if a player approaches within X tiles of another player, both players receive the update of "new approaching player" - if a player leaves another player's vicinity, all nearby players are notified 3) Direction Request Client to Server - client requests to change facing - server verifies it can happen (e.g. player may be frozen/immobile) then updates nearby clients of the results 4) Position Update Server to Clients - server determines that a client must stop moving - specialized form of Movement Update, which assumes velocity=0, to lower network throughput This is really all the movement that the game needs; I'm curious to know if there is a simpler method of handling movement, or if there is anything which I have overlooked? Best regards, - DH
GPxz
GPxz
This way the entities will get desyncronized between the clients

Lets say the server detects a collision, and sends packet, but remember there is something called LAG.

While its traveling to reach the destiny, you re still moving, so it reach 60ms later

Your entity will have crossed the object

See?

The right way of doing non tile-based games, is leaving everything for the client. Movement, acceleration, gravity, all the physics, and keep updating your position continuously like each 1ms to the server, then the server broadcast your position to all the other clients

Yeah, this is way is more easy to cheat, since the user will have entire power over the physics, but you solve this adding verifications. At each client update, check if the position is inside a object, check the actual speed and see if it is a valid one, and etc

[Edited by - GPxz on December 28, 2006 7:49:24 PM]
My MSN: gerunbaum@hotmail.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.