Questions tagged [entity-component-system]

Used when referring to the Entity-Component-System (ECS) architecture.

145 questions
3
votes
1 answer

In ECS, how to decrease health?

I spent a good amount of time trying to get my head around ECS but the "S" is still obscure to me - the farthest I went is that I know a System is where the magic happens; it's where behaviors get implemented, mostly. However, most references I read…
3
votes
2 answers

I don't get why ECS is considered more performant than OOP

Let's say I have an ECS with physics and I want to kill the player when a arrow hit him. So I have a callback when there is a collision. Now there is of course different behaviors with different collisions within 2 bodies (heal with heart, damage…
rafoo
  • 143
  • 1
  • 5
3
votes
2 answers

How do I build the dependency graph on ECS?

ECS is excellent at decoupling: you split your game logic into multiple pieces, and every system is responsible for dealing with a specific piece. However, I don't know if each system should be aware of the rules of my whole game or if it should…
Giovanni L
  • 31
  • 6
1
vote
1 answer

Entity iteration order in ECS system

While learning ECS architecture, I found out that some ECS libraries gives me unsorted entity ids when iterating over filtered entities in system. (Seems like deletion algorithm in sparse set is the reason...) Won't it be a problem if you need…
1
vote
1 answer

Entity Component Systems - component cross-lookup vs denormalization

This is my first project using ECS design and I come from a RDMS background for reference. I'm building a ecology simulation that spans multiple planets, with the following ECS structure: Entities & Components Planet (Components: Year) Biome…
Tyler
  • 113
  • 3
1
vote
2 answers

ECS - Lantern implementation / How does the RenderSystem determine which one to choose? Entity-Datastructure

I want to implement ECS in my game. The more I read the more insecure I get. The current available Components for a Entity processed by the RenderSystem are: RenderComponent (mesh, texture, normalmap, etc.) TransformationComponent (position,…
Meeresgott
  • 113
  • 3
1
vote
2 answers

How are one-to-many relationships usually expressed in ECS architecture?

I'm trying to implement a simple ECS to help understand the concepts, and I am having a bit of trouble wrapping my head around how it would be used in cases where there is not a 1-to-1 mapping between entities and components. For instance, an…
sak
  • 201
  • 2
  • 8
0
votes
0 answers

What was the Entity-Component-System (ECS) derived from?

I am asking about some programming history here. "In 1998, Thief: The Dark Project pioneered an ECS. The engine was later used for its sequel, as well and System Shock 2." According to the above statement, ECS appeared in 1998. Was there an even…
0
votes
1 answer

ECS - Components that access other components

This question is about how to design my ECS system. I have the following components: Position Gravity Gravity needs to access Position. Is there a better design that does not introduce this dependancy? Position doesn't have any behaviour, it's…
Lucien
  • 1,176
  • 2
  • 10
  • 36
0
votes
1 answer

Setters and Getters in ECS?

So I'm currently working on a Game Engine for my University and I came to the point of integrating an ECS. Thing is, I'm currently a bit unsure if it's okay to have setters and getters for specific classes. Like implementing a setter for my…
0
votes
1 answer

ECS : Can systems have sub-systems?

I am searching about "sub-systems" in ECS but I don't find any article speaking on that. Considers this simple example: struct Engine { MoveSystem move_system; CollisionSystem collision_system; RenderSystem render_system; void…
rafoo
  • 143
  • 1
  • 5
0
votes
0 answers

In ECS, how are the different types of components typically stored?

Consider an RPG for example, where one might have PoisonComponent, BerserkComponent, and BlindComponent. In a basic setup, let's say poison, berserk, and blind all work the same for everyone afflicted (i.e., every entity w/ a poison component will…
0
votes
0 answers

ECS, How to query an entity with specific value?

I have a background in ECS by using C# Entitas. The library itself has a very nice feature which lets me able to query the entity with a specific value in the component. For example, query an entity with the player component which has an id equal to…
kitta
  • 99
  • 2
0
votes
2 answers

Is there a good way ECS for creating variants of a behaviour like in Java interfaces?

In Java, there are interfaces - I'm not clear on the details (I don't use Java) but from what I've learned, they seem to be "classes for classes": a way to effectively make individual classes "instances" of one overarching class. For example, a…
EnderShadow8
  • 477
  • 4
  • 15
0
votes
2 answers

ECS multiple materials per mesh (sub-mesh)

In my toy engine I currently have a MeshComponent and a MaterialComponent. psuedo: struct MeshComponent { Ptr Mesh; }; struct MaterialComponent { Ptr DiffuseTexture; Ptr NormalsTexture; }; This is fine, for when…
Mark Ingram
  • 550
  • 5
  • 15
1
2