Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [entity-component-system]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
40 views

How do Entity Component Systems work?

In the project I am working on, I recently ran into a problem of software architecture: I created a base entity class that displays a world object. Then I added functionality for the entity to have a ...
0 votes
0 answers
71 views

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 ...
0 votes
0 answers
56 views

Preventing "pass through" situations properly when using ECS based collision detection

package versions I'm using: Entities: com.unity.entities Version 0.51.1-preview.21 Documentation URL: https://docs.unity3d.com/Packages/[email protected]/manual/index.html Physics: com.unity....
0 votes
0 answers
27 views

Workaround to bind templated functions to lua?

I'm trying to add Lua for scripting to my C++ game engine, which is based on ECS, and I have a rough idea of what I want to do (is it good? probably not) but trying to actually execute it has been ...
0 votes
1 answer
108 views

How to go about executing lua scripts in a ECS engine?

I'm trying to add scripting with lua to my C++ game engine, and I'm pretty stumped on how to tackle the executing/processing part. I started by creating a ...
0 votes
0 answers
90 views

How to implement events with ECS?

I'm transitioning over to an ECS architecture for a small C++ graphics engine I'm working on and I'm a bit stumped on how to tackle events. One solution I came across was from this Reddit post ...
0 votes
1 answer
53 views

How to structure this concept in ECS?

High level At a high level, I'm looking to create a galaxy exploration-style game. A number of points of interest will be selectable on the map (I'd like to aim for several hundred, but flexible and ...
2 votes
0 answers
51 views

How does non ECS parts work with ECS parts?

I incorporated ECS to my graphics engine and I have a problem with my Renderer needing the camera which is an entity and the process is a bit bizarre. Originally, I ...
0 votes
2 answers
84 views

What happens with global/singleton objects when using ECS?

As I've been learning about ECS one thing that gets me confused are things like input which in my case has usually been some singleton that gets polled or in one project was event based where code can ...
0 votes
1 answer
76 views

How to do you separate or do you separate a Player/Non Player movement, action, behavior states in one or more component?

Assume we are using Finite State Machine, what is the best way to organize states? Given I have current StateComponent, all states are here. ...
0 votes
0 answers
58 views

Architecture and design patterns for components

I was working on a physics-based plug-in/ extension for Unity water which would essentially be another component in Unity water. The goal of this extension would be to integrate interactive physics ...
0 votes
1 answer
46 views

How to handle different components of the same entity having different indices?

I'm currently working on a little ECS project and a couple doubts came to my head when dealing with systems. Let's say I have a model component, a position component and a scale component. Each ...
1 vote
0 answers
246 views

Why does ROBLOX use an object-oriented system rather than an entity component system? [closed]

I decided I would develop a game engine in c++, so I was thinking about different ways of handling objects. I also have experience with ROBLOX, so I know that it uses an object-oriented design as ...
2 votes
1 answer
466 views

In an Entity-Component-System architecture how should my map be represented?

I'm migrating a 2D game I've been making using only SpriteKit to an ECS architecture using GameplayKit, and I'm still a bit clueless on how to achieve this. I think I got the gist of ECS, but yet, I'...
0 votes
0 answers
89 views

In Unity 2021.3.29(built-in render pipeline, entities 0.51.1-preview.21), what is the proper way of DOTS based collision detection?

Packages Installed: Entities: com.unity.entities Version 0.51.1-preview.21 Documentation URL: https://docs.unity3d.com/Packages/[email protected]/manual/index.html Physics: com.unity.physics ...
1 vote
0 answers
140 views

In Unity 2022+, Unity.Physics 1.0.16, what is the proper way of detecting collisions with a job?

I have properly defined the CollisionEventJob, scheduled it, and attached necessary components to my entities, but for the love of God, ECS is not detecting collisions between those entities. Here is ...
0 votes
1 answer
134 views

What is the general technique of optimizing a game's lag by updating thousands of mesh vertices using DOTS parallelism?

*Edit: I finally figured out after some profiling that the problematic code was not actually the ones part of ECS, but this line over here: ...
0 votes
0 answers
83 views

ECS: How do I instantiate Entities from a file of positions

I am quite new to Unity ECS and am trying to instantiate a few thousand entities based on positions stored in a .csv file. The file format can of course change, if that helps. My problem is to import ...
1 vote
1 answer
399 views

Efficient Queries in an archetype-based Entity Component System

I am currently writing an archetype-based ECS for learning purposes. What I noticed is that my current implementation is incredibly slow with large amounts of archetypes. Each of my queries iterates ...
2 votes
1 answer
2k views

Who 'owns' the components in an ECS?

Currently looking and reading about entity component systems, and just wanted to ask about who 'owns' or where the components are registered. I would have thought that each entity has a collection of ...
1 vote
2 answers
135 views

Reduce entity-component system boilerplate

I'm attempting to create an entity-component system in C++. However, I've run into an annoying issue where a component system function inherently involves a lot of ceremony and boilerplate. This is ...
1 vote
1 answer
1k views

Handling input in ECS for multiple characters

I've been reading into Entity-Component-Systems, and they seem rather handy. However, I don't quite understand how input should be handled and after googling and looking thru GDSE posts, I've become ...
1 vote
0 answers
107 views

ECS index data structure

I'm implementing an Entity-Component-System library based on simple dense array approach (using huge arrays for every component field with the size equal to the number of entities, where array[entity] ...
8 votes
4 answers
6k views

What is a pure ECS?

What is a "pure" ECS? What makes an ECS pure or not? Although the term appears to have come up since as early as 2013 in this community, it appears that often, a user asking a question feels the need ...
1 vote
1 answer
1k views

Scale / NonUniformScale is not applied to entity

I'm just learning the new Unity ecs and trying to change the size (scale) of an entity. Everything works fine, I can change the rotation, the position but not the scale. I'm wondering why. I did ...
0 votes
0 answers
42 views

Source of truth for raising events in an Event-driven architecture?

I am developing a turn-based strategy game and am using Events to implement a "Buff" / "Debuff" system. The code is very OOP-y right now, not very ECS. I am adding an event system ...
1 vote
1 answer
492 views

Branchless archetype ECS?

I lately read an article about branchless programming and how it can effect performance. Since im developing a little archetype based ECS for learning purposes, i wanted to know if theres a way to ...
0 votes
0 answers
905 views

Hierarchical relationships in an Entity Component System

I'm trying to figure out how to integrate entity component systems with scene graphs in a web game / application. The problem is of course that ECS and scene graphs are very different in nature. They ...
4 votes
1 answer
3k 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 ...
2 votes
2 answers
409 views

Is an ECS system without a traditional ECS memory layout a bad idea?

I've got a background in C++ but completely new to game dev, Unreal, and ECS. Recently, I learned about ECS and fell in love with the resulting project structure and theoretical reduction of spaghetti ...
1 vote
0 answers
671 views

How do I instantiate entities from a regular MonoBehaviour in ECS?

I'm loading data from an external source [call it an array of vector3 locations for the sake of this question]. I want to use it to spawn multiple instances of an entity with a renderer and some other ...
1 vote
0 answers
339 views

Unlit camera-facing billboard in ECS/DOTS shader

I'm attempting to create an unlit billboard shader for use in DOTS. I'm using quads to host the material (Some regular, some DOTS for comparison purposes) I've cribbed together something from this ...
2 votes
1 answer
1k views

How do I handle lists/arrays in Unity DOTS/ECS?

I'm new to ECS and am having issues finding the right data structure to use. For context, I have a galaxy with solar systems that produce resources at a given rate (...
7 votes
1 answer
3k views

In Bevy ECS, what is a good way to have entities reference each other?

I am wondering if there is a better way than storing the entity ID. For the sake of example, let's assume I have a world with many entities who implement the component Name. Every x amount of time I ...
1 vote
0 answers
178 views

Am I doing something wrong in my ECS architecture if I must choose between coupling or copying code?

I'm developing a somewhat simple, small roguelike game as my university project. Early into development I heard about Enity-Component-System and decided to go with that as my game's architecture. ...
3 votes
1 answer
3k 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 ...
3 votes
2 answers
1k views

Implementing Runescape-style stat-based conditional buffs within an ECS

Prologue I'm quite new to data oriented programming and my goal is to implement a Runescape-style stats & damage mechanic in a data oriented styme. This is quite a complex topic (Runescape-Mechanics) ...
0 votes
1 answer
704 views

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 ...
0 votes
1 answer
223 views

How to implement movement with move speed in a multiplayer game?

I'm developing a MMO RPG using Rust and bevy both in the client and the server, which means that I'm using ECS on both sides. My game is tile based, so each tile is a point in my map in the server, ...
2 votes
1 answer
1k views

In C#, is there any performance reason to implement ECS?

The formal ECS specification was developed to address gaming in a JavaScript environment. In any C# translation, this implies all of the classes' members must be public. My concern is that too many ...
0 votes
1 answer
181 views

How to modify single-scene ECS setup to support multiple local players in different scenes?

I'm currently developing a game in Monogame / C#. I have the underlying game engine set up in the following way: Entity/Component/System architecture A Scene includes a map, cameras, and a list of ...
0 votes
0 answers
658 views

Events and Entity Component Systems?

What are common ways to implement Events in an entity component system ? Most games typically have following events : Damage Events Collision Events Area of interest Events Entity Died/Respawn events ...
0 votes
2 answers
3k views

How to make animation in unity Dots hybrid?

I'm working on isometric game in 2D but didn't find any good tutorial in how to handle animation...any help?
3 votes
1 answer
4k views

How to detect collisions in Unity ECS?

I am creating a game using the new Data-Oriented Tech Stack (DOTS). I am using Entities with the PhysicsShape and PhysicsBody authoring components of the new Physics package. Some of my PhysicsShape ...
3 votes
2 answers
994 views

How do different compositions/types of entities interact in an ECS-system?

I have a working ECS-system set up, largely inspired by this brilliant article (not at all required reading to be able to answer my question) on https://indiegamedev.net/ showcasing an ECS-system with ...
0 votes
1 answer
255 views

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 ...
1 vote
1 answer
305 views

How do I write unit tests in ECS when behaviors cause creation of deletion of entities?

I am writing a game using a custom ECS architecture. I recently had a chain of nasty bugs where fixing one bug caused regressions elsewhere. Being a software engineer by trade, I suppose that unit ...
3 votes
1 answer
863 views

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 ...
2 votes
2 answers
3k views

Component instance reference in Unreal Engine 4

I'm creating a C++ script and I want to get a reference to a component instance. For example, imagine that I want to get the player camera, which is a ...
0 votes
1 answer
636 views

Animate Player using Finite State Machine in Ashley ECS

Hi everyone this is my first question on this forum hope you can clarify my doubt. I'm gonna start by saying that im not very good at english so my apologies. So I have a big school project and I'm ...