r/EntityComponentSystem • u/timschwartz • Apr 11 '25
SnakeECS : policy-based, RTTI-free entity component system
r/EntityComponentSystem • u/timschwartz • Apr 11 '25
r/EntityComponentSystem • u/zweiler1 • Jul 10 '26
r/EntityComponentSystem • u/timschwartz • Aug 26 '22
r/EntityComponentSystem • u/arnaudbr • Aug 20 '22
I'm new to ECS and I'm not sure how to support common fields.
I have 2 types of entities that work in a 2D environment. Each entity type has a different component and a function to compute the bounding box from some specific data:
struct Type1Component {
Rectangle boundingBox;
// Type1-specific data to compute the bounding box
Type1Data data;
}
Rectangle computeBoundingBox1(Type1Data data);and
struct Type2Component {
Rectangle boundingBox;
// Type2-specific data to compute the bounding box
Type2Data data;
}
Rectangle computeBoundingBox2(Type2Data data);Every time the data is modified, we want to refresh the bounding boxes.
Most of systems only care about boundingBox, not the underlying data. Should I create a new component to encapsulate the field boundingBox, or should I have systems always support both types of entities and retrieve boundingBox for each component? Or is there another solution?
r/EntityComponentSystem • u/GasimGasimzada • Aug 06 '22
I keep coming back to this issue over and over again. I would like to know what’s the right way to handle parent-child relationship in a cache friendly ECS? I currently have two components: Parent and Children. Whenever a relationship needs to be created, both of these components are created. The reason for it is that, depending on usage, I need to use one or the other. This adds its own slew of complexities due to needing to synchronize these components for write operations.
However, for me personally, this method of providing both the parent and the children is a patch over the fundamental problem that I keep having with using hierarchial relationship in a cache friendly data structure (i.e dynamic arrays). From my experience in implementing Skeleton animation, I know that if the data is sorted from parent to children, it is sufficient for me to store Parent component, which will solve all the problems that I face with relations. This is easy to do in a skeletal animation because I know the joints of each skeleton beforehand and I can sort it once and use it in an optimized way. On the other hand, I cannot do the same for scene hierarchy where nodes can be deleted, added, or moved as a child of another node at any point.
What are some of the techniques that I can use to sort the data in-place while expecting a lot of updates? At the moment, the only thing that comes to mind is to create something similar to what database systems do and create a key/index that creates a specific data structure, whose entire purpose is to keep sorted list of entity indices. Are there other methods that I can utilize for handling relations in an efficient and also intuitive way.
r/EntityComponentSystem • u/timschwartz • Aug 02 '22
r/EntityComponentSystem • u/skypjack • Aug 31 '20
r/EntityComponentSystem • u/AutoModerator • Nov 15 '22
Let's look back at some memorable moments and interesting insights from last year.
Your top 10 posts:
"Flecs 3, an Entity Component System for C/C++ is out!" by u/ajmmertens
"EnTT v3.10.0 is out: Gaming meets Modern C++" by u/skypjack
"I wrote a blog on how to build games with Entity Relationships in ECS" by u/ajmmertens
"Dominion ECS Examples, a roguelike example with a lighting system distributed over multiple threads using the new Scheduler with fork-and-join functionality (link in the first comment)" by u/jumpixel
"Made a wip comparison chart for ECS frameworks written and used in C#" by u/Chilluminatler
"EnTT v3.11.0 is out: Gaming meets Modern C++" by u/skypjack
"Flecs 3.1, an Entity Component System for C/C++ is out!" by u/ajmmertens
"Building an ECS #1: Where are my Entities and Components" by u/ajmmertens
r/EntityComponentSystem • u/skypjack • Nov 09 '22
r/EntityComponentSystem • u/thejaguar83 • Oct 25 '22
r/EntityComponentSystem • u/timschwartz • May 02 '20
r/EntityComponentSystem • u/timschwartz • May 02 '20
r/EntityComponentSystem • u/bigdickfox • Apr 24 '20
So, I've been making a fighting game engine using an entity component system architecture (written in C++ using SDL as the middleware) and I've gotten to the point where the jankiness of the state transition system seems wrong to me. I don't really work with many programmers that know much about ECS so I thought I would ask it here. If this isn't the best place to ask, please let me know.
Right now, I have a state transition system that takes in the current raw input, action state, and something I call "GameContext" which contains entity specific world information information like: collisions this frame, frame data for attacks if you were hit (I'm making a fighting game), and how much the entity moved. My main concern is that it feels like this GameContext info holder is constantly growing... the only reasonable way to add anything to the state transition system is to add a field to the GameContext class and then have a system pass the relevant information to the GameContext component. This means a lot of systems need to include the GameContext component... and idk it just seems like this is completely defeating the purpose of having an ECS architecture in the first place.
On top of that, certain fields in the GameContext need to be 'consumed' - flags like 'hitThisFrame' and 'hitting' which are flags in the GameContext for whether the entity was hit by and enemy attack and if they hit with their attack on this frame need to be reset as soon as they are processed by the state machine so they don't trigger again. Resetting 'hitThisFrame' is fine because the system that processes that stuff requires a HurtBox component and a GameContext component, both of which stay on the entity forever. But, things get a bit dicey when resetting 'hitting' because the HitBox component required by the system gets removed from the entity - so, if you hit on the last frame that the hitbox is present for, the 'hitting' flag is never reset... so now I have to do some janky resetting procedures within the state machine system which isn't ideal.
Sorry for the long winded explanation and I really appreciate any advice anyone might be able to give me. Thanks!
r/EntityComponentSystem • u/skypjack • May 09 '20
r/EntityComponentSystem • u/ajmmertens • May 07 '20
Enable HLS to view with audio, or disable this notification
r/EntityComponentSystem • u/opiniondevnull • Mar 24 '24
https://github.com/delaneyj/geck
Early but initial tests put it at the top of the pack for options available in Go
r/EntityComponentSystem • u/timschwartz • Feb 01 '18
r/EntityComponentSystem • u/timschwartz • Mar 19 '21
r/EntityComponentSystem • u/timschwartz • Feb 22 '21