June 2013
Beginner to intermediate
296 pages
6h 50m
English
We have looked in the server extensively and have hopefully clarified all systems and learned how they come together to form a single object that services a lot of clients at once, and potentially even more aircraft! Now let's look at the other end, the client, and see how we took a jump from a single-player-only game into a fully-networked game.
Let's examine the MultiplayerGameState constructor first:
sf::IpAddress ip;
if (isHost)
{
mGameServer.reset(new GameServer());
ip = "127.0.0.1";
}
else
{
ip = getAddressFromFile();
}
if (mSocket.connect(ip, ServerPort, sf::seconds(5.f)) == sf::TcpSocket::Done)
mConnected = true;
else
mFailedConnectionClock.restart();
mSocket.setBlocking(false);
...We need to deduce ...
Read now
Unlock full access