Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Netcode for gameobjects in ECS

Discussion in 'Netcode for GameObjects' started by xAdamQ, Oct 15, 2022.

  1. xAdamQ

    xAdamQ

    Joined:
    Jul 23, 2016
    Posts:
    53
    We are developing a relatively big project, and I am wondering, is it possible to use both Netcode for gameobjects and entities together, because we may need both for compatibility reasons.

    these are the current errors:
    upload_2022-10-15_22-55-43.png
    I thought of modifying the current packages are remove the duplicates(if that is the case), but unity.transport gives the first 3 errors for some reason on an ecs project(even without installing netcode for entities obviously)
    ecs packages version 1.0, unity 2022.0b10
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,506
    Why exactly? What for?

    What you are trying to do is unsupported. It may or may not work, it may or may not break in the future, it may or may not have unexpected side effects all throughout the project‘s development. In short: you are very likely to enter development hell with no help for any issues you may encounter. Don‘t go to Ravenholme! ;)
     
  3. xAdamQ

    xAdamQ

    Joined:
    Jul 23, 2016
    Posts:
    53
    the game is hybrid ecs, so will netcode for entities work for both entities and monobehaviours? because I can't find a clue they will. I have experience only with netcode go.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,506
    Well, just because you use both MonoBehaviours and Entities doesn't mean you have to use both versions of Netcode together.

    Either implement all of the Netcode with MonoBehaviour or with Entities. Which one you use depends largely on what each system is used for. The easier route will certainly be to go with NGO and pull/push any information that you need in ECS through it.
     
  5. xAdamQ

    xAdamQ

    Joined:
    Jul 23, 2016
    Posts:
    53
    I am using dots physics on the server, and it play well with ecs. the only thing gameobjects we are using are some external assets. I know we can use NGO to make custom messaging system that work with ecs, but I don't want to reinvent the wheel. I am reading the docs of netcode ecs to decide.

    Thanks for your responses.
     
  6. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,506
    Come to think of it, you could also go all barebones and only use Unity Transport. The docs have examples for setting up server and client connection and that. That's got to work with both worlds but it will also require more networking gruntwork.

    It might even be possible to use Netcode for Entities and on the Mono side use only direct Transport messaging. Or vice versa, NGO plus Transport-only ECS.
     
    xAdamQ likes this.
  7. xAdamQ

    xAdamQ

    Joined:
    Jul 23, 2016
    Posts:
    53
    These are great ideas, we will put the direct use of unity transport into account.
    Thanks a lot.