How best to manage non-player game objects that can move or be destroyed?

If you have a 'moveable' or 'destroyable' object in your multiplayer game (that is not a player), what is the best way to manage it?
i.e.
S1) player shoots rifle/bullet, hits block, block moves or is destroyed from game.
or
S2) player shoots bazooka/missile. Missile could impact other missile.

A) State change Trigger callback
- From Trigger, proxy simulate the hit/move/destruction on each proxy.
Example: Bolt Sample project - WeaponRifle.Fx()
Risk: (I think) there a chance that it is simulated incorrectly on proxies. Best for visuals and non-critical game items (UI health bar, explosions).

B) Global Event call.
- More precise than #A. From server, use to instantiate(impact/move/destroy) the Object (not Bolt Entity) on clients.
Example: http://forum.photonengine.com/discussion/7350/networked-projectiles
Event Details: https://docs.google.com/document/d/1CvN1E2GOvd_AHnkFOSMSJTR96EBGhPRDPgPMiOuJoSg/edit#heading=h.4sdkjxnohlzo
http://doc.photonengine.com/en/bolt/current/reference/events
Risks: Sync issues could still happen (false collisions) for the non Bolt Entities like the projectile colliding into each other.

C) BoltEntity.
- Use Bolt Entity to manage. 100% accurate. Can be server authoritative.
Example: Bolt Sample project - Elevator.
Risk: Increases traffic on network, server memory / cpu (potentially).


Based on what I've read, people are leaning towards #B. However, even with the simple example of the elevator, #A BoltEntity was chosen.

Thanks for the help / insight!

Best Answers

Answers

  • The B) should be a B )
  • stanchion said:

    All of your examples here use network bandwidth, though the elevator example actually doesn't use any since it is just based off of the network frame. On the detached callback for IEntityBehaviour you can put any effects or functionality you want.

    Thank you! I missed that the elevator wasn't actually passing data. If the elevator had a more complex move than just using network frame, would you still leverage the Entity?

    So, for destroying an Entity, we could wait for a "detached" callback to create the destruction effect. Regarding "detached" callback, didn't see it in the API docs: https://doc-api.photonengine.com/en/bolt/current/class_bolt_1_1_entity_behaviour.html#a5874818e746d684460e709869ad52967

    What method would you pick to handle moving a "spear, rocket, or arrow" in Bolt?
  • stanchion said:

    There is already a rocket example in the tutorial.

    Thank you! Unfortunately, the rocket sample code doesn't appear to be fully implemented yet. However, I think I see enough to understand.
  • The elevator example in the tutorial is causing major positional issues on clients for me. I tried changing the parenting code to use entity.SetParent, which appeared to fix some of the problems but still has a large stutter on first contact.

    Without the parenting code the characters have jitter when the elevator goes up.
    How can I properly fix it?
  • apatton said:

    The elevator example in the tutorial is causing major positional issues on clients for me. I tried changing the parenting code to use entity.SetParent, which appeared to fix some of the problems but still has a large stutter on first contact.

    Without the parenting code the characters have jitter when the elevator goes up.
    How can I properly fix it?

    Is your game auth or non auth?
  • Should be auth (server owns all bolt entities)
    All I did was import bolt samples into a clean 2017.2 project and 'Debug Start' Level1
Sign In or Register to comment.