Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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....
0 votes
1 answer
354 views

How would you implement and differentiate between input actions and input states?

Im currently trying to setup my game and Ive started to implement input. It works like this: I have an Input class who notifies the ...
0 votes
1 answer
3k views

How do I contiguously store and iterate over ECS components in C++?

I'm writing an entity component system and want to store each type of component separately and contiguously in memory in a way that's easy to iterate over. Component...
0 votes
1 answer
1k views

How do you handle entity life-time and entities without all components in an ECS?

I'm just starting to implement my own ECS and am drawing everything down on paper to make sure I understand it all before tackling the implementation in code. However I'm getting stuck on entity-...
0 votes
1 answer
135 views

Hidden copies of the environment in an entity component system

For reasons outside the scope of this question, my game has several full copies of the game environment running asynchronously. At any one time, only one of these is rendered. This is trivial to ...
1 vote
1 answer
202 views

Where should I put units and items in a squad-combat ECS-based game?

So I'm working on a game where squads of varied units would explore, fight, trade and build on an overworld map. Combat would be automated more or less, and happen on the overworld. Basically, ...
2 votes
0 answers
135 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 ...
3 votes
2 answers
947 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 ...
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-...
0 votes
2 answers
1k views

Event-Based Entity-Componenty-System

So, I'm new to ECS. The concept is very interesting in contrast to traditional OOP and heavy inheritance. I'm working on a game right now that is open-sourced, but does not actually have a game loop. ...
0 votes
2 answers
2k views

Implementations for storing entities in an ECS system

I'm restructuring my model of entities, components and systems, where entities are: ...
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 ...
1 vote
2 answers
2k views

Implementation details of Command Pattern in conjunction with Entity Component System

I have implemented an ECS where more or less an Entity is just an ID, a Component is just a wrapper for data, and a System holds the logic on operating over different components. There is an Engine ...
1 vote
2 answers
2k views

Should entities auto-register to systems based on their component signature?

I see all the upside in entities registering automatically for basic components. If an entity has a Renderable component, it should be registered to a list that's used by a Renderable System. If an ...
0 votes
2 answers
1k views

How to handle Entity Initialisation and Destruction

I've been using the ECS pattern for a while now and, as the complexity of the game increased, I started having issues with the timing of the entity initialisation and destruction code. I'll use the ...
0 votes
1 answer
1k views

How does an ECS work for a world subdivided into chunks (example)?

I am trying to use an ECS for my 2d game at the moment. Up until now I had my world subdivided into chunks (as minecraft does) of size 64x64. They are loaded and drawn when they come onto screen. I ...
0 votes
1 answer
760 views

Circular Dependencies in an Entity Component System

I'm developing a top-down shooter in C++ using an entity-component system, and have run into a problem when attempting to refactor powerups. Currently I have a ...
3 votes
1 answer
700 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 ...
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. ...
1 vote
2 answers
2k views

How to access entites from scripts in an entity-framework?

I'm developing on a simple libGDX-based Game and im using the entity-component-system ashley. For non-generic but custom behaviour (e.g. the Player Movement), I'm using "scripts" instead of reuseable ...
1 vote
1 answer
2k views

What's the proper practice to organize relationship between components in an ECS pattern?

I'm new to ECS concept and trying to refactor my app with an ECS manner. After reading some articles, I still don't get a sense about how to organize hierarchy for such pattern. My questions are Is ...
0 votes
1 answer
412 views

How to efficiently filter by a component with a specific value in an entity component system (all entities in grid position [x,y,z], for example)?

I'm working on a 3d grid based game, and I am trying to implement it using an ECS. I have a position component which indicates the entity's position on the grid. It is comprised of 3 integers (for ...
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 ...
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 ...
2 votes
1 answer
771 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: ...
1 vote
1 answer
838 views

Creating Multiple Render System to Draw Different Entities in Entity-Component-System

When creating ECS based game engine, do you (or can I) create multiple rendering systems? Let's say I have an Entity class which is the basic unit in my engine, all it can do is add, remove and get ...
1 vote
0 answers
178 views

Communication in an entity-component through public variables or public member functions [closed]

I am currently coding my own ECS to get a deeper understanding of how such an engine works. I am currently putting together systems. I am aware that there is no right answer to my question as there ...
1 vote
2 answers
2k views

Entity component system design. Should ID of entities be continuous?

I am implementing an entity-component system. Below is my current implementation in c++. ...
18 votes
2 answers
16k 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 ...
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, ...
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 ...
7 votes
2 answers
15k 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: ...
0 votes
0 answers
688 views

Nested Entities in Entity Component Systems (ECS) [duplicate]

Say I have an entity that has these components: -Transformation -Visual Imagine that these components can nest: If I have a parent transformation component, a child transformation relies on the ...
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 ...
1 vote
1 answer
1k views

How to render in an entity component system?

I am currently working on a game in Java that uses an entity component system. The game currently has two separate update() and ...
0 votes
1 answer
213 views

Entity Components Ids and Max Integer Values

I have been studying several entity component systems (Anax and EntityX) to get an idea of how they work. For Entity ids, both use 2 numbers. The first number is basically a position in an array, and ...
1 vote
2 answers
123 views

How should one component "trigger" another one in a component system?

In my game I have a MoveComponent and a ClimbComponent. Some characters can only move around on one level, others are able to ...
0 votes
2 answers
797 views

How do I need to tag different (but a little similar) entities with Entity-Component-System pattern

I have some count of weapons - pistol, shotgun, rifle. And I have one system which deals with all weapons, and another system which deals only with pistol. So I need to create both components "weapons"...
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: ...
0 votes
1 answer
1k views

Use Ashley with Scene2d in libGDX?

I want to use Ashley but I also want to use actions and listeners with Scene2d. I read that it is not a good idea, but why? Ican create a system with stage.act(); and stage.draw(); in the update ...
0 votes
2 answers
151 views

What component should hold the bool attack and vector target?

I am having trouble thinking of what component should hold the attack and target data. In the below code components are holding a redundant data which I want to eliminate. ...
1 vote
0 answers
867 views

How do you handle entity parent-child relationship in Ashley ECS?

In the below code example, is a parent-child relationship of an entities. Now every child should follow its parent position, and the child could be re-positioned anywhere. ...
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 ...
1 vote
1 answer
519 views

Problem in nested parent-entity relationship in ecs

In the given flow, the character is the parent entity, gun is child of character and bullet ...
0 votes
1 answer
731 views

Entity polymorphism and entity attributes

I want to design the entity system of my game in a way such that entities are modular, easily modified without affecting other entities, and finally easy to add new types of entities. So ideally some ...
1 vote
0 answers
375 views

How do I pool a bullet in libgdx ashley ECS approach?

I'm having problem creating bullet pool in ashley ECS approach, because i'm using PooledEngine, everything is pooled. So I've done is I just use ...
1 vote
0 answers
536 views

What is the proper way of creating bullet in libgdx ashley ecs framework?

I'm still thinking, how do I properly pool a bullet in libgdx ashley? Because the PooledEngine is available, which the Entities, ...
2 votes
0 answers
328 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-...
2 votes
1 answer
193 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 ...
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 ...