Server Mode

ObjectNet allows you to design your game in different approaches.

ObjectNet server can run in the most popular design modes, currently, ObjectNet can run on the following modes:

-Embedded -Relay -Authoritative -Client Only

Embedded Mode

Embedded mode is a mode where one player starts a server at the same time when he will also be a player.

The following design illustrates how this works from a topology point of view.

This mode allows to any player be a server of the game, at the same time that they can be another player. This means that when a player starts a server he will always enter the game being another player.

To use the Embedded mode you must ensure that the "Embedded" option is selected on NetworkManager.

Relay Mode

Relay mode is a mode where a server works only to redirect communication between players.

This mode is pretty useful to allow players on a private network to play online multiplayer games on a dedicated server host. Nonetheless, in this mode, one player needs to execute all game logic since the server only works to redirect communication.

This mode is especially useful to allow players behind firewalls to play online games.

On requirement to allow Relay mode is that server must be on a public network accessible to all players.

The following design illustrates how this works from a topology point of view.

To use Relay mode you must ensure that the "Relay" option is selected on NetworkManager.

Authoritative Mode

Authoritative mode is a mode where all game logic and physics run on the server and the client doesn't make any decision regarding the game.

Authoritative mode is the more trusted way to run the game without suffering from cheating, nonetheless, is high CPU and memory expensive since a copy of the game runs on the server.

In Authoritative mode, each player will send his information to the server, server will execute all logic and decisions and send the real status of the game back to the players.

The following drawing illustrates how the Authoritative server works.

In this scenario, all players send their information to the server, and the server processes all physics and game logic and sends the current status of the game back to all players.

To use the Authoritative mode you must ensure that the "Authoritative" option is selected on NetworkManager.

Client Only

Client Only is a mode that does not allow to any player run a server over any hypothesis.

Client Only mode must be used when you have an official and your game build not offer the possibility to run a LAN or personal server.

In Client Only mode, players must have a server to connect always, nonetheless, you can also provide a copy of your server to be hosted by clients, but needs to be a separate build of Authoritative or Relay modes.

To use Client Only mode you must ensure that the "Client Only" option is selected on NetworkManager.


Enable NAT Traversal

NAT Traversal allows players to run the game server in their own internal network and be visible to players out of their own internal LAN.

When players run the game on their internal network ( by how TCP and UDP are building) players out of this network are unable to reach the machine where the game is running.

The following drawing illustrates a player out of the internal network trying to reach the server where the server is running.

Even if the Unknown Player knows the router IP Address, they are unable to reach machine 192.168.1.11 where the game server is running.

You can Enable Nat Traversal by checking the option on NetworkManager.

When NAT Traversal is enabled, the system will try to open the game port used to accept client connections on the server.

The system will map the Server Player port in the router targeting the same port on the router, this means that when some player out of the internal network tries to connect to the public IP on the port used by Server Player, the communication will be redirected to the machine where the server is running.

The following drawing illustrates how NAT Traversal works.

This tells the router that redirect communication from an unknown player to IP 192.168.1.11 and vice-versa.

In this mode, players can run the server on their internal network and accept players on the other network to play on the same server.