Entitas-csharp: What would happen if I have 1000 component type?

Created on 13 Sep 2018  路  18Comments  路  Source: sschmid/Entitas-CSharp

Hi,

I have a question.

I saw in the base class, Entity has a IComponent[] array which has the exact length of the total component classes count

so what would happen if I made a lot of component types (like 1000), would it impact the performance badly?

Thanks

Most helpful comment

Not really. We currently have a total of 1.7k components in our project with 800 in the largest context. So far we don't have any problems.

All 18 comments

Not really. We currently have a total of 1.7k components in our project with 800 in the largest context. So far we don't have any problems.

1.7k... rene is going for the world record ;)

@zsydeepsky it would affect the memory footprint per entity, but not really the runtime performance. Entities will be reused, so once created you won't allocate the array again and again. If you want to know the exact numbers, you can can calculate numComponents * sizeOf ref to get the memory consumption of the component arrays

OK, thanks for the answers guys :)

Not really. We currently have a total of 1.7k components in our project with 800 in the largest context. So far we don't have any problems.

just for curiosity
is your project targeted on mobile? especially on some old phone models like iPhone 6?

Yes, we support the current version up to iPhone 6, but we also plan to support 5s.

Yes, we support the current version up to iPhone 6, but we also plan to support 5s.

Cool~
I have no problems then
Thanks for your info~

You are welcome pal

@StormRene How many system u have? Are remain all the systems together all the time or u load different set of systems based on scene?

@optimisez Around 3,5k systems. Mostly reactive. Yes they all stay together all the time - loaded on start of app.

@StormRene do try to keep the parent systems as flat as possible to reduce method calls, or are you going clean with tons of sub parent systems?

tons of sub parent systems :-D

@StormRene Awesome. What's the target frame rate of your game? 60 fps?

We create a city builder game with tower defense elements so 30 fps is enough. More is nice to have.

@StormRene I see. Thanks for sharing your experience.

@StormRene out of curiosity, what does you folder structure and organization strategy look like for components and systems? I imagine with that many components/systems organization is critical since you might forget what a component/system is for eventually and therefore forget where to go to update something or accidentally create another component type that is meant for the same purpose as a component that already exists, for example.

The structure looks like the following:

->Client
-->UIFeatures
-->ActionFeatures
-->InputFeatures
-->Services
-->Factories
->Simulation
-->CoreFeatures
--->DayFeature
---->MorningFeature
----->MorningComponent
----->SomeMorningSystems...
-->MetaFeatures
-->CommandFeatues
-->Services
-->Factories

Folder == Feature - Each folder needs a feature class.
Of course it happens that logic is written twice, or it is forgotten that there are already components. I assume this happens with every big software project. Communication and documentation is the key.

True that. Cool, thank you for sharing. Organization with ECS architecture is something I've been struggling with.

Was this page helpful?
0 / 5 - 0 ratings