11
votes
Accepted
Updating a multithreaded Entity-Component-System
The simple version: don't.
One could argue that you have perhaps a slight misunderstandings about how to build an ECS (why would you sent a list of Entity* to a system to update? the System is ...
9
votes
Accepted
How do you filter entities in an Entitiy Component System?
In a "pure" ECS, your entities consist of just a unique ID, which shared among its components. For example you may have these entities:
Entity ID 123, it is drawn and moved
Entity ID 234, which is ...
8
votes
Accepted
How does Unity's Entity-Component System Work In Practice?
I will risk and post almost-opinion based answer. What Unity is missing is decopled "system" element. It would be much nicer to have "Component-Entity-System" instead of current "Component-Entity". ...
8
votes
Accepted
Event handling in Pure Entity Component Systems, is this approach correct?
Merging systems, such as collision and collision response, is a bad idea. The reason being that there can be many different responses to collisions: Physics based, and game-logic based.
In most game ...
8
votes
Entity Component System: system and components relation
One of the big reasons some ECS proponents favour a strict separation of components and systems is that it helps architect game functionality in a data-oriented style.
In the ideal data-oriented flow,...
8
votes
Accepted
Dealing with more complex entities in an ECS architecture
Games typically approach this type of issue using a transformation hierarchy.
In this model, each entity can be treated as a "child" of a "parent" entity. The entity's local ...
5
votes
How does Unity's Entity-Component System Work In Practice?
This doesn't directly answer the question but, from the sounds of it your question and the information you're wanting seem to differ a little (at least to me). So this "outlook" might help connect ...
5
votes
Accepted
Should entities auto-register to systems based on their component signature?
TL;DR Entities SHOULD NOT auto-register to systems based on component signatures; prefer instead to explicitly declare component sets/nodes to register your entities to systems that operate on ...
5
votes
Accepted
Appropriate Cache Friendly Associative Container For An Entity Component System
Do the simplest thing that works, especially early on.
If you've ever seen videos of triple-A titles in alpha, you'll know how slow / buggy they are. This is normal; in fact, it's desirable. And it's ...
5
votes
Accepted
How to implement n-body in an Entity Component System
One nice thing about systems in an ECS architecture is that they don't all necessarily need to follow the same structure of ...
4
votes
How do you filter entities in an Entitiy Component System?
I suppose that you're really asking now, post-edit, how you can use the entity ID's as indices into your component vectors without there being gaps in the component vectors. The simple answer is that ...
4
votes
Accepted
ECS component dependencies / sharing and cache locality
Reducing cache misses doesn't need to mean getting rid of them entirely, so we do need to be wary of "making the perfect the enemy of the good enough"
After all, the absolute worst performance your ...
3
votes
How should a Unity object control it's state?
For states, I usually use Enums, and then do a switch statement within the Update method. Enabling/disabling components is probably easier than adding/removing them.
If you need to listen for or be ...
3
votes
Accepted
ECS - Components inside components?
First of all, there is no "right" or "wrong" way to structure a game's software architecture. Just ways which work or don't work for you.
Usually you wouldn't nest components. What you would do ...
3
votes
Should entities auto-register to systems based on their component signature?
I think you may be overthinking this.
The point of ECS is to be simple:
An entity is nothing more than an aggregate of components.
A system is only interested in a subset of those components. For ...
2
votes
Responsibility of rendering in a component/entity game engine
This kind of defeats one of the main purposes of having components in the first place. What I think you actually want is something like this:
...
2
votes
Implementig State-driven agents in an Entity-Component-System
The approach I have taken in the past was to separate the behavior and the AI aspects into two systems much as you described. On the behavior side, you have a series of predefined aspects that can be ...
2
votes
How do you filter entities in an Entitiy Component System?
1. component types
I am using component bit mask as well and the mask size is only 64 now, maybe too small, but I don't think it would grow to 1000 in any case, that's too much for the types of ...
2
votes
Communicating with Collision System in ECS
As indicated, your Input System signals an intent to perform some action. How your game signals the action is really a matter of taste but the point remains the ...
2
votes
Accepted
Adding new components and systems in my ECS requires lots of boilerplate code
If your biggest problem is with the Systems, switch from hand-written nodes to tuples. Then you can make some function and class templates to handle most of the ...
2
votes
Accepted
How to propagate component updates? (Changing components at runtime)
Whenever a Entity is added to a Entity Controller (EC), this EC registers to ComponentAdded and ComponentRemoved events from the Entity.
When a Component is added or removed from an Entity, fire the ...
2
votes
Entity System and "composite" entities
You are possibly conflating two separate things. I'll explain them below, but first I'll strongly note that you should spend some time playing around with existing game engines and get a sense for how ...
2
votes
Accepted
Problem in nested parent-entity relationship in ecs
The relationship between the Gun and the Bullet is purely 'spawner/spawned'. It's not parent-child.
In real-life, when you ...
2
votes
Different objects interacting based on type
Okay, disclaimer: this has gone completely overkill. But it was a lot of fun to put together!
The end product looks like this:
...
2
votes
Accepted
Component super class?
Your component base-class seems to be empty now, but it's just a question of time until you will find functionality to add to it. A good candidate might be an ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
entity-component × 115entity-system × 79
component-based × 33
architecture × 24
c++ × 21
entity × 12
libgdx × 11
entity-component-system × 9
java × 8
unity × 6
design-patterns × 5
c# × 4
lua × 4
game-design × 3
javascript × 3
scripting × 3
events × 3
game-component × 3
artemis × 3
performance × 2
software-engineering × 2
input × 2
data-oriented × 2
opengl × 1
rendering × 1