Player Movement

Started by
45 comments, last by VBStrider 18 years, 1 month ago
graveyard filla, could you please explain your system in more detail? I put it into use using what you described and players still get out of sync (jumping back when they are finished moving).

VBStrider
Advertisement
I got your PM before - I just started a new job so I'm really busy, but we can talk here......

Explain exactly what it is you are doing and I can try to help.
FTA, my 2D futuristic action MMORPG
Player presses movement key. The direction associated with that key is sent to the server. Player does not start moving.

Server receives this and starts moving the player. The direction is sent to all players including the one that sent it to start with.

Player receives the direction and starts moving the player in that direction.


Player releases movement key. The movement stop request is sent to the server. The player keeps on moving.

Server receives this and stops moving the player. The stop notification along with the position to stop at is sent to all players including the one that sent it to start with.

Player receives the stop notification, warps the player to the location that the server says he stopped at, and stops that player from moving.


With this setup, players jump around.

Since you said that this system keeps players in sync, I thought it would be a good foundation to build off of. Currently however, players are not in sync :/

VBStrider
Quote:Original post by VBStrider
Player presses movement key. The direction associated with that key is sent to the server. Player does not start moving.

Server receives this and starts moving the player. The direction is sent to all players including the one that sent it to start with.

Player receives the direction and starts moving the player in that direction.


Player releases movement key. The movement stop request is sent to the server. The player keeps on moving.

Server receives this and stops moving the player. The stop notification along with the position to stop at is sent to all players including the one that sent it to start with.

Player receives the stop notification, warps the player to the location that the server says he stopped at, and stops that player from moving.


With this setup, players jump around.

Since you said that this system keeps players in sync, I thought it would be a good foundation to build off of. Currently however, players are not in sync :/

VBStrider


Do it like this..



Player sends "I'm holding up key"
Server recieves "I'm holding up key"
Server moves player up one.
Server sends "Hey player, your moving up one"
Player recieves "Hey player, your moving up one" and moves up one.
Player sends "I want to stop"
Server sends "Hey player, your moving up one"
Player recieves "Hey player, your moving up one" and moves up one.
Server recieves "I want to stop"
Server stops moving player.



... and you'll have no jumpyness. The problem with this implementation is... if you lag, you'll keep walking.
Uh, that's pretty much what I described.

The jumping is caused by lag. While you are sending the stop packet and the server is receiving it and the server is then sending the stop notification to you, the player keeps moving. When the player gets the stop packet, he has moved further then the server says he stopped, thus getting pushed back.

VBStrider
OK, after i saw your post i went through the dusty old source, just to make sure i remember it correctly.

i am doing EXACTLY what you just described, and it works great for me. you need to get to the debuggin me thinks [grin]. start pasting code if you are stuck.

Theven, you just described exactly what VBStrider described in his post above you [lol]
FTA, my 2D futuristic action MMORPG
Quote:Original post by VBStrider
The jumping is caused by lag. While you are sending the stop packet and the server is receiving it and the server is then sending the stop notification to you, the player keeps moving. When the player gets the stop packet, he has moved further then the server says he stopped, thus getting pushed back.


but the client had a delay to start moving to begin with. so he should be in the exact position. the client is just a window to the servers world in this case, everyone sees the same thing just at different times.
FTA, my 2D futuristic action MMORPG
It works perfectly when I connect to a server on localhost, however this problem occurs if I connect to another comp. So I know it has to do with lag :/.

VBStrider
Quote:Original post by VBStrider
Uh, that's pretty much what I described.

The jumping is caused by lag. While you are sending the stop packet and the server is receiving it and the server is then sending the stop notification to you, the player keeps moving. When the player gets the stop packet, he has moved further then the server says he stopped, thus getting pushed back.

VBStrider


What I posted is not what you described. No where in my example does the player recieve the stop packet. Only the server recieves the stop packet. The player stops moving due to a lack of movement packets being sent to it from the server. The result is that the character will never jump, but instead, be viewing everything a fraction of a second late.

The system I described only works as I inferred when the movement is grid-based (eg... when your character's coordiantes are given by a gridX and gridY instead of a pixelX and pixelY). By your posts, I had assumed your project was grid-based (Since you mentioned tile-based), but I realise now its probably not.
It is tile based, yes.

The system you described is very high in traffic. Since I expect there to be possibly 30 players moving at once in the same area (worst case) then that could be a problem.

VBStrider

This topic is closed to new replies.

Advertisement