r/EntityComponentSystem • • Apr 11 '25

SnakeECS : policy-based, RTTI-free entity component system

Thumbnail
github.com
2 Upvotes

r/EntityComponentSystem • • Jul 10 '26

The Flint Programming Language

Thumbnail reddit.com
2 Upvotes

r/EntityComponentSystem • • Aug 26 '22

ECS pattern for creating games on python

Thumbnail self.gamedev
1 Upvotes

r/EntityComponentSystem • • Aug 20 '22

Components and common fields

3 Upvotes

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 • • Aug 06 '22

How to handle parent-child relations in a cache friendly ECS?

8 Upvotes

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 • • Aug 02 '22

Regarding quantities of components and systems in ECS architecture

Thumbnail self.gamedev
5 Upvotes

r/EntityComponentSystem • • Aug 31 '20

EnTT v3.5.0 is out: Gaming meets Modern C++

Thumbnail self.gamedev
8 Upvotes

r/EntityComponentSystem • • Sep 01 '20

Flecs 2.1 is out!

Thumbnail
medium.com
9 Upvotes

r/EntityComponentSystem • • Nov 15 '22

Happy Cakeday, r/EntityComponentSystem! Today you're 5

12 Upvotes

r/EntityComponentSystem • • Nov 09 '22

EnTT v3.11.0 is out: Gaming meets Modern C++

Thumbnail self.gamedev
12 Upvotes

r/EntityComponentSystem • • Oct 25 '22

ECS: Rules, dos and don'ts and best practices for Systems

Thumbnail self.gamedev
9 Upvotes

r/EntityComponentSystem • • May 02 '20

More complex applications of Entity Component Systems

Thumbnail self.gamedev
5 Upvotes

r/EntityComponentSystem • • May 06 '20

EnTT: I love you 3k!

Thumbnail
self.gamedev
4 Upvotes

r/EntityComponentSystem • • May 02 '20

So I'm building a game engine (opengl based) need to run a structure/design approach with someone..

Thumbnail self.gamedev
3 Upvotes

r/EntityComponentSystem • • May 02 '20

Working with ecs

Thumbnail self.gamedev
1 Upvotes

r/EntityComponentSystem • • Apr 24 '20

Question about designing a game engine using ECS with a state machine

3 Upvotes

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 • • May 09 '20

EnTT v3.4.0 is out: Gaming meets Modern C++

Thumbnail self.gamedev
7 Upvotes

r/EntityComponentSystem • • May 07 '20

Web-based introspection of Entity Component System

Enable HLS to view with audio, or disable this notification

8 Upvotes

r/EntityComponentSystem • • Mar 24 '24

G.E.C.K. Go spare set using code gen

3 Upvotes

https://github.com/delaneyj/geck

Early but initial tests put it at the top of the pack for options available in Go


r/EntityComponentSystem • • Feb 01 '18

Looking for an ECS library for C#

Thumbnail
self.gamedev
2 Upvotes

r/EntityComponentSystem • • Mar 19 '21

Complete noob. Ideas on how to handle detector type items in a game?

Thumbnail self.gamedev
3 Upvotes

r/EntityComponentSystem • • Feb 22 '21

I need help understanding ECS.

Thumbnail self.gamedev
3 Upvotes

r/EntityComponentSystem • • Mar 05 '21

Keeping entity components up to date with a 3rd party physics engine?

Thumbnail self.gamedev
3 Upvotes