Multiplayer tutorial 3: pong

Favourite 55 favourites
Tutorial written by AshleyOriginally published on 22nd, April 2014 - 1 revision

This tutorial assumes you have already read both Multiplayer tutorial 1: concepts and Multiplayer tutorial 2: chat room.

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. This tutorial will now cover a simple case of synchronising objects in real-time for a 2-player multiplayer pong game. This is an advanced tutorial; if you are not already comfortable with your knowledge, consider revising the prior tutorials.

To get going, open the Example: Multiplayer - pong 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.

This example uses auto-joining rooms. As players join the game they are paired up in to games, since it only works with two players per game. This is described in more detail later. If you join the game you may find another person running the tutorial at the same time by chance; if not, or you cannot connect to them, try testing with a friend or just opening two browser windows side-by-side.

Share and Copy this Tutorial

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

Comments

4
Keyo 3,163 rep

Cool! Thanks for sharing.

Tuesday, April 22, 2014 at 3:06:37 PM
4
iceangel 33.3k rep

Thanks @ashley, a new tutorial for multiplayer.

Tuesday, April 22, 2014 at 4:25:33 PM
3
Tedg 9,889 rep

Thank you ashley for this tutorial was extremely helpful. :)

Tuesday, April 22, 2014 at 6:06:30 PM
3
AbelaNET 14.9k rep

@Ashley - Thanks. Keep up the good work. I am always looking forward for the latest updates in C2.

Tuesday, April 22, 2014 at 6:38:45 PM
1
Bl4ckSh33p 9,615 rep

Very nice! :)

Saturday, May 10, 2014 at 5:30:45 PM
0
Faintifaitonus 206 rep

Tell me what to do! I started doing a multiplayer game and took as a base this source but as soon as I go into the game I go to the host of another game not my help what to do

Saturday, April 01, 2017 at 7:37:54 PM

Leave a comment

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