Multiplayer tutorial 4: real-time game

Favourite 73 favourites
Tutorial written by AshleyOriginally published on 19th, March 2014 - 4 revisions

Translation Team:

1 revision

kkThis tutorial assumes you have already read Multiplayer tutorial 1: concepts, Multiplayer tutorial 2: chat room and Multiplayer tutorial 3: pong.

The first tutorial covered the theory of how multiplayer games work and the way they need to be designed, using techniques like local input prediction and lag compensation. The second tutorial covered a practical example of a chat room, which dealt with practical use of signalling, connectivity and sending messages. The third covered the basics of syncing objects. This tutorial will now cover the final topics of designing real-time games, such as implementing the input prediction and lag compensation described in the first tutorial. This is an advanced subject; if you are not already comfortable with your knowledge, consider revising the prior tutorials. This tutorial also covers some of the same ground as the previous pong example again, which is worth revising.

To get going, open the Example: Multiplayer - real-time game example that comes with Construct 2. This can be found in the Select template or example dialog that opens when pressing File - New. As with the previous tutorial, the project will be described event-by-event in more detail than the comments already in the project.

Running and testing

As with the chat example, the real-time game example must also be run from the first layout (F4), since it needs a valid name entered from the Login layout.

When testing the tutorial multiplayer games, it's possible you will meet other people who happen to be running the tutorial at the same time. However users commonly go "away from keyboard" (AFK) and leave things running without attending to them, so don't be surprised if other people are present but don't respond to chat messages. If you don't happen to meet someone active, get a friend involved and do some testing with them!

It's also possible someone will already be hosting the tutorial but you won't be able to connect to them. If that happens, change either the game, instance or room name and you'll start a new game which you host yourself.

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.