Questions tagged [entity-system]

A programming paradigm in which gameobjects (entities) are composed out of components, and are operated upon by systems. Each entity is an ID that points to specific components.

Gameobject: anything acting in the game (car, gun, Steve).
Entity: a globally unique identifier (string, number) pointing to a set of components that comprise a gameobject.
Component: a blob of data or simply a tag (Position, Velocity, Renderable).
System: implements functionality. Systems operate on components (Renderer, MovementSystem).

See this answer for a through explanation of an Entity System.

401 questions
185
votes
1 answer

What is the role of "systems" in a component-based entity architecture?

I've been reading a lot about entity components and systems and have thought that the idea of an entity just being an ID is quite interesting. However I don't know how this completely works with the components aspect or the systems aspect. A…
bio595
  • 1,961
  • 3
  • 12
  • 5
120
votes
10 answers

How does entity communication work?

I have two user cases: How would entity_A send a take-damage message to entity_B ? How would entity_A query entity_B 's HP? Here's what I've encountered so far: Message queue entity_A creates a take-damage message and posts it to entity_B 's message…
deft_code
  • 7,652
  • 5
  • 40
  • 55
59
votes
1 answer

Using component based entity system practically

Yesterday, I've read a presentation from GDC Canada about Attribute / Behaviour entity system and I think it's pretty great. However, I'm not sure how to use it practially, not just in theory. First of all, I'll quickly explain you how this system…
TomsonTom
  • 703
  • 1
  • 6
  • 8
57
votes
3 answers

In an Entity-Component-System Engine, How do I deal with groups of dependent entities?

After going over a few game design patterns, I have settle with Entity-Component-System (ES System) for my game engine. I've reading articles (mainly T=Machine ) and review some source code and I think I got enough to get started. There is just one…
46
votes
1 answer

How are entity systems cache-efficient?

Lately, I've been doing a lot of reading on entity systems to implement in my C++/OpenGL game engine. The two key benefits that I constantly hear lauded about entity systems are the easy construction of new kinds of entities, due to not having to…
Haydn V. Harach
  • 643
  • 1
  • 6
  • 6
37
votes
4 answers

Entity/Component Systems in C++, How do I discover types and construct components?

I'm working on an entity component system in C++ that I hope to follow the style of Artemis (http://piemaster.net/2011/07/entity-component-artemis/) in that components are mostly data bags and it's the Systems that contain the logic. I'm hoping to…
michael.bartnett
  • 7,601
  • 1
  • 37
  • 45
34
votes
5 answers

How do I implement features in an entity system?

After asking two questions about entity systems ( 1 , 2 ), and reading some articles on them, I think that I understand them much better than before. I still have some uncertainties, mainly about building a particle emitter, an input system, and a…
jcora
  • 7,917
  • 5
  • 54
  • 89
32
votes
3 answers

How to properly implement message handling in a component based entity system?

I am implementing an entity system variant that has: An Entity class that is little more than an ID that binds components together A bunch of component classes that have no "component logic", only data A bunch of system classes (a.k.a "subsystems",…
Onlainas
  • 441
  • 1
  • 5
  • 6
30
votes
5 answers

Doing powerups in a component-based system

I'm just starting really getting my head around component based design. I don't know what the "right" way to do this is. Here's the scenario. The player can equip a shield. The the shield is drawn as bubble around the player, it has a separate…
deft_code
  • 7,652
  • 5
  • 40
  • 55
27
votes
4 answers

What is an appropriate level of granularity for component-based architecture?

I'm working on a game with a component-based architecture. An Entity owns a set of Component instances, each of which has a set of Slot instances with which to store, send, and receive values. Factory functions such as Player produce entities with…
Jon Purdy
  • 800
  • 5
  • 13
23
votes
6 answers

What designs are there for a component based entity system that are user friendly but still flexible?

I've been interested in the component based entity system for a while, and read countless articles on it (The Insomiac games , the pretty standard Evolve Your Hierarchy , the T-Machine , Chronoclast ... just to name a few). They all seem to have a…
PrettyPrincessKitty FS
  • 10,355
  • 8
  • 47
  • 68
21
votes
5 answers

Improving an O(N^2) function (all entities iterating over all other entities)

A little bit of background, I'm coding an evolution game with a friend in C++, using ENTT for the entity system. Creatures walk around in a 2D map, eat greens or other creatures, reproduce and their traits mutate. Additionally, performance is fine…
Alex
  • 383
  • 2
  • 8
20
votes
2 answers

Component-Based System online resources

I've been considering moving to a more component-based approach in my games. Does anyone else have any decent reference material or sample implementations that would help make this transition a little easier?
DrDeth
  • 683
  • 6
  • 13
18
votes
2 answers

How can I properly access the components in my C++ Entity-Component-Systems?

(What I'm describing is based on this design: What is an entity system framework? , scroll down and you'll find it) I'm having some problems creating an entity-component system in C++. I have my Component class: class Component { /* ... */ }; Which…
Federico
  • 283
  • 1
  • 3
  • 5
18
votes
4 answers

How can I assign entity IDs in a robust way in a network game?

I'm working on an entity system for a networked game and I'm assigning each entity a unique 32-bit integer id that I can use to serialize references to entities and the entities themselves. Currently I'm just incrementing a counter every time an…
Lucas
  • 857
  • 7
  • 15
1
2 3
…
26 27