Search Unity

Noob question about ECS and existing code-based assets

Discussion in 'Entity Component System' started by Steve-Tack, Jan 24, 2019.

  1. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    With ECS, you structure your code and data very differently than with traditional GameObjects.

    Does that mean that pretty much every code-based asset on the Unity Asset Store will not work with an ECS project?
     
  2. Yes and no. They probably will need interfaces to work with a new system, and their publishers will take care of any of that as we're going forward.
    Also, not everything need to run on ECS. Some things better to stay on OOP basis. Or at least not that much of a big deal if they do. Obviously passing data between assets and systems need to be addressed.
     
  3. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I doubt any of my personal hobby stuff would push the envelope so hard that I'd need ECS much (or if at all). Though the Project Tiny thing is pretty interesting and I believe it relies on ECS.

    It does make me wonder about projects that truly need ECS. Maybe they need to hit 90 fps on mediocre VR hardware or really push PC games hard, etc. Will those project need to plan on being less reliant on third-party assets for certain things? Passing data around between data-oriented and OOP code sounds kind of clunky.

    I was wondering about that in terms of one of the popular input systems on the asset store.
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    There's a new input system preview that somewhat works with ECS.
    These things are going to be addressed as time goes on.

    Afaik, any game would benefit from having at least critical code converted to ECS.
    Plus, performance == less battery consumtion on mobile.
    PC games will push boundaries of how much stuff could be done behind the scenes / rendered, as less and less devices will be CPU bound.

    With burst that boundary will move even further.

    It's simply impossible to do some things efficiently with MB + GO approach.
    An overhead / memory fragmentation will sink FPS in some cases.
     
  5. Deleted User

    Deleted User

    Guest

    @xVergilx is that input in a separate package or some github location? I will have a dig in a sec but if you had a link it would save me time.

    Currently looking at the usage scenarios around the normal input class for ECS
     
  6. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I’m fuzzy on how the ECS stuff will be able to interact with traditional Unity code. I assume it’s something that could really mess you up if you do it wrong. I suppose Unity themselves is still working it out.
     
  7. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    It's plain simple. Get your data. Push it as an entity with a bunch of components. Tear that data apart at systems.

    With addition of Entity Prefabs it's pretty simple to create prototypes of entities even through the UI, no need to create archetypes manually anymore. A single manager could spawn entities for you, with a single call, only data is required to be passed.

    With the Hybrid Renderer it's absurdly easy to create some asset store level assets to manage your own GPU instancing, at almost no cost. Surely, some QoL still would be required, but it's much easier than developing own rendering system solution.

    More than that, you just can't physically mess up things. If you do - you'll know about it. I'd say there's way too many checks and validations performed in the Entity world, and not enough in classic approach.

    Also, it's a one time learning investment, and I'd bet it would be even easier in the future. Looking at how UTiny handles entity, I could even assume that we'll have a decent UI / editor tools for arranging entities.


    My advice - try it. But try it at small scale. Pick up the basic stuff first, like creating and managing simple data, then go for something bigger. No need to transition all your game and assets to ECS.
     
    Steve-Tack likes this.