Multiplayer tutorial 4: real-time game

23

Index

Features on these Courses

Contributors

Stats

40,838 visits, 170,779 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

This 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 Multiplayer - real-time game example that comes with Construct. 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.

  • 7 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Excuse me, i have question.

    On my project, peer alwasys follow host. what wrong? Mr Ashley

    Thank you

    pras

  • Please help me im trying to add a button ive tryed so many things but it will only show on one screen

  • You guys should ask on the forum not here.

  • I think there is something wrong with the code, perhaps, updates over the years messed it up. I have tested the game as host and peer, the host moves fine but peer's movement is somewhat restricted.

    EDIT: I realized it works fine when screens opened side by side however if you use "Remote Preview", than the peer does not move propoerly.

  • Not working anymore. Even the example seems to be broken

  • Load more comments (2 replies)