Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [entity-component]

The tag has no usage guidance.

2
votes
1answer
65 views

How could I get rid of these shared_ptr/weak_ptr in this entity-component architecture?

We've built an entity-component architecture that works ok for our needs, but it has something that bugs me a bit from a software engineering point of view. We use ...
0
votes
1answer
224 views

How to design prefabs in Entity Component Systems

In Unity (and I presume other game engines) you can create "prefabs" which are blueprints for game objects. They contain a list of components, and default values for those components. Prefabs can be ...
0
votes
2answers
180 views

Implementations for storing entities in an ECS system

I'm restructuring my model of entities, components and systems, where entities are: ...
4
votes
2answers
257 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-...
1
vote
1answer
65 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 ...
0
votes
2answers
58 views

How to: Duplicating and updating component data in systems

I am new to game development. Coming across the ECS (entity-component system) pattern I generally quite liked the idea. I have implemented the current version of my engine using the OOP style approach....
0
votes
2answers
261 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. ...
1
vote
0answers
64 views

Clarifications On the Entity-Component-System [closed]

After searching through numerous sites on the Entity-Component-System, which is quite a lot to grasp since all my college career we've been taught variants of OOP (also that ECS isn't taught in any ...
3
votes
2answers
214 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 ...
2
votes
2answers
304 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 ...
0
votes
1answer
279 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
2answers
118 views

Entity Component System data duplicate

I've read some articles about Entity Component System and I like this idea of "entities" having lots of "components" to define them, so I tried to implement it. Here is an simple overview of what i've ...
0
votes
1answer
253 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 ...
2
votes
2answers
485 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
1answer
373 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
1answer
100 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 ...
1
vote
2answers
339 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 ...
0
votes
2answers
146 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
1answer
67 views

Guidelines for determining what should be a component?

Background: So I'm developing my first 2d C++ fighting game (for learning purposes) and I have a setup where I have 'components' which are really just data holders with maybe some simple utility ...
1
vote
2answers
103 views

ECS: removal of group of related components

Currently I'm working with LibGDX and using Ashley for ECS. Everything is fine, until i need to remove groups of related components. Say we have a player that may use different weapons. For now, in ...
3
votes
2answers
1k 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 ...
1
vote
1answer
139 views

ECS — Textures and Game Objects

I'm developing a game using an entity-component system, and had a question about storing, using and linking textures to entities. I have a GraphicsSystem that is ...
1
vote
0answers
103 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
2answers
692 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++. ...
2
votes
1answer
447 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: ...
2
votes
2answers
3k 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
2answers
622 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 ...
1
vote
0answers
194 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
0answers
290 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 ...
6
votes
1answer
785 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 ...
0
votes
1answer
409 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 ...
3
votes
2answers
404 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 ...
0
votes
1answer
50 views

Changing the current state of an entity in the middle of an update step or wait for the end?

Let's say that I use a behaviour component that holds a function call to be called every update step assigned to an entity. Inside that function call I'm changing the active state for the entity to ...
1
vote
1answer
121 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
1answer
735 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
1answer
71 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 ...
0
votes
1answer
95 views

Component super class?

I have recently been programming an Entity Component System in Java for a small game that I am working on. From what I have tested, it works rather well however I question the component part. I ...
1
vote
1answer
341 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 it's internal state and events to inform what's happening to ...
7
votes
2answers
1k 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 ...
1
vote
2answers
106 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
2answers
134 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"...
4
votes
1answer
345 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 ...
0
votes
1answer
384 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
1answer
203 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
2answers
439 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 ...
0
votes
2answers
131 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
2answers
396 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
0answers
338 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. ...
1
vote
2answers
170 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
1answer
190 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 ...