Multiplayer - Spawn object issue after moving to new layout

Get help using Construct 2

Post » Sun Nov 02, 2014 10:35 pm

Hi!

I'm trying to setup a 3 layout multiplayer design where it goes from a LOGIN -> LOBBY -> GAME.

All the multiplayer samples just show a 2 layout design going from LOGIN -> GAME. The problem I'm running into is that as soon as I go from LOBBY to the GAME, a lot of things start to go wacky:

- I can no longer create objects on host and have them sync to clients
- the On Created on the client doesn't seem to be work like the samples any more

1- Does anyone know what the correct practice is for setting up SYNC objects when going across a few layouts?
2- Should we be able to add new SYNC objects after the first "Connect to signalling server" call?

Anyone else have an issue with moving to new layouts?

Please let me know if there is any more information I can provide.
B
33
S
10
G
4
Posts: 48
Reputation: 3,491

Post » Sun Nov 02, 2014 10:59 pm

Furthermore, I have now just changed my GAME (3rd layout) to have nothing but some CREATE OBJECT calls and that is not working at all. These objects are new objects and are not sync'ed with the multiplayer.

Looks to me that moving to a new layout is causing an issue with the multiplayer state. This affects the host's ability to create objects (synced or NOT synced)
B
33
S
10
G
4
Posts: 48
Reputation: 3,491

Post » Mon Nov 03, 2014 3:32 am

Changing layout will cause your object to be destroyed on layout change. You need the objects to be global to ensure it works properly. https://www.scirra.com/forum/viewtopic.php?f=147&t=118237
B
28
S
8
G
4
Posts: 553
Reputation: 4,914

Post » Mon Nov 03, 2014 3:53 am

Thanks for the Reply DickFace although I had no luck with the Global setting. Setting it to Yes is definitely working for my "Peer" object that is holding some properties of each player, but what's weird is that as soon as I go to the 3rd layout, the HOST can no longer create anything (even non synced local objects). It's almost like the System -> Create Object has been hijacked and is now broken.

With Global set to true, objects that were spawned definitely carry over to the new layout. I'll post a CAPX of what I have right now to see if anyone can show me the errors of my ways :P
B
33
S
10
G
4
Posts: 48
Reputation: 3,491

Post » Mon Nov 03, 2014 3:59 am

The attached CAPX has 3 layouts: Login, Lobby, Game.

The Login -> Lobby works as expected. Once all players are ready and the host clicks start game, that's where it goes weird. The "Game" layout has some random tests in it that can be disabled if needed. Things like just trying to "Create Object" to see if something would be created.

Also, the "Signalling" group in both the Lobby and Game event sheet are very similar. I'm not sure where it's valid to use the Multiplayer -> Sync Object action if you are moving across Layouts.

The "Peer" object is the main object from the lobby that is associated with each client and follows the real time multiplayer sample's pattern
You do not have the required permissions to view the files attached to this post.
B
33
S
10
G
4
Posts: 48
Reputation: 3,491

Post » Mon Nov 03, 2014 4:53 am

Hey @broknecho...
1. In game events - event # 10, there is a oversight - You are trying to create objects in layer "Main"? It should be layer 1...The rocks got created
2. I lobby events, I noticed a redundant event - In Lobby common group event #66 you have Go to layout Game and then again in Lobby Host - Event #42 you have Got to layout Game...Instead have the event in peer group and host group...remove the common event.

Hope this helps
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Mon Nov 03, 2014 5:04 am

@kmsravindra you rock!

Definitely a case where I was staring at this problem for too long and missed that the Layers were out of sync. Thank you so much.

Also thanks for the tip on Go to Layout! Will update that.

Thanks again!
B
33
S
10
G
4
Posts: 48
Reputation: 3,491



Return to How do I....?

Who is online

Users browsing this forum: ksiads, Magistross, mtnboy22, Rable and 3 guests