Skip to main content

Questions tagged [entity-component]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
18 votes
2 answers
15k views

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 ...
Federico's user avatar
  • 283
18 votes
3 answers
7k views

How can I implement smart scripting, in my game?

I'm developing a game engine. It is supposed to be an entity/components based one. For developing my game, itself, I thought to use some scripting language to actually create the entities. For ...
nathan's user avatar
  • 1,876
17 votes
1 answer
6k views

How to benefit from cpu cache in a entity component system game engine?

I often read in the ECS game engine documentations that is a good architecture for using cpu cache wisely. But I can't figure how we can benefit from cpu cache. If components are saved in an array (...
Johnmph's user avatar
  • 325
14 votes
1 answer
5k views

How to handle materials in an Entity/Component system

My E/C implementation is the basic one where Entities are just ID's, Components are data and Systems act on the Data. Right now I'm having trouble with object materials and rendering in general. For ...
Luke B.'s user avatar
  • 1,127
12 votes
3 answers
4k views

Grouping entities of the same component set into linear memory

We start from the basic systems-components-entities approach. Let's create assemblages (term derived from this article) merely out of information about types of components. It is done dynamically at ...
Patryk Czachurski's user avatar
10 votes
3 answers
3k views

Advices on Linking Between Entity Component System in C++

After reading a few documentation about entity-component system, i decided to implement mine. So far, I have a World class which contains the entities and the system manager(systems), Entity class ...
deniz's user avatar
  • 505
7 votes
2 answers
14k views

Event handling in Pure Entity Component Systems, is this approach correct?

I want to ask if the following is an effective way to architect event propagation using an ECS? Here is a hypothetical collision scenario using an ECS. Components: ...
Danny Yaroslavski's user avatar
7 votes
2 answers
6k views

How does Unity's Entity-Component System Work In Practice? [closed]

On the surface Entity-Component seems like a good way to program games. Everything is a game object and those game objects are made up of components. The attraction is components are very flexible, ...
Ben's user avatar
  • 2,141
7 votes
0 answers
1k views

Techniques for incorporating physics engines like Box2D into a Component-based Entity System [closed]

Currently i'm working with my own physics engine, however given the fact that the emscripten ports have gotten incredibly good, i wanted to try and incorporate Box2D into my entity system for the next ...
dreta's user avatar
  • 3,524
6 votes
3 answers
4k views

How do you filter entities in an Entitiy Component System?

I am currently writing my own ECS in C++ and I am using std::bitset. I register a component at compile time and give it an ID. ...
Maik Klein's user avatar
6 votes
2 answers
1k views

Why are entities in a component system composed at run time?

Why are entity component systems the way they are? For example as far as I have seen it may look like this ...
Maik Klein's user avatar
6 votes
2 answers
4k views

Entity Component System: system and components relation

I'm planning to develop a game in C# (but I don't think that language matters) and I'll be using Entity Component System since I know by design that my game will have a lot of different game items ...
Andrew's user avatar
  • 111
6 votes
2 answers
5k views

Entity-Component-System data storage design

I'm working on an ECS and I've already read a lot of articles about it. Most of these articles are talking about a simple case (store data contiguously, read it in a single for loop). However the real ...
csisy's user avatar
  • 365
5 votes
1 answer
1k views

Is "entity component system" a principle or a pattern?

Since the ECS follows the principle Composition over Inheritance, and it makes the behavior of game objects can be changed in the runtime. If ECS is a principle, from my memory of design patterns of ...
Niing's user avatar
  • 169
5 votes
2 answers
2k views

Handling movement using an Entity Component-based System Architecture

I have seen various descriptions of how to handle movement in a component-based entity framework. The most common I've stumbled across is the idea of using components called Controller, Physics, ...
gamer13's user avatar
  • 51
5 votes
2 answers
1k views

How can I provide attribute extensibility in a component-based entity system?

This question and its answers move against utilizing an entity component system where the component itself is just a generic class with an dynamic container for the attributes/properties of the ...
Philip Allgaier's user avatar
5 votes
1 answer
1k views

Box2D Joints in entity components system

I search a way to have Box2D joints in an entity component system, here is what i found : 1) Having the joints in Box2D/Body component as parameters, we have a joint array with an ID by joint and ...
Johnmph's user avatar
  • 325
5 votes
1 answer
3k views

Communicating with Collision System in ECS

I have read tons of articles and forums threads about ECS but still can't understand how anything in engine should communicate with Collision System. Let's say I have Input System that handle keyboard ...
SET's user avatar
  • 161
5 votes
1 answer
8k views

Scene Graphs and Entity Component Systems

I am trying to determine how to move my current implementation of nodes in a scene graph to an entity component system and am struggling to wrap my head around how the two can work together, if at all....
Zack Brown's user avatar
  • 1,459
4 votes
1 answer
4k views

Dealing with more complex entities in an ECS architecture

Preamble: I'm working on a level editor for my engine, which uses an ECS architecture. I have around a dozen component types so far, mostly dealing with graphics, like lighting components, model, and ...
Yattabyte's user avatar
  • 1,033
4 votes
2 answers
1k views

Appropriate Cache Friendly Associative Container For An Entity Component System

The intro to this problem is a bit of a long one so my apologies in advance. In short I am asking for suggestion as to what type of collection I should use to store data for a particular part of my ...
Ryoku's user avatar
  • 187
4 votes
2 answers
1k views

How to implement n-body in an Entity Component System

Recently I've been throwing problems at Entity Component Systems to see how far I can push the paradigm. One problem in particular I struggle with, which is writing an elegant implementation of the n-...
Sander Mertens's user avatar
4 votes
1 answer
446 views

EventManager adding data to the event message

Some backstory: I decided it was time to start making a game. I've got a bachelor degree in computer sciences, but I didn't really get to code much during my studies. I've started making a quick ...
quien's user avatar
  • 43
4 votes
2 answers
2k views

Implementig State-driven agents in an Entity-Component-System

A state-driven agent is an agent that performs an action based on its current state. The logic can be implemented through the use of a D-FSM that changes state depending on the Agent's "perception" ...
lds's user avatar
  • 49
3 votes
1 answer
6k views

Updating a multithreaded Entity-Component-System

I am currently trying to implement an (sort-of) Entity-Component-System. I've got the gist of it, that is, how an ECS is supposed to work. So far i have 4 classes in my design (not yet fully ...
tubberd's user avatar
  • 265
3 votes
2 answers
2k views

ECS component dependencies / sharing and cache locality

I have been trying to wrap my head around how ECS works when there are components which are shared or dependent. I've read numerous articles on ECS and can't seem to find a definitive answer to this. ...
Driv's user avatar
  • 43
3 votes
1 answer
3k views

Entity Component Systems, Input, and Angry Birds!

I am using Artemis ECS. I have the very basics of a game already. I am now trying to determine how to gracefully handle input and to a lesser extent collisions. Some people say with ECSs, everything ...
Simon's user avatar
  • 53
3 votes
2 answers
2k views

How do we coordinate which order the systems get processed within an ECS?

If I knew all of the systems at compile time, I could order them myself. However, I intend on having user-defined mods. This adds a level of complexity, in that I (as the framework developer) don't ...
Zymus's user avatar
  • 131
3 votes
1 answer
677 views

Different objects interacting based on type

Many many thanks to anyone who chooses to take the time to read through this all and offer any advice. I'm writing a game in which multiple different kinds of Objects move around a grid-based board ...
CaptainTid's user avatar
3 votes
2 answers
2k views

Adding new components and systems in my ECS requires lots of boilerplate code

I'm writing an entity component system for a project I've been working on. It's currently in a working condition, and overall i'm pretty happy with it, but I've noticed that adding new components and ...
djscrew's user avatar
  • 33
3 votes
0 answers
780 views

How to store Lua script's inner state?

Situation: I am working on an Entity-Component system, and I am using LuaBridge as a Lua binder. There is only one Lua State. Currently when I update the game objects, I just check whether it has a ...
Tudvari's user avatar
  • 761
3 votes
2 answers
926 views

How to get Entitas components from gameObject.getEntityLink()

I'm new to Entitas. I have a DamageSystem that should Physics.Raycast() toward the target and if tag is enemy it should reduce ...
lazarevsky's user avatar
2 votes
1 answer
843 views

How should I traverse entities and components for their per-frame updates?

I am implementing a simple entity/component-based engine in C++ and am unsure about the best way to store references to entities/components and what the best way to traverse them each game step would ...
Alex's user avatar
  • 241
2 votes
2 answers
3k views

How to Implement ECS Archetypes in C#?

I'm trying to figure out how to implement a simple ECS with an Archetype approach, similar to what Unity's ECS uses. An archetype is just a category for entities that have a specific set of components....
Floating Sunfish's user avatar
2 votes
2 answers
2k views

Confusion about systems implementation of ECS

For reference I am mostly imitating the architecture in this tutorial, the "Entity System" section: http://www.raywenderlich.com/24878/introduction-to-component-based-architecture-in-games NOTE: the ...
user2687268's user avatar
2 votes
1 answer
815 views

Different kinds of movement in component based entity system

I am writing a pong clone with a component based entity system. But I am having trouble with the different kinds of movement in the game. The problem is the following: My paddles will just move up ...
M0rgenstern's user avatar
2 votes
1 answer
2k views

ECS - Components inside components?

Reading up on ECS, I've tried to implement a simple 'game', if you can call it that. Basic concepts : You have planets(entity), they produce gold. (gold is a component inside planet) Planets can ...
Patrick's user avatar
  • 163
2 votes
1 answer
2k views

How should a Unity object control it's state?

I've been using Unity's component based design, and the biggest problem I've faced is how to control an object's( not component's ) state. The problem is, some components must act differently based ...
Ben's user avatar
  • 2,141
2 votes
1 answer
598 views

Pass data down to components

In the game I have, I'm using an architecture close to what I've seen of Unity components : Basically, the universe implements the game loop, entities implement and ...
user avatar
2 votes
1 answer
763 views

Component based architecture in TypeScript

I'm doing a game using Phaser with TypeScript. I want to implement a component based architecture for Actors. What I'm trying to achieve is this: ...
Guilherme Recchi Cardozo's user avatar
2 votes
2 answers
1k views

C++ structure for component list

I'm developing a game in C++, making use of the Entity-Component system. I'm going to store a list of each component, with each component's position in the list mapping to it's entity. So, the 5th ...
Rich. T.'s user avatar
2 votes
2 answers
1k views

How to convert and handle (controlling) OOP game objects via ECS?

I'm having hard time converting OOP game objects to Ashley ECS framework. I have a character, gun & a bullet class. The character uses the gun as weapon, the gun class has a fire method that ...
ronscript's user avatar
  • 501
2 votes
2 answers
1k views

Entity System and "composite" entities

I'm new to the Entity Component System pattern and there's something I cannot figure out. Let's say I have the following entity: ...
morcmarc's user avatar
2 votes
1 answer
191 views

How to propagate component updates? (Changing components at runtime)

Whenever an entity is being added to an entity controller (which is essentially just a bag of entities), I scan through it's components to figure out if I need to register additional entity processors ...
artganify's user avatar
  • 469
2 votes
4 answers
2k views

Executing Components in an Entity Component System

Ok so I am just starting to grasp the whole ECS paradigm right now and I need clarification on a few things. For the record, I am trying to develop a game using C++ and OpenGL and I'm relatively new ...
John's user avatar
  • 201
2 votes
1 answer
334 views

Use GKEntity's component(ofType:) with inheritance

I'm writing a SpriteKit game in swift and making use of GameplayKit's entity-component system. There are many components that do different stuff but share the same methods in which they do it, so I ...
lsauceda's user avatar
  • 151
2 votes
1 answer
969 views

Entity interaction in a component design with events

My components are 100% isolated. No component knows about anything outside of itself in any way. Components have functions that operate on their internal state, and events to inform what's happening ...
user441521's user avatar
2 votes
3 answers
167 views

Building a C-E engine in a high level language, how can I integrate optional lower-level components that own overlapping state?

To clarify, by overlapping I do not mean overlapping between said components, but rather, let's say I have: My entity contains components, and a parent-children system. Call it a mandatory ...
Llamageddon's user avatar
2 votes
0 answers
123 views

Properway to pass information from one system to another in an entity component system design

After having read some example programs (namely Pong, Snake and Pacman) I am now experiencing with ECS. I am wondering where to put the elements for a reward flow. Do you know good practices for ...
julien's user avatar
  • 121
2 votes
0 answers
325 views

When NOT to use ECS architecture? [closed]

I'm familiar with the notion of entity-component-system architecture, and its advantages over traditional class trees. That being said, are there scenarios where one wouldn't want to use entity-...
JesseTG's user avatar
  • 1,077