Skip to main content
6 events
when toggle format what by license comment
Apr 20, 2012 at 1:13 vote accept user15498
Apr 19, 2012 at 10:33 comment added tigrou sending only input state can be useful in some games in order to avoid cheating. it also make sure rules are always the same for everybody, even if client executable version or some scripts (eg : in a mod) differ from server version. however it is not always needed, especially if you want to keep everything simple.
Apr 19, 2012 at 0:31 comment added user15498 I currently send at 20 times per second, but I think it'll be ok to send all types of the same data in the same packet. Also, the reason for sending 3 positions is so that I can make the movement seem smoother. I can interpolate between the current pos and the last known pos, but It'll look weird when the player is running into a wall but is moving slower because the distance between them and the wall is smaller than the usual traveled distance. Unless I set up a speed, hmm. Yes setting a speed should work.
Apr 19, 2012 at 0:25 comment added justinian Well, you shouldn't need to send three positions for the same player - just send the latest. Between that and choosing a good interval for sending them, you should be able to handle much more than 7 players. (10 times a second should be fine.) As for conversion, just send the position coordinates as whatever datatype your game is using. (Tangentially: note that bits of precision is different from digits of precision. Take a look at how floats are encoded: en.wikipedia.org/wiki/IEEE_754-2008 for more info.)
Apr 19, 2012 at 0:01 comment added user15498 Thanks for the tips, I currently send 3 positions per server tick (since there are 3 normal ticks in one server tick) which takes up 12(x and y coords that are 2 big so their max is 62k) + 2 (player ID + packet type) slots. How can I convert from float to unsigned chars? Something like xvalue - int(xValue) * how many digits of precision I want to have and then just package that into chars? Also, I used to send position updates for each player in different packets, but that lagged up really quickly after about 7 players.
Apr 18, 2012 at 23:38 history answered justinian CC BY-SA 3.0