Online game development

All services

Why online game development is difficult

Online games are the most profitable regardless of genre. If the player spends a lot of time in your game, then at one moment he would like to improve the experience: buy some skins, items or powerups. To make the game playable for a long period of time developers must make competitive mode with ranking system or enjoyable cooperative mode.

online game shooter

We will tell you does online games works, what is the biggest problem of online games and what tricks we use to make these games more enjoyable.

How does the online games works

Online game development requires interaction between players from different devices. To make this possible the  developers must divide a game into a client and a server parts.

A client is a part which runs on player’s device, renders the graphics part of the game and takes player’s commands and interacts with server. Basically, it’s the game itself or a frontend.

A server part or a backend is an intermediate between all players. A server gets player’s commands from a client, executes them and sends the result back to client. It happens from 4 to 128 times a second depending of game genre.

game server

Server and client interaction

A server contains all of the player’s data and it is the only entity allowed to change this data. For example let’s look at the typical FPS game:

  • the player moves forward;
  • the client sends new coordinates of the player to the server;
  • the server calculates if the player can possibly move to that coordinates in given time. If he can, the server updates the player’s position data;
  • the server sends new coordinates to the player;
  • the client renders a new frame from using new coordinates.

This cycle is called a tick. When programmers are talking about 64 tickrate they mean that the client and the server interact 64 times a second. 4 or 8 tickrate is enough for a slow strategy game or online chess, but for fast online action games where every moment matters the 64 tickrate may be considered as slow.

online game character

The difficulties of online game developing — cheaters

The main difficulty of online game developing is dealing with cheaters. Cheaters use special programs and hacks to gain an advantage over the other players. The cheaters affect the profitability of the game: if there are many of them, the majority who play fair will leave the game.

game cheater

To fight the cheaters the developers use authoritarian server model which we described above. If there were no authoritarian server the cheaters could fly across the map, walk through walls and make themselves immortal. They can do so with some vulnerabilities like stealing data from server. It works this way:

  • the server contains the data of all the players;
  • the fair player have access only to his data and the data of players he can see at the moment;
  • the cheater can hack the server, get the hidden data about enemy position and display this data on his screen. Roughly speaking, he can see through walls.

We develop our server-side secure so no one could possibly steal or modify data on server. By doing this we can be sure that cheaters couldn’t add themselves 9999 coins, reset any in-game timer or get any other advantage. This works with any kind of online games.

Lags and how to avoid them

The second difficulty of online game developing is latency problem. To move in the game world the player must wait till the server get a data package from client, process it together with other player’s data and send back a complete package. The server can process data almost instantly but the time needed to deliver packages is noticeable by players.

The latency between the player’s action and server registering it and showing to other players is called ping. The ping is measured in milliseconds. The most of players consider normal ping at 50-60 milliseconds or 1/20 of second. If the ping is higher than 60, the player will feel lags.

first person shooter lags

Example of lag: the player has 500 ping, and his enemy has 50. Enemy peeks around the corner, sees the player and shoots him. From player’s perspective it looks like he was shot instantly without time to react. That’s because the package with data “Enemy is in your field of view” will arrive to the player after 0,45 seconds after the enemy actually sees him. And the enemy has 0,45 seconds handicap to aim and shoot before the player even see him.

How to reduce lags

There are also lags based on package loss. If the player moves continuously the server with 64 tickrate will allow other players to see his movement on every frame. But if this player has bad internet connection with 75% package loos, the other players will see him moving only 25% of time. It would look like he’s teleporting, and he will see other players in the same manner.

online shooter

To solve the lag problem our programmers use these algorithms:

  • extrapolation — to calculate the future based on past. For example, if the car is moving forward with 100 mph then we can calculate it’s coordinates in next tick with acceptable accuracy;
  • interpolation — to show the player not the current tick but the past. By doing this we can get rid of high ping teleporting and make the gameplay look smooth.

Casual online game development

Interpolation and other netcode smoothing tricks are used in fast action games like shooters, MOBA and racing games. We don’t need such complicated things to make a mobile strategy or a single player game with online leaderboard.

online game top down

But still, if the game has in-game purchases, we want to protect it from cheaters and hackers. The best way to do it is to constantly synchronize the state of the game with a server. So if the hacker will try to add to his account a million of premium currency the game will simply deny it.

And to make things even harder for cheaters we like to add some serious cryptography to cypher the traffic. Thanks to cryptography the hacker will have no chance to modify the packages or cheat in the other way.

Why we are talking about ping and cheaters

Development of online and offline game doesn’t differ so much. In offline games all the game logic and rendering is processed on the player’s device. In online games most of the logic is processed on the server and the rendering — on the client (player’s device). The developers only need to provide data flow between client and server.

But most of offline games generate profit in flat sales. If the player bought your game he can do everything he wants to, including modifying the code. If the cheater will hack the game he won’t harm other player’s experience.

online cheater

Most of online games generate profit in built-in app purchases and microtransactions. If the cheater can hack it and get all the premium benefits for free then he is clearly stealing your money. And worst of all he can harm other players, make them leave the game and cut your profit from their future purchases.

The ping problem also harms player’s experience. You won’t be playing the game which always decide that your clear headshot doesn’t hit an enemy at all.

That’s why we focus on developing fast and secure game code, especially in mobile online games, where big percent of players may use slow mobile data.

Hire us to develop mobile online game

We can develop online game of any genre and for every program. We know how to deal with hyper casual games with simple leaderboard and Facebook-sharing, online farms or mobile strategies, MMORPGs or competitive online shooters.

Kreonit will provide all the things needed, write secure and fast netcode, help with server renting and tech support for players. Hire us to make a online game which will make you money.

Keep in touch:
+44 7 44 55 3 66 31

Send us a message via messenger or email