about bandwith, serialized objects take much more space then just raw data they contain. I use NIO and only send data I need (x pos, y pos, speed and such) in ByteBuffer and it dosen’t take much bandwith, 4B for single Integer or Float, 2B for Short… When your data arrives you can create object you need with them.
So since you cannot send message every frame your problem is what to do between messages. As sunsett said, you can try to simulate movement until next message arrives and then correct mistakes. This is hard to do good (I tried) since player can quickly change direction and speed between updates so when his message arrives at server correction is clearly visible. You can develop that further to make correction not visible but that is hard, I went for simpler way and implemented forced lag I mention earlier so everything stays smooth and correct.
About collision and such, you’ll need to do actual collision on just server becouse client can simulate wrong data and make a fake collision or something similar, I’ve done it so the server process all collision and sends them to client which then applies it. You can also make visual collision on client but not do actual calculations of stuff until server confirms it. All this is game dependat and you must find the best way to solve it.
@sunsett
tnx for that tcp method… I thought merging in TCP is low level, TCP protocol controlled and that you can’t control it even in native code. Maybe I manage to fix my data laging now.
EDIT:
about your picture blow, that could never happen if you write good code
Let’s see, client starts to move forward towards the hill and sends a message with his info, server recieves the message and starts to move the local client towards the hill. Lets say next message dosen’t arrive before local client reaches the hill. As server moves local client towards the hill it gets collided with the hill and server stops moving it. So on both client and server you can preserve terrain collision. Remember your player on server isn’t just a image, it’s an real object just as much as on client’s machine.