Extreme lag... (Movement packet)

Started by
12 comments, last by ThunderSoul 15 years, 2 months ago
Note that you will need to interpolate in some way to get smooth movement, unless your game is tile-based and movement is supposed to "snap" between tiles.
enum Bool { True, False, FileNotFound };
Advertisement
Quote:Original post by Jvlaple
x = int
y = int
frame = byte
stance = byte
directon = byte


Always determine how fine-grained it has to be. Do you really need a resolution of 1/4294967296 for x and y? Or would it be enough to have just 1/65536? This reduction/quantisation would already gain you 4 bytes less (7/11=36% percent reduction). How many frames can there be? 16? Would 16 directions be enough? Then use bitfields or bitwise operations, and combine both:

struct { int frame : 4; int direction : 4; }


And you gain another byte.
Just out of curiosity, does sending a position update result in a response being sent?
Quote:Original post by Jvlaple
1) TCP - Apache MINA
2) Platform/Adventure
3) Nope.. Client calculates all movement, server simply broadcasts it and registers autoban if the distance moved is too much.


Having the client do the work is a security mistake. All operations should be done on the server. The client should simply graphically represent/interpret the numbers sent by the server.

This topic is closed to new replies.

Advertisement