Preparing our game map

For now, the map is only going to work as a testbed for our multiplayer implementation. We need to add our spawn point objects to the map, configure their team colors, and remove any unwanted actors from the scene. As it currently stands, there is a high volume of cube physics actors. We do not want all of these actors updating over the network, as that would increase network traffic; we might as well remove them. Compile and run the code now and address the editor World Outlier.

Under the subfolder Cubes, remove all cube actors from the scene by highlighting all of the EditorCubes:

Preparing our game map

With the cubes selected, press the delete key. Next we are going to place our spawns! Create a new Blueprint actor that inherits from NSSPawnPoint called Spawn Point. Open the generated BP now, select SpawnPoint(self) from the Components panel, and address the Details panel. Under the Replication section, untick the NetLoadOnClient flag, as only our server is concerned with spawning the players. This object does not need to exist on the client. Now let's place these spawns in the scene!

Place six of these new blueprints in the scene in rows of three; set half of the spawns to be BLUE_TEAM and the other to RED_TEAM. The property will be found in the Details panel under the NSSPawnPoint section. I place the spawns here on the following map:

Preparing our game map

Now when you start a PIE session with multiple clients, the spawns/teams will be assigned properly. Try a PIE session with four players; you will see something like this:

Preparing our game map

Testing our game functionality

Ok, now we have two teams, both with players that can shoot. Let's try shooting a player on the enemy team and see what happens. It is advised that you set it up so you can see both the editor viewport and two of the client viewports so you can be sure that everything is working as intended. Hopefully you will find that if you shoot an enemy player 10 times (100 – 10*10 == 0), you will then see that character ragdoll! And after three seconds, respawn!

Testing our game functionality

Ensure that this is viewable on all clients and the server, especially that the player is reset properly on respawn!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.147.53