Showing posts with label Multiplayer Game Development. Show all posts
Showing posts with label Multiplayer Game Development. Show all posts

Wednesday, 31 January 2018

Lag Compensation Solutions for a True Real-Time Multiplayer Experience


Determining what information should be sent to the server with the purpose to replicate a true real-time multiplayer experience is the foremost step in the direction of designing effectual networking communications. Of course, there are many key facets to consider before a game developer actually gets there.


Here in this article, we will be discussing a few important topics that are important in Multiplayer Game Development. We will cover-
  1. How lag affects games?
  2. Why is it important to address lag?
  3. And a few lag compensation techniques

What is Lag Compensation?

Before actually moving to lag compensation, let’s understand a few basic concepts, which eventually will help in dealing with lag compensation issues:
  1. Round trip time or the RTT – As the name suggests, round trip time is the amount of time a packet of information takes to travel from client to server and back to the client. Here the processing times are not considered.
  2. Lag – Again, the name says it all. Lag is the time delay that occurs when the player sends the “action” and when he/she receives the “reaction” from the server. Here the action can be - jump, shoot, duck, etc. and the reaction from the server can be – avoid the hit, shoot the bullet, etc.
  3. Lag Compensation – The role of lag compensation is to minimize the discrepancy caused by the lag in the response time and offer uninterrupted gameplay. Depending on the type of game, this technique can be applied either at the server level or at the client level.
These were a few basic definitions; however, it is important to understand both client-side lag compensation and server-side lag compensation if you want to learn Multiplayer Game Development at its best. Let’s explore each of them one by one –

Client-side lag compensation

With the aim to solve lag issues from the client, the developer could work by means of an interpolation system for setting the game characters. The approach aims at delivering simulation from the clients, which is a few steps behind what is received from the server. For example – When a server sends data, like – the position of an enemy – the client simulation won’t be updated instantaneously, but it counterbalances seeing the lags from other clients.

This can even be extrapolated in a manner that – the client envisages the next possible position of the character and correspondingly revises the position when the updated data is received from the server. This also means that the client presumes that if a character is moving in a specific direction, the same will keep moving in that particular direction.

Server-side lag compensation

The client-side lag compensation solutions cover a very limited number of situations and for many developers, these solutions do not work for most of their multiplayer gameplay experiences. For such situations, server alternatives are some better options that aim at achieving better lag compensation. However, just keep in mind that these solutions can lead to complications as well.

There are three ways of compensating lag from the server-side-
  1. Deterministic simulation – This solution aim at handling all the simulation in the server, based on the inputs client send to the server. This way similar lag is experienced on all the clients, thus reducing the compensation issues. The negative aspect of this approach is that it affects the player’s interaction with the game, resulting in slowing down the player’s perception of the response time. Reason being – the user sends the input, the server receives the data, sends back a response – this wastes time, causing lag. Quite evident to the player.
  2. Reliable protocols – Another approach is to use a reliable protocol, like TCP – which ensure reliable and correct ordered data packet delivery. This ensures simple and quick processing both on the client side and on the server side. For more advanced networking, one can even opt for sophisticated, custom game protocol with lighter encapsulation for reducing the inherent overhead bracketed with TCP.
  3. Send all simulation state – In this very solution, the total game state is shared. However, it should be ensured that only one client is allowed to modify the game-state at any given point, that the state is atomic in operations. Doing this will ensure that both client (or even clients) and the server will have the latest game versions at all times and hence can perform actions accordingly.
This was all for this article, for more information on the topic and where to learn Multiplayer Game Development, 

Thursday, 30 March 2017

Multiplayer Game Development: Step By Step Tutorial

Video games are very popular in the market. Children or adults, irrespective of their ages, love to play video games.  Usually, they come in as a single player activity mode where the player has to play against a few pre-programmed challenges or a multiplayer game mode in which more than one player can play the game. Internet gaming has a strong growth by introducing such multiplayer games. Most of the top rated games on mobile and computers are now multiplayer enabled and it is always interesting to play a multiplayer game. Here we will talk about how to learn multiplayer game development and implement them on a network.

Learn Multiplayer Game Development

Understand the concept of networking

A simple way to connect players in a multiplayer environment is peer to peer architecture. Here, the concept is that two or more nodes (computers, mobiles, etc.) are to be connected to each other without a centralized system and control. Each peer having the same function, they consume the same data and share the same data with other peers.
Once each player establishes the connection with each other, the information is passed through the network to other peer and he is now aware of the decision taken by the opponent.

Benefits of peer to peer system
  • Fast transmission of data
  • Simple system 
  • Reliable to players 

Peer to peer network architecture is very powerful to generate multiplayer games. But javascript enabled games are using client-server architecture networking for game development.

Understand the concept of the game server

The game server is responsible for connecting players from various nodes into a single gaming environment. Game servers are mainly two types:


  • Authoritative game server: In an authoritative game server, the logic of the game is in memory of the server every time. Client report various details to the server through messages and the game server updates the state of the game correspondingly. The server sends back the updated state of the game to all the clients including the original sender.

  • Non-authoritative game server: In a non-authoritative server, the client’s involvement is very high because the client can send updated state of the game to other clients and to the game server at the same time.

Understand the concept of game clients

Game clients act as an interface between the human and the game software. The game client is responsible for collecting the input from the player and also is responsible for receiving various game states from the server. In the world of dynamic multiplayer games, clients are very responsible for dynamic changes happen in the gaming environment.


Challenges in developing Multiplayer games

Multiplayer game development is very expensive. And also it has very high chance of failure. After the development of the game, it will move to the testing phase. The testing phase is very critical in the multiplayer game environment. But the real test occurs when the game come to the live population.

Summary
Developing an online game is very interesting as playing it. We are in the golden era of multiplayer game development. It is an exciting task to learn multiplayer game development with all its challenges. Synchronization and concurrency control are the two important things that a game developer needs to take into consideration.