Unreal Networking

Whilst Seven Teas was primarily designed as a 1-4 player, couch play experience, we opted to support network multiplayer games. This was another reason for the jump to Unreal, as their Networking is both incredibly robust and very well documented.

Through this, we have gained a new understanding into what should be used, and where, what data is replicated (i.e. sent across the network) automatically and what custom elements we need to add.

For example, every Unreal game has a “Game Mode” that runs on the host/server, even in a Single Player game. This is where the logic and rules for the current game mode reside. Next to this, is the “Game State” which contains information that is replicated across to all connected clients. This has a list of all players, the current game time – and any other game related information one might want to transfer across the network.

When a Player performs some action, like pressing a button, then this should be handled within a “Player Controller.” On the Host, one controller is created and exists for all connected clients, yet on the remote clients, only their own Player Controllers exist. The way we’re handling players in Seven Teas, is that you can have 1-4 players in the same game, through any variation of achieving this – i.e. you can have all 4 on one machine; four individual players on their own machines; 2 on one machine, 2 on another; and so on.
In a similar approach to the Game Mode and its State, next to the Player Controller is the “Player State.” There is one Player State for every successfully connected client. This is where one would store each players health, score and other data relating to specific players. By putting it in the Player State, it is replicated to all clients.

Understanding the different levels of the Unreal networking system ensures we put the right bit of data, in the right place and save ourselves a great deal of work further down the line!