PURE_ECS
PURE_ECS, making your entities even slimmer and faster.
Entities contain some meta data by default to make it easier for you as a developer. If you leave them out, however, you can still squeeze out some performance.
This is where PURE_ECS
comes into play. This is a way of reducing the empty size of each entity to just 4 bytes! The way to make your world even more efficient! This means that even more entities fit into each individual chunk, which means that your queries process the entities even more efficiently. All entity operations speed up automatically. You want to bring millions of entities into battle? You can!
Setup
How do you do that, you ask? It takes a bit of work, but it's worth it.
As this feature is based on C# preprocessor flags, you first need the source. You must therefore include Arch's source code in your project and cannot use the Arch nugget. The best way to do this is to fork Arch. Once you've done that, you only have to do one thing. Set PURE_ECS
as a flag for the Arch project in the C# project configurations.
Now you have your fork with PURE_ECS
as preprocessor flag. To use this in your own project, you only need to do one more thing. Remove Arch as nuget and add your own Arch fork to your own project to enjoy the new features.
How you integrate this is up to you. You can copy your Arch fork manually into your project, for example. What I recommend, however, are Git submodules. This way you can simply integrate your own Arch fork into your project using Git.
Example
So now you have Arch with Pure_ECS
in your project... what now? Firstly, you should notice that you can no longer work directly on the Entity
struct. This is intentional, the entity has been minimised and no longer knows which world it is in. You have to adapt and tell it yourself!
All methods of the Entity
struct are no longer available with PURE_ECS
. So you can no longer do this.
Nothing else changes. Almost a free optimisation... Pretty cool, isn't it?
Last updated
Was this helpful?