General Networking Logic

Hey all, so I’m developing an online multiplayer game and I would like to discuss the concept and logic of online gameplay.

This is more of a general discussion, and something I hope to use to help me further improve my game. So for anyone making a game that has online functionality, please inform me how you implemented it! Such as movement, shooting, etc. I have read up on networking from Valve which is a very well written article which explains input prediction, interpolation, and lag compensation. My game I’m working on is made in GameMaker: Studio and it mainly consists of just moving and pressing a single button to place a bomb at the player’s position (essentially bomberman) although I am having issues making sure that all clients are properly synced up using my system. It works as such: A client sends their input to the server (LEFT, RIGHT, UP, DOWN, BOMB) and then the server uses a local instance of that client and applies the inputs to it (so for example, if the user sent an input containing “LEFT” to the server, it’ll make the local player’s horizontal velocity start to acceleration to the left) and then the calculated position is sent back to the client which they will check if their position is different from the calculated server position, if so it’ll set it’s position to the one received from the server. This makes sure that any illegal movement (such as speedhacks) aren’t allowed.

But this leads to issues, such as packet loss and latency. Now, the larger issue is latency rather than packet loss (since I’m using TCP rather than UDP) Due to latency, inputs may take a few milliseconds and extreme situations almost 1/4th of a second, so then the server will finally receive the input and send it back, but the player had been moving for so long while the packet was sending so when it is finally received back from the server it is too far back from where the player is locally, this leads to heavy rubberbanding issues and eventual desynchronization. If anyone knows of a more effective and less problematic way of doing client movement prediction, it’d be much appreciated if you share it!

Lastly, I’d love to see how the Tower Unite devs handle networked functions such as movement, shooting, and collisions.

Sorry for any horribly written sentences, I’m pretty tired at the time of writing and english isn’t my first language blah blah blah