Search Unity

Hybrid DOTS NetCode for monobehaviour based game?

Discussion in 'NetCode for ECS' started by Kichang-Kim, Feb 28, 2021.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
    Hi, as a title said, does DOTS NetCode supports MonoBehaviour based application? if not natively, any workaround for achieving that?
    (ex, implement data-transferring system for MonoBehaviour<=> network synced ICoponentData, and hooking ghost creation/destroying system)

    DOTS NetCode's automatic sync/RPC features are so attractive, but pure DOTS has no full-engine features so we still need GameObject model.
     
    adammpolak likes this.
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    It depends a lot on what you want to use GameObjects for. So far most of our examples have been hybrid and using GameObjects in some form on the client for doing presentation and other client-only things.
    We mostly use hybrid components from entities, but we have also in a few cases instantiated GameObjects for ghosts on the client.
    We have not made any samples using GameObjects/MonoBehaviours for writing the simulation logic or anything running on the server. The way we setup the client and server in the same process and control the update time for the prediction loop makes it a bit tricky to use them both in prediction and on the server in general.
     
    adammpolak and Kichang-Kim like this.
  3. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    I made a gitbook for making a hybrid NetCode/MonoBehaviour project. You can see the Game UI (monobehaviour) get updated even though the data is controlled by ECS. https://moetsi.gitbook.io/unity-dots-multiplayer-xr-sample-project/
     
  4. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Your article(s) are amazing. Probably be outdated when the next round of entities drop but that's life using DOTS.

    I'm thinking about making something in 2D and since I dont want to reinvent the wheel, going to somehow convert mono-Physics2D into Entities and use Netcode for syncronization.

    Gonna be interesting to see how far I can go with that before I slam into a brick wall too tall for me to scale with my S*** programming abilities.
     
    adammpolak likes this.
  5. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    LOL, much appreciated! We are actually committed to keeping the gitbook up to date as ECS/NetCode/UIToolKit evolves. There was actually a great sign of stabilization from Entities v0.16 to v0.17, nothing really broke, just some good updates, we are hoping this trend continues for v.18.

    PM me if you want to join our discord where we provide support for the gitbook. The more that know how to use Hybrid ECS the better for all!
     
  6. Fressbrett

    Fressbrett

    Joined:
    Apr 11, 2018
    Posts:
    97
    I am unable to access your gitbook, do you still have that resource somewhere? I am really interested in how Networking a hybrid game can work (ECS+GameObjects) and what patters this enforces