Realtime server commands for multiplayer games

When making a multiplayer game, one of the most important issues to cover is how your networking communications will be addressed by your game design. The game characters are constantly moving and you should be able to position them and transmit their location accurately to all the players. But, what type of information should you send to communicate between players if you’re making a real time multiplayer game? You’ve got several options to start off: The position of every character, the exact position at any given moment Start and end position of every character, and have the client interpolate the position The user inputs that makes a character interact with the game, aka commands Let’s break down the characteristics of these options and the problems they pose.   #1 The position of every character This is the most simple approach when trying to communicate with multiple players. The fundamental issue with this approach are the amount of messages that need to be broadcasted, even for simple games. Let’s say that you want to make a 3D game that allows three players to play simultaneously and that you want it to run on 30 frames per second. That makes 90 msg/sec. If every character position has 4 variables: x,y,z for position, and α for rotation, you’ll have to process 360 variables/sec. players fps msg/sec variables variables/sec 3 30 90 x,y,z,α 360 Let’s see how much time you have to process every frame of your game. 1.000 milliseconds / 30 fps = 33,33 ms/frame In those 33ms not only should you compute the position of the players, but also cram in graphics...

Lag compensation techniques for multiplayer games in realtime

Deciding what information to send to the server in order to reproduce a true real-time multiplayer experience is the first step towards designing effective networking communications. Unsurprisingly, there are more key aspects to consider before you can get there. I’m sure you’ve heard about lag, and pretty sure you’ve experienced it yourself in a FPS or RTS. Those are games that only make sense in actual real-time, and lag makes this hard. That’s why I’ll talk about how lag affects games, why addressing lag matters, and offer some techniques to deal with the lag problem. These are the lag compensation techniques, which can be applied from the client-side or the server-side.   Understanding lag compensation These are the basic concepts we need to understand to be able to deal with lag compensation problems: Round trip time Lag Lag compensation   Round Trip Time It’s an essential concept to understand the nature of networking communications. It is defined by the amount of time taken by a packet of information that is sent from a client to get to the server and return to that client, without considering the processing times. Round Trip Time = Time to send + Time to receive   Lag So, what is lag and how does round trip time (RTT) affect it? Lag is the delay that happens since the player sends the “action” (shoot, jump, duck) to when she receives the “reaction” of the server (shoot the bullet, avoid the hit). Let’s find out how RTT affects lag with a practical example. How RTT affects lag Say we have two people, Mary and John, playing a western...

What’s hindering my multiplayer game design?

If you plan to make a real time multiplayer game, there are a few important things you have to bear in mind when you design it. A common misconception developers make is that the most important stuff to plan are programming, graphic simulation, and other technical stuff. I don’t want to underestimate the importance of coding, I’d be foolish to do so. They matter a lot but, they are the mean not the goal. The most important decisions you’ll have to make when designing for online multiplayer are closely tied to the game experience you want to offer players. So I’d like to talk about three essential aspects you definitely should consider if you want to design a great game experience. Lag fairness Reaction speed Game needs   Multiplayer Networking Essentials   #1 Lag fairness When you’re playing with other people across the internet you expect the game to be fair to all the players. You don’t expect to be penalized because you don’t own a state-of-the-art computer or mobile device. And it shouldn’t be that way. The feeling of fairness in a game is affected by the design of the peer to peer (client to client) communications. When developers don’t contemplate in their multiplayer game design that players may have radically different ping times —for example 200ms to 700ms— the player with the lowest ping will be obviously advantaged over the rest of players with higher pings. Which isn’t particularly fair, if you ask me.   #2 Reaction speed It is important that despite there will be hardware disparity from which the users will play your game, they aren’t penalized...