Best practices for a multiplayer top-down shooter?

Hi,
I’m working on a 2D top-down shooter type game. I’m a bit new to game programming in general, and pretty much totally new to multiplayer programming. I’m using Slick2D, KryoNet and the Artemis entity framework. I was wondering what would be the best practices for a setup like this, such as:

  • How often to send packets, such as player location updates
  • How to prevent laggy movement on the client side
  • How much logic needs to be performed on the server side in order to eliminate cheating

Thanks! :slight_smile:

  • 20 times per second would be ok i guess
  • interpolate the data you receive from the server
  • Complete logic needs to be performed on the server cause someone could easily build a mod for the client which allows some kind of cheating

:slight_smile:

20 times is too fast in my opinion, I would send packets ever .3 seconds. There’s no need to clog up the pipeline with information you can just interpolate client side!

i am aslo working on a similar project. ive read mixed things… such as you must send UDP updates as fast as possible, only when required blah blah the list goes on.
but how does one interpolate data client side to prevent the same client from cheating?

Well: Client interpolates but that’s just for making it look nice, hitbox and stuff still stays on server so nobody can change things there :slight_smile: interpolation is just for making it look better, not for making hitboxes precise or anything, that just happens on the server :smiley: Server -> Logic Stuff, everything that really is important; Client -> make everything look smooth etc., send inputs to server :smiley:

Thanks for the suggestions! I was also wondering: what would be the best way to handle sending input to the server while minimising lag between pressing a key and seeing movement?

When sending it 20 times per second it just depends on the ping how much ms it is delayed :slight_smile:

Input prediction and lag compensation are the keywords
Example from Valve’s source engine: https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking