[multiplayer] how do I wait for synchronization ?

Get help using Construct 2

Post » Sat Aug 29, 2015 9:39 pm

Hi,
I'm working on a two player online minigolf.
I read the chat and pong tutorial.

In my game, I want to call a function only when the client(s) has finished spawning all the elements from the server (both players balls).
Actually, the function (which targets one of the two balls) is called before the client has spawned the balls so the client can't find the targetted ball when it receives the server message sent from the function.

I don't know if I explain well.

The purpose is having, on the first turn of the game, each player seeing only the first player (chosen randomly) ball, whether the first player is host or client.
The 2nd player ball will be visible only then the first player has ended his turn.

In my events, the server immediately starts determining which ball to display in order to send this information to the client, but the client hasn't spawn both balls yet so it can't find it.

So I'd like to wait until the client has no more balls to spawn before doing stuff.

Any idea ?
http://canapin.com/construct/canagolf/0 ... lf-06.capx (open two windows)
Event 41 : this is where the server will broadcast the right ball (to set visible) to the peers
Event 33 : this is where the client creates all the players balls : because it takes some times, the event 41 is called way before.
If I broadcast the ball peer Id during the event 41and I create an "on peer message" event for the client, the ball having this peer id doesn't exist yet client side and that's the problem.

Sorry, english isn't my native english and it's quite difficult to explain with so little vocabilary.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sat Aug 29, 2015 9:56 pm

Something like:
event
trigger once
multiplayer.peercount = ball.count
action
send message: ready for the next command
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Sat Aug 29, 2015 10:05 pm

I'm not sure to understand ; it your events are called server side, the server side ball count will always be updated before the client's one and the issue will remain the same, right ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sun Aug 30, 2015 4:13 pm

On the peer side, you want to know when all the balls are created for the amount of players, before sending a command to the host, that all balls are present, initiating the next step of the starting sequence.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, MaujDeveloper, totoe and 5 guests