Multiplayer: Sync object destruction

0 favourites
  • 5 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • So I have player objects being synced between peers in a multiplayer mode. Ideally the player objects would be destroyed at the same time for all peers, they were easily created at the same time and move around just fine, but as soon as an event on the host side calls for destruction of the object, it immediately destroys it on the host side as expected but has a 2 or 3 second delay on the peer side. Is there a better way to sync the destruction of objects? There are a few other things that will be created that I'd like to have synced on just when they're created and destroyed, like bullets, but with that destruction delay it doesn't really work.

    Edit: I should note that these are peer-associated objects. It actually has no problem destroying them immediately when the peer disconnects (which was unexpected behavior for me, but it works out alright). I don't know if that has some effect on the destruction speed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you associate an object with a peer, you are indicating that the object will exist for the same amount of time that the associated peer is connected. So you should not try to destroy it yourself - as you've noticed, it's automatically destroyed when that peer quits.

  • So what's the best way to destroy the object and still have the player be able to stay connected spectate the game until its end? Should I have the host send out a command to destroy it on the peer side? Or am I better of doing a fake destruction, making the object invisible and otherwise unable to be interacted with?

  • The Ghost Shooter: Multiplayer demo just makes dead players invisible. Is that why you want to destroy a peer-associated object? Because they've died?

  • Yeah, it would be a case of the player dying. I thought the Ghost Shooter multiplayer demo just re-spawned you at a different position on death, so I wasn't sure how the Multiplayer object handled object destruction. I'm designing the game to be match based, so the players start in a chat lobby until the host starts the game. Once the player dies in the match, they still get to watch the match to its end, at which point I'll probably throw everyone back to the lobby to start a new match if they want.

    After playing with it, looks like hiding the player object is the only option unless there's a way to disassociate the object after it's been associated. I'll have to go through and add a check in a few events to disable all interactions with the "dead" player and cancel out inputs, collisions and bullet overlap checks (does disabling a Sprite's collisions disable overlap checks as well? Overlapping at Offset seemed like the easiest way to test for bullet collisions with lag compensation). Bit more work, but not too bad.

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