Running the game on multiple computers
Until this point, we’ve been running multiple instances of our game on the same machine. But the strength of multiplayer comes from playing with multiple people over multiple machines.
In this section, we’ll start off by showing the server’s IP address on screen and then look into how we can run a debug instance on multiple computers at the same time so they can connect.
Showing the IP address of the server
We have been using ::1
as the IP address that loops back to the same computer so that we can debug our game. However, before we can connect to another computer over a network, we need to know their real IP address. To do this, we’ll show the server’s IP address on the screen when they are hosting a game.
Figure 11.28 – The server has an IP address displayed at the bottom of the screen to connect
In Figure 11.28, you can see that we want to show the IP address at...