Questions tagged [entity-component-system]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
42 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
1 answer
78 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
63 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 ...
  • 269
2 votes
1 answer
196 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 ...
0 votes
1 answer
80 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: ...
  • 123
2 votes
0 answers
101 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 ...
  • 121
0 votes
0 answers
100 views

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

Consider an RPG for example, where one might have PoisonComponent, BerserkComponent, and ...
1 vote
2 answers
803 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 ...
  • 123
1 vote
0 answers
105 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'...
  • 11
0 votes
1 answer
177 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 ...
  • 135
2 votes
1 answer
76 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 ...
1 vote
1 answer
116 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 ...
  • 334
0 votes
0 answers
179 views

Unity DOTS/ECS: Spawning variable number of entities from prefab using control buffer

I have an input system that I want to work as follows: When the space bar is pressed, the number of NPC entities in my scene will increase by an order of 10. For example, when the scene first starts, ...
  • 89
0 votes
1 answer
389 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 ...
  • 89
0 votes
0 answers
368 views

Unity DOTS/ECS: How to initialize entity component values when spawning programmatically

I'm trying to figure out how to instantiate an entity from my GameManager script in Unity ECS, but I've been having trouble. In a previous thread, I tried spawning an entity one, and ended up spawning ...
  • 89
2 votes
2 answers
101 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 ...
  • 483
1 vote
1 answer
146 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 ...
0 votes
1 answer
166 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, ...
  • 145
0 votes
1 answer
120 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, ...
  • 1
0 votes
1 answer
503 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 ...
  • 101
3 votes
2 answers
437 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 ...
  • 145
1 vote
1 answer
76 views

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 &...
  • 113
1 vote
1 answer
281 views

Extensible 2D Rendering with ECS Architecture

I am currently creating a 2D game/game engine using an ECS architecture. Currently I have a renderer_2d system which is a function that takes all ...
0 votes
0 answers
90 views

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 ...
  • 99
2 votes
1 answer
319 views

What should be an entity/component, and what shouldn't?

I've recently been reading the book Game Programming Patterns by Bob Nystrom, and one chapter I've found a bit hard to grip is the chapter about the Component pattern. In the example he uses (which ...
  • 145
3 votes
1 answer
104 views

Storing stateful function-based actions in a JSON

System: My game uses an "ECS + event queue" architecture where every tick, various events change the state of JSON-able data. Plain JS objects. Problem: I want to be able to save the game-...
2 votes
1 answer
1k views

How to do State-Based Animation with ECS

I'm making a simple platformer game and was suggested to use ECS from a friend. It looked pretty interested and at least worth a try, so I did. I got ECS working and started work on the rendering ...
3 votes
1 answer
320 views

Entity Component System - How to detect what entity to update

everyone. I'm kinda new to game dev, I saw the idea of the ESC system and I'm inlove with it. I wanted to integrate something like that in my game, so I started rewriting my code. . I have a ...
0 votes
0 answers
521 views

Entity Component System in Python

Me and a team of junior developers are making a role playing game. We would like to make something similar to https://bunk.town/ I have only made a Tetris clone which doesn't require much knowledge ...
0 votes
0 answers
107 views

In the ECS on my server, how should I organize components along with systems?

A quick note about my server is that it executes game logic in 250ms intervals. I am trying to wrap my head around how to do this. The main issue I have is currently that I have the map of entityIds ...
  • 103
0 votes
2 answers
364 views

Designing persistence in an ECS world subdivided into chunks

I'm designing a kind of simple open world with ECS. The whole world is too large to be loaded at once, so I load and unload chunks according to player's position. Nothing fancy, pretty much standard ...
  • 66
1 vote
1 answer
133 views

Should state and behavior be combined for Buffs? Cannot decide between data-driven and OOP approach

I'm writing a 2D roguelike that uses an Entity Component System and I'm having trouble deciding between the traditional OOP approach versus a data-driven approach to implementing buffs and debuffs. ...
2 votes
1 answer
187 views

Is it better design to store event effects within an Entity itself, or within a system?

I'm developing a 2D roguelike with an Entity Component System (ECS) and I've been struggling with this question a lot the past week. For example, let's say you have various effects that occur when an ...
0 votes
0 answers
376 views

How to handle various collision effects within an Entity Component System?

Let's say we have three enemies, a bear trap, a fire trap, and a minotaur. When you walk over the bear trap, the game spawns an invisible entity that, upon the player colliding with it, slows the ...
1 vote
1 answer
257 views

Instantiated entities don't collide with each other

I've started to learn DOTS some day ago, and decided to create a simple project. When I added some simple physics to the game I faced the problem. I added one object on the scene and another ...
0 votes
1 answer
614 views

ecs network synchronization

I'm working on implementing combat into my isometric RPG game which uses an ECS architecture. When synchronizing the actions of the different clients, is it preferable to serialize and synchronize raw ...
0 votes
2 answers
1k views

What data structure do I use to store Archetypes in ECS?

I am implementing an ECS with "archetypes" similar to how they are defined in Unity: A unique combination of component types is called an Archetype. For example, a 3D object might have a ...
1 vote
1 answer
275 views

Unity ECS: How do I stop an entity from spawning twice?

I am implementing a flight dynamics model using Unity's built-in ECS package, Entities, and I keep running into one particular issue where the aircraft I'm trying to spawn gets converted into an ...
  • 89
1 vote
1 answer
339 views

Unity ECS: Is it bad to use variable data within SystemBase?

I'm currently trying to port a flight dynamics model that I've implemented in Rust to Unity. The original FDM utilized the Hecs ECS, and I plan on implementing this same model in Unity using the ECS ...
  • 89
0 votes
2 answers
461 views

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

Is it a good idea to use a hash table in an ECS?

I've had an idea for optimising my ECS engine. Instead of storing components in an array, store components in a hash table as <id> => <component>. ...
4 votes
3 answers
2k views

Is an ECS viable in garbage collected languages?

I've done some research on Entity Component System architectures. Right now I have a convoluted OOP implementation which I'm planning on rewriting, so I was considering switching to a different ...
2 votes
1 answer
619 views

ECS - Stats, damage-types & damage calculation

Prologue Im quite new to data oriented programming and my goal is to implement a runescape stats & damage mechanic. This is quite a pretty complex topic : [Runescape-Mechanics][1] and i havent found ...
  • 21
0 votes
1 answer
305 views

Combining a pure ECS with a FSM scheduling system

Currently I am evaluating how to refactor my core game logic since I tried to design most of it in pure ECS but isn't really completely feasible the way I intended it. My game at its core is a turn-...
0 votes
2 answers
240 views

ECS multiple materials per mesh (sub-mesh)

In my toy engine I currently have a MeshComponent and a MaterialComponent. psuedo: ...
0 votes
1 answer
1k 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
157 views

How to decide whether a Buff should be a component or a Buff object in an ECS?

I'm developing a top-down 2D game in Javascript using an Entity-Component-System architecture and I'm struggling with the question of exactly how to implement temporary buffs / permanent passives. For ...
3 votes
1 answer
2k 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 ...
  • 113k
1 vote
0 answers
175 views

How to design a character damage system with ECS architecture?

I am developing an game with ECS architecture and trying to design a character damage system. Does the following design fits into ECS conception and will it be extendable in future? I have an ...
  • 27
2 votes
1 answer
1k views

Question on parallelizing ECS Systems

Learning & Implementing an ECS system for my game, I'm wondering how I am supposed to parallelize the systems on multiple threads. Different systems can't run at the same time (unless they operate ...
  • 121