Zum Hauptinhalt springen

Overview


Role:   Lead-Programmer
Project Team:   13 Students
Version:   Unreal Engine 4.26.2

Tasks:   - Task packages created for other programmers
  - VirtualSVN installation and configuration
  - Was involved in the structure of the level
  - Was involved in the structure of the weapon behavior
  - Character movement
  - Prototyping the multiplayer with servertravel from a lobby level
  - Creating a user-lobby with the steam core plugin
  - Everything around the part multiplayer like round time or respawn
  - Anti-Cheat architecture
  - Physical replication for example, when a booth for shopping collapses

Trailer

Description

Tropical Gunfight was my first multiplayer game. The project was about a simple PvP game with repeating weapons. The game is playable online via Steam. This was made possible for me with the Steam Core Plugin for Unreal. The game is hosted by a player, which allows the opponent to connect to the host.

The game starts in a lobby where both players have the opportunity to familiarize themselves with controls and shooting behavior. The lobby has been designed according to the theme of a bay. When both players are ready, the host can start the game. The game is played until one of the players has reached three points. We took inspiration from the game Hunt Showdown, but we added a twist to the shooting. Thus, the player must manually repeat after each shot. This is to take the speed out of the game on the one hand and on the other hand to encourage the player not to shoot randomly through the area.

When the game is over, both players are shown the winner and if both agree, a new round can be started.

Creating of an online session with steam

In this section, I will show how I implemented the Steam Core plugin into the project and how I solved a fundamental problem with the plugin. It is about the correct display of the number of players on a created server that are listed in the server browser. I will show how I became aware of the problem and how I tried to solve it. I also tried to make it difficult for players to cheat in the game.

For this purpose, certain guidelines must be followed so that abuse of the game is not possible or only possible with difficulty. For example, any kind of shooting behavior must always be done through the server so that cheating can be ruled out. The server must always check if the client can shoot. If this would not be the case, every client could decide for himself if he is allowed to shoot, no matter if he has enough ammunition or not. Furthermore, it would be much easier to implement a so-called Aimbot, because the complete logic is executed on the client.

Creating a session

In Unreal a session is created via the "Create Session" node. I give the session several parameters that allow me to read information from the listed game.

Figure 1
  1. Create Steam Core Session: Imported node by the Steam Core plugin with the parameters to create a listen server.

  2. Make Map: Here I gave special parameters to the session so that I could information in the server browser like the hostname or the ping of the session. hostname or the ping of the session. I will talk about the UID in more detail later.

Here you can see the information passed to a session in the server browser:

Figure 2

The Make Map node is the only way to pass or display information about the game to the clients in the server browser.

Problem statement number of players

If you now connect to the server as a client, you will land in the game and the number of players in Figure 2 will be adjusted. Generally, the plugin is designed so that the game disappears from the list when the max player number is reached. But I did not want this, so I increased the max player number to three. But before connecting I check if two players are already connected. If both players are now in the lobby, the server can start the main game and thus initiates a so-called server travel. During server travel, the server takes over the map change and takes all clients to the new map. All resources from the old map are unloaded and cached, the new map is loaded and all clients are loaded into it.

The problem after this server travel is, that the information about the number of players is lost and the correct number of players is not shown in the server browser so that more players can connect to the game. To avoid this, I had to use a trick that allows me to read the correct number of players from the game and still be listed in the server browser. This problem already existed with the Advanced Session Plugin and even after extensive discussions with the plugin developer, I didn't come to a satisfying solution, because the information was still lost after the server travel.

My solution was then that with each created session also an invisible Steamlobby is created, in which the server also connected. Everyone who connects to the server is automatically connected in the background to the Steamlobby and leaves this as soon as he also leaves the game. Now I no longer directly read out the number of players on the server, but the members in the lobby that are not affected by the server travel.


Problem statement invisible steam lobby

The big challenge for me now was to find a way to create a unique lobby assigned to a specific session, so that players don't randomly join a lobby. And now the make map comes into play again:

Figure 3
  1. I create a unique ID for each session which has five digits and is stored under the key UID key.

After that I create an invisible lobby:

Figure 4
Figure 5
  1. I give this lobby the name of the unique ID that I also give to the session.

  2. I also give a value that makes it possible for the server browser to filter for it.
Figure 6

Eventually, I release the lobby to connect and let the server, which also acts as a client, connect (figure 6).


Steam lobby in server browser

Figure 7
  1. In the server browser, I search for the unique ID which I get from the session information and read out the number of members of the lobby, and pass it to the 

  2. server slot, which displays in the server browser the line with the information of the single session (see figure 2).
Figure 7
  1. If the player now clicks on the server as shown in figure 2, it will be checked if the number of players exceeds the maximum. (Note the "- 1" integer caused by the increase of max players to three as mentioned before).


If the maximum number of players is not reached, the player can connect to the server:

Figure 7

Problem about problems

As you can see, I only let the client connect to the server here but not to the invisible SteamLobby. This is because there were problems when two players connect to the game at the same time and thus both are in the game. To avoid this problem, I run another check just before the player is loaded into the server, and only if it is successful, does it connects to the invisible SteamLobby.

Conclusion

In the course of the project, I was confronted again and again with problems like this one, which made the complexity of a multiplayer game clear to me. Seemingly simple things become complex problems and that explains why these issues have to be dealt with away from regular gameplay. The whole topic of networking is a science in itself, with its own rules and procedures that have to be followed to master the fight against cheaters.

The project phase has given me exactly what I hoped for and I have used all my time to gain as much knowledge as possible from networking to having basic knowledge in the working world to go deeper into the matter.

  • What I have learned
    • Alot about the architecture of multiplayer games.

    • Good planning and communication has led to milestone achievement in the code department.

    • Starting early with the prototype has given us a lot of time in the project phase.
  • Alot about the architecture of multiplayer games.

  • Good planning and communication has led to milestone achievement in the code department.

  • Starting early with the prototype has given us a lot of time in the project phase.

Repository

Link to the repository: ​https://christian-brueckl.de:8443/svn/TropicalGunfight/​​​

_________________________

Username: showcase
Password: showcase