Multiplayer multilayer objects

  • 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

    [attachment=2:2xbwj4vu][/attachment:2xbwj4vu]

    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

    [attachment=1:2xbwj4vu][/attachment:2xbwj4vu]

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

    To transition between the layouts I use

    [attachment=0:2xbwj4vu][/attachment:2xbwj4vu]

    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,

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)