Todo list for movement code rewrite
Client
Coordinate system messup
The position of a being is stored in the being class with different systems: Pixel coordinates, Tile+Offset coordinates, pixel coordinates of the center of the tile etc.
Some are not encapsulated properly and poorly named.
The client should use only pixel coordinates internally (stored in two protected unsigned integers) whenever possible. When the tile coordinates are needed (The only situations I could think of are route finding and path blocking) it should be done by getting the pixel coordinates and dividing them by 32 (the compiler will optimize this by substituting it with a very fast bitwise shift)
Delayed reaction on Being::setDestination()
Another problem is that when setting a new destination while the being is already moving along a path does not cancel the move immediately but only after the next tile of the path has been reached.
Server
unnecessary abstraction
Currently the server allows to move on the same tile for free. I can't see any good reason for this when we want pixel-accurate gameplay but a lot of possibilities for bugs which can be introduced by this.
Netcode
Use new client->server move commands:
PGMSG_START_MOVE B direction int16 startX int16 startY PGMSG_STOP_MOVE B direction int16 stopX int16 stopY
START_MOVE makes the server route-find the character to startX:startY and then proceed with moving the character to the furthest location in direction which can be reached in a straight line.
STOP_MOVE makes the server abort any current move commands of the character, route-find it to stopX:stopY and turn it into direction
Any messages which make the character perform actions which require it to stop moving (like sitting or attacking) include an implicite STOP_MOVE command and thus should also contain a location and direction.
The client can ommit its position to save traffic when it believes that its current position is obviouse (for example when the character was not moving for a while). In this case the server assumes the position where it currently sees the character.