[Multiplayer] Destroying game object made on connection (not synced) freezes game?

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I was wondering, is there some hidden connection made when objects are created upon connection/peer connection?

    To get what I need working (a hand of cards for each player) I instead just create objects on the host and peer separately. So there's nothing there that is synced or associated directly by events.

    However when I try to destroy the cards on the host, upon the peer disconnecting, it freezes. (NOTE: when running in debug, the amount of card instances are updated based on how many were deleted, but beyond that it's frozen).

    I've tried deleting instances based on comparison, deleting all instances, calling a function to delete the cards, however every one of those just results in a freeze.

    I can run different events in the on peer disconnect, and I can destroy an object that started in the layout without any issue.

    I tried also looking at the multiplayer example projects I'd already been using as reference, but they don't function like mine does now.

    So is there some kind of hidden connection made, because these cards are being created upon the connection-even though they aren't being destroyed automatically via disconnect or altered in any other way normally?

    Is there a specific method you're meant to use in this case?

    Would really appreciate some guidance on this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Quick answer would be no.

    Have you tried destroying the cards before the peer disconnects? Have the peer disconnect without destroying the cards? Does either result in a freeze?

    What exactly happens when you say freeze? You mentioned the debugger is still running. Maybe something in your events stop working when there is no peer connected?

    Multiplayer issues are notoriously hard to troubleshoot, and exponentially more so without an example project to work with. Can you replicate the issue with a minimal project?

  • To further clarify the freezing, it's definitely frozen and not just inactive. Because even though it reaches the point where it updates that the cards are removed, visually they stay, and the connected peers doesn't reduce from 2 to 1 as it otherwise would.

    You can't try and destroy the cards before the peer disconnects, if you want to do that when they disconnect. As you can't preemptively decide they will disconnect and destroy them ahead of time.

    Having them disconnect without destroying the cards stopped it freezing, that's the current workaround I've had to use, however in my following project I'll definitely need to work this out so I'd really appreciate any further information/answers you might get from the above clarifications.

  • "You can't try and destroy the cards before the peer disconnects, if you want to do that when they disconnect. As you can't preemptively decide they will disconnect and destroy them ahead of time."

    I meant to try these two things to see if they cause a freeze or not.

    Freezes in construct are generally due to endless loops.

    If you try to minimize the project it will help you to identify the cause of the freeze.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)