We try to get the bare essentials of the game to work. After the initial prototypes, we choose to make the development multiplayer first instead of adding it to the project at a later stage This is our first game in which we develop multiplayer capabilities so we rather handle the learning curve sooner than later. Furthermore, the multiplayer component might put further constraints on the gameplay as it could affect performance.

Basic lobby and matchmaking

Before we work on the ingame multiplayer features players first have to able to find each other and select a game mode, map, and team. These features sound simple to make, but it requires many menus, setting, and logic. Luckily, there was an excellent multiplayer tutorial series we could use as the basis for our matchmaking system. To give a sense of the complexity, in total, we followed 27 videos of over 5 hours of content. Note that we currently use development content and this is not how it will look in the final version!

Below are some screenshots of how the multiplayer currently works.

Players are asked to give a name and select an avatar

Minimalistic main menu
Host a game. Either LAN or via Internet. In the background we use a Steam matchmaking integration
Find a game
Full lobby with some settings for the map, teams and player (builder)
Ingame, each player is connected with a spawn point. You see all the towers and units even if they are for the enemy.. Towers only shoot when the units spawned are for the players team. When a unit reaches the endpoint the player connected to the spawn point loses a live.

Technical details

Adding a multiplayer layer adds a lot of complexity. We now notice also that the Unreal Engine is mainly created for shooters. They use a quite advanced, but complex, replication system for actors. The system is developed so not all actors have to be synchronized all the time. For shooters in a large world like Fortnite, this makes sense but for a top-down TD map, we want most of the actors replicated and synchronized at all times. We do get some benefits of the system by using RPG events. Only when an event is fired the server has to do some synchronization.

A good tutorial that is showing some of the complexity of the Unreal Engine replication system.

It is important where you store information for a multiplayer game. The best resource is the UE4 Network Compendium by Cedric. By using the correct concepts you have full control over what is shared between players and the server. It is important to think about this to avoid clients to be able to cheat.

Multiplayer concepts from the UE4 Compendium

For us, this means largely that all actors spawned on the server and then distributed to the clients. For example, when a client tries to build a tower it fires an RPG on server event on the server to build the tower. Because the actor is replicated all clients will see the tower. When a tower shoots a target the logic is also executed on the server.

Unreal Engine Blueprint Multiplayer logic to build the tower

We now understand most of the concepts currently are working to implement multiplayer on the full game. There are many little tweaks we have to do, but we now have something to work with and make incremental improvements. We hope you are excited as us to soon play some awesome TD games with and against our fellow humans.

Header image By Vladimír Ruček CC BY-SA 4.0

Categories: Devblog


Leave a Reply

Your email address will not be published. Required fields are marked *