Multiplayer multilayer objects

Discussion and feedback on Construct 2

Post » Wed Aug 27, 2014 7:36 pm

So I've noticed some peculiar behavior in regards to networking the same objects across multiple layers. Right now I'm specifically looking at 2 "player" sprites, which I use in all the layouts of the game I'm currently developing. What appears to be happening is that when a player is "created" in a new layout due to being synchronized from the host, it's initial position is set to the last position it was at in the previous layout. This only happens on the client side and corrects itself after a short time of the player jumping all over the layout to figure out where it should be (half a second maybe?), but it's long enough to mess up events depending on it's location as soon as it's created, as demonstrated below. For obvious reasons this only occurs in the 2nd and later layouts during operation, it doesn't occur in the first layout.

Here are the significant events (I'm using r177):

In the client group I call these


The "On setup layout" is only called on the second and later layouts, as the function that calls it is called on start of layout, and is only run if a multiplayer connection has already been established. For the first layout I call


in the networking group (for the client only), which essentially does the exact same thing.

To transition between the layouts I use

The call for the Synaptop function (Synaptop.. Display: Player.ResetX etc...) is purely a debugging message I added to help isolate the problem.

When I run the project and transition into the 2nd or later layout, the "->player on created:" function gets called 2ce per player. The first time it calls the functions with the correct locations, the second time it calls it with the location it was at in the previous layout. The question is where exactly is the problem, and how to solve it?

I am assuming that the first time it called it for the characters already on the layout that got destroyed with the player->destroy function on the start of the layout,
You do not have the required permissions to view the files attached to this post.
Posts: 98
Reputation: 1,062

Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, jakezinis and 6 guests