#Hybrid Netcode Best Practices?

1 messages · Page 1 of 1 (latest)

harsh falcon
#

Hey everyone, I'm planning to start a casual co-op multiplayer game that requires physics and I plan to implement some mechanics in ecs, so I'm just wanting to ask a few general questions before I start actually making anything.

  1. Since I plan to use unity physics, would all logic in my game need to use a local transform component instead of any monobehaviour transform? And when should I sync it, before or after the physics sim step?

  2. I'm assuming the order of systems is very important for things that use physics / prediction, so if I want to modify a monobehaviour's underlying local transform would I need to queue up a position change through an entity as opposed to modifying it in something like update?

  3. Would raycasts need to be performed in a system with a callback as opposed to a direct call in a monobehaviour in order to ensure proper ordering of systems like the physics sim?

  4. Could I make my own netcode for gameobjects type layer over the existing networking for higher level gameplay? Would I have to, and what order should I specify the system order to process the rpcs for proper syncing?

  5. Can I make most networking actions outside of things that need to be server authoritative (like anything that affects physics) client authoritative (things like player x dealt y damage to entity)?

Bit of a long post but its stuff I've been wanting to figure out before I start. Thanks in advance!

midnight ridge
#
  1. You should be trying to avoid mixing ecs and non-ecs if possible. When you should sync depends on what you want to sync, and what you want to use it for.

  2. Again, would recommend not mixing entities and non-entities. You can modify it in update as long as you check what order it's run in. A system might be easier though, an event might work, but you could also just use a change filter for example. Or update every object, really depends on how many there are and if they all update at once or not.

  3. You can read about collision queries like raycasts here: https://docs.unity3d.com/Packages/com.unity.physics@1.4/manual/collision-queries.html
    It includes when you can use them

    1. Can't answer these ones since I haven't done networking yet