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

When would you consider alternatives to Unity's GameObject/MonoBehaviour design pattern?

Discussion in 'Scripting' started by Afropenguinn, Feb 20, 2020.

  1. Afropenguinn

    Afropenguinn

    Joined:
    May 15, 2013
    Posts:
    305
    By alternatives I mean things like like Unity's upcoming DOTS, making your own simple ECS pattern, using a framework like Entitas, doing something like Rimworld's custom Entity/Component system that mainly uses Unity for rendering, basically any design pattern that deviates from Unity's intended structure of GameObject/MonoBehaviour.

    I ask because I wanted to make a management/simulation game that involves a large amount of data, where the data layer can exist independent of the visual layer to the point where the world is literally presented to the player as a node graph. I wanted to take advantage of this simplified world by letting a large number of NPC's loose across the map alongside the player, so the more optimization I can squeeze in the more units I can have running around. I've heard from many people Unity doesn't particularly like multiple thousands of MonoBehaviours or GameObjects running at once, and my initial tests confirm that. So I began to look for an alternative, but I can't help but have that little thought creep up on me that says I'm trying to re-invent the wheel or that I'm fighting a system so many other games work fine in, so I wanted to hear from someone more experienced. Maybe I'm pursuing something sensible, or maybe I need a good reality check.

    Have you ever used an alternative design pattern, and if so, why?
     
    Last edited: Feb 20, 2020
  2. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,924
    All the alternatives you've listed are minor implementation differences of the same thing: an ECS. So I think you have your answer right there - no, it's not unusual, yes, everyone does it when they want/need scale/performance.

    EDIT: if you're wondering why Unity hasn't had something like DOTS sooner, well ... flip question: why do you think they've invested so much money + time + rebuilding the entire engine from the ground up? (hint: because the performance issues were an enormous problem, unsolveable in any neat or tidy way inside the 2004-launched, 15 years old, MonoBehaviour system)

    The bigger question is: why wouldn't you use DOTS right now?