Skip to main content

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
36 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 ...
snow_owl's user avatar
0 votes
0 answers
64 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 ...
Jonh Smith Benjamin's user avatar
0 votes
0 answers
55 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....
rasputin's user avatar
0 votes
0 answers
25 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 ...
Konjointed's user avatar
0 votes
1 answer
77 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 ...
Konjointed's user avatar
0 votes
0 answers
77 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 ...
Konjointed's user avatar
0 votes
1 answer
51 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 ...
Basic's user avatar
  • 1,267
2 votes
0 answers
49 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 ...
Konjointed's user avatar
0 votes
2 answers
75 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 ...
Konjointed's user avatar
0 votes
0 answers
56 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 ...
Akshit Chaturvedi's user avatar
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 ...
Torino R6's user avatar
1 vote
0 answers
217 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 ...
AcinonX's user avatar
  • 311
0 votes
0 answers
83 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 ...
rasputin's user avatar
1 vote
0 answers
128 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 ...
rasputin's user avatar
0 votes
0 answers
73 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 ...
kugelblytz's user avatar
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: ...
rasputin's user avatar
1 vote
1 answer
340 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 ...
genaray's user avatar
  • 517
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 ...
Juzzbott's user avatar
  • 123
1 vote
2 answers
127 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 ...
Red Needle's user avatar
1 vote
0 answers
93 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] ...
Andrew Kravchuk's user avatar
0 votes
0 answers
39 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 ...
David Notrael's user avatar
0 votes
0 answers
774 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 ...
Candleout's user avatar
  • 101
1 vote
0 answers
642 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 ...
Basic's user avatar
  • 1,267
1 vote
0 answers
325 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 ...
Basic's user avatar
  • 1,267
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 (...
Basic's user avatar
  • 1,267
1 vote
0 answers
162 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. ...
aallfik11's user avatar
0 votes
1 answer
638 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 ...
Lucien's user avatar
  • 1,176
0 votes
1 answer
213 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, ...
Gustavo Mendonça's user avatar
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 ...
user avatar
6 votes
1 answer
2k 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 ...
Feldspatt's user avatar
0 votes
0 answers
614 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 ...
genaray's user avatar
  • 517
1 vote
1 answer
461 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 ...
genaray's user avatar
  • 517
0 votes
1 answer
179 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 ...
Rich. T.'s user avatar
0 votes
1 answer
244 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 ...
Jonas Schindler's user avatar
1 vote
1 answer
295 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 ...
Tim C's user avatar
  • 410
3 votes
1 answer
804 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 ...
Guilherme Oderdenge's user avatar
0 votes
1 answer
165 views

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: ...
rafoo's user avatar
  • 143
2 votes
2 answers
381 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 ...
mrg95's user avatar
  • 121
0 votes
0 answers
264 views

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

Consider an RPG for example, where one might have PoisonComponent, BerserkComponent, and ...
AmagicalFishy's user avatar
3 votes
2 answers
8k views

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 ...
rafoo's user avatar
  • 143
2 votes
1 answer
442 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'...
jalxp's user avatar
  • 123
0 votes
1 answer
631 views

How to animate game object using entities?

I am having issues with some of the DOTS stack in unity (mostly the rendering and animation) and was hoping I could use gameobjects for those parts. Not sure how to use entities inside a regular ...
Emil's user avatar
  • 135
3 votes
1 answer
248 views

How are map/room/world-related game assets usually organised and implemented?

I'm trying to build a simple 2D Shoot 'Em Up type of game in C++ using SDL2 and an Entity Component System, which I've already implemented. The idea is to have different maps/rooms where you have to ...
Nick Román's user avatar
1 vote
1 answer
265 views

How to include cross cutting concerns like sound/graphics effects in an ECS?

It does not seem like a good idea to include this functionality in the game logic like that even if the concrete implementation of the sound or graphics effect is abstracted away. Ideally, the game ...
codymanix's user avatar
  • 364
0 votes
1 answer
1k views

Unity DOTS/ECS: Spawning entity programmatically at specific location

I'm interested in learning how to spawn entities from prefabs (from a monobehaviour) at random locations in a scene on a key press. Similar to this video, I'd like to instantiate these objects ...
Mav's user avatar
  • 99
2 votes
2 answers
297 views

Ways to synchronize lists over the network?

Im working on a little plain c# gameserver using an ecs. It follows the principles of the client/server model architecture. However im often running into the following problem, the server has one or ...
genaray's user avatar
  • 517
1 vote
1 answer
400 views

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 ...
GarlicDipping's user avatar
0 votes
1 answer
377 views

How do you use configuration files to describe the contents of an entity in an ECS-system?

One of the advantages that's often brought up when talking about ECS-systems is that they allow a higher degree of flexibility in regards to Data vs Code. Without the limitation of hard-coded types, ...
JensB's user avatar
  • 157
0 votes
1 answer
267 views

Is a platform an entity in 2D Platform in ECS pattern?

I've been coding a small 2D platformer applying ECS pattern. However, I'm struggling with a issue. When building each platform from tilemap and such platforms need to be collided by other entities, ...
hell.jumper's user avatar
1 vote
1 answer
2k views

SQL Database structure for ECS

I am making turn-based browser game (mostly server-sided), and every turn all game-state is saved into database (SQLite). Using ECS pattern. Never done this before (I am webdev). There will be a lot ...
Qiao's user avatar
  • 111