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 [component-based]

Component-based designs rely on separating the multiple logical attributes of business objects and game objects into small components dedicated only to specific tasks. Whereas game objects are usually modeled to reproduce the attributes and behavior of "real world" objects by aggregating them together and allowing specialized objects to inherit from general ones, component based design relies on composition rather than inheritance.

0
votes
0answers
44 views

Array-Backed Entity Component System with Component Polymorphism

I'm tinkering with an array-backed ECS in C++ along the lines of EnTT. Components are stored in a struct-of-array fashion where each component type lives in its own homogeneous contiguous memory block....
1
vote
1answer
125 views

Should components in Entity Component System pattern have logic?

Is often read that in entity component system pattern we should treat components just as a passive data structure with no logic at all, this way we follow to a data oriented design approach with ...
0
votes
1answer
90 views

Why even use coroutines in Unity?

I have been thinking about the use of Unity's coroutines recently, and while I've used them in the past, and am already aware of their bad reputation (although I've also seen posts on the unity forums ...
0
votes
2answers
58 views

How do you make sure that a component can be applied to very different entities?

I know there's lots of posts about this sort of thing, and I've read a lot of them, but there's some gaps that I can't seem to fill in my head. Specifically, I've been reading about the SOLID ...
0
votes
1answer
343 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 ...
1
vote
2answers
231 views

Best Practice for Validating Components in Unity/C#?

In my game there's a Unit class, which all soldiers use. Not all soldiers have special abilities which require unique class components (like Stealth class). Special abilities either exist on a unit ...
0
votes
0answers
38 views

Handling relative positioned components in an entity system

I am currently using artemis to do my first steps in game developement. Currently I have the following components: PositionComponent stores the location of a ...
3
votes
1answer
73 views

How to react properly to component field changes?

Let's say, that we have the following components: Direction, which contains direction the object moves: ...
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....
2
votes
2answers
347 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 ...
1
vote
1answer
191 views

Are references between entities in Entitiy Component System allowed?

I've got a player entiy in my game that can pick up weapons when colliding with item entities. The player can hold and use the weapon in their hand (the weapon sprite is rendered relative to the ...
0
votes
2answers
121 views

How to handle component-based objects in a game loop?

I've been writing my own game engine and I was wondering the correct way to handle my game objects. Each game object is different. The only thing they have in common is a set of operations to handle ...
3
votes
2answers
2k views

How do components in a component based entity system

---Most of the stuff I am talking about I read here--- I am currently tring to wrap my head around component based systems to make a simple game engine of sorts. I am having a hard time ...
0
votes
2answers
364 views

Should a system be able to render things? (ECS)

I'm currently building an entity component system and I just have one question... Should a system be allowed to render things to the screen? For example, should I make a SpriteComponent that contains ...
1
vote
3answers
339 views

Binding c++ templated functions to lua

I have started using Lua as a scripting language for my game engine. It works perfectly for things like input, audio etc. However, I'm now trying to bind my entity component system functions which ...
1
vote
2answers
577 views

Where is 'game logic' implemented in component based design?

I have been trying to get my head around using an entity component system for a game. But I am struggling to understand how I should do 'game-logic'. What I have so far: Components are essentially ...
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 ...
0
votes
1answer
38 views

How to determine the values of parameters controlling the game objects? [closed]

I am a C# developer and now trying to change to my dream field: Game Development. I am new to Game Development and currently self learning Unity3D. To me Unity is component based tools and we can ...
3
votes
2answers
277 views

Where to store contiguous arrays of components?

I've been working on an entity component system and have the trouble of where to define/put the arrays of each component type. Each component type is user defined so I do not know what or how many ...
1
vote
0answers
107 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 ...
2
votes
1answer
2k views

What is a faster alternative to a GetComponent from a RaycastHit?

I have a basic AI car script which needs to interact with other cars around it. I would like to access variables from the other cars to help one car identify what the other cars are doing so they can ...
2
votes
1answer
472 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: ...
0
votes
1answer
428 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 ...
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 ...
0
votes
0answers
84 views

Change entity's size based on health [ECS]

I'm making a kind of entity component system framework and I have a doubt: I have two components 'health_damage', 'physic' (which contains position, weight,...) and 'sprite' (position, dimensions...)....
6
votes
1answer
3k views

A more data oriented design approach to Entity Component System game engine

I'm creating my first c++ game engine project (for learning purposes) and in it I've attempted to implement an entity/component system utilizing some data oriented design principles while also not ...
-1
votes
2answers
100 views

How to solve this component based events response issue?

I'm working on a new game architecture and I have issues with the handling of events in our component-based approach. We have a component Match. When a match ends, an event Match_end is sent. There ...
7
votes
2answers
2k 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 ...
2
votes
2answers
921 views

Component oriented programming for rich RPG world

I've asked this question on several forums but didn't get the proper answer yet. So, in my opinion, it is a really theoritical and deep, but I really can't deal with it by myself. What is my goal? ...
0
votes
1answer
694 views

Data-oriented design and Component Sytem cross-referencing

Let's assume we're talking about a game (engine) which is written in C++. This is more like a design question but I can't find any suitable description. Component System The Component System says ...
1
vote
1answer
110 views

Communication between the SubSystems and the GameObject components?

Currently I have an architecture (not 100% accurate): The RenderData contains primitives, which will be processed by the GraphicsEngine. Upon creation I have to send the pointer of the renderData ...
0
votes
2answers
93 views

Unused methods after component inheritance in component based architecture?

I have a GameObject class, which contains Components, like: Renderer Camera Behaviour Rigidbody First I inherited all of them from Component which has an Update() method, and it is called every ...
4
votes
1answer
350 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 ...
1
vote
2answers
307 views

What are the advantages and disadvantages of using pointers to change data in my physics engine?

I am working on an entity-component system, and I am thinking about this communication protocol: The physics component of a game object sends an UpdateMyState ...
0
votes
2answers
4k views

How to disable script component while in game?

I'm trying to make a C# script to disable the First person controller script component for my character. I'm doing this so that while I'm controlling something else such as a vehicle, the only control ...
1
vote
0answers
224 views

How to properly use Unity component approach?

It may sound like an opinion-based question, but I feel like I am not alone with such problem and this may help others too. I spent a lot of time trying to understand how to make things Unity-way, use ...
1
vote
1answer
342 views

Component based Entity System using polymorphism: OpenGL does not render

I want to be able to create Entities from different Component sets. I want to call Entity entity(new StaticObject(modelpath, position)); I have an EntityTypes ...
3
votes
1answer
182 views

how to make weapon charge up behavior using composition

I am trying to design different weapon behaviors. Right now, there are 3 different types of weapon behaviors that i would like to implement. When not pressing anything, weapon fires at a ...
0
votes
1answer
100 views

How to force a custom component on every GameObject?

I want to have a custom component which will have a drop down. I want this to be applied to ever GameObject in the project, which means every GameObject in the hierarchy and every GameObject prefab. ...
1
vote
1answer
91 views

AI: dealing with movement driving the same inputs as the player

My AI design is pretty simple. I have different entities that can be possessed either by the player or the AI. Those entities have an "Input" component that holds the states of the actual inputs, like ...
0
votes
1answer
76 views

Central logic in entity-component-architectures

I've build a architecture based on the entity-component-system-idea. So I got Components - Just store Data Systems - Operates isolated on Components Scripts - Which are just objects from type Script ...
2
votes
1answer
398 views

Deserializing component array using JSON

I have a collection of serialized components in JSON format: ...
0
votes
1answer
402 views

Entity polymorphism and entity attributes

I want to design the entity system of my game in a way such that entities are modular, easily modified without affecting other entities, and finally easy to add new types of entities. So ideally some ...
3
votes
1answer
294 views

How can I facilitate communication between “attack” and “movement” components?

I'm currently programming in Unreal, but this is more of a component oriented design question. I'm trying to follow a component driven aproach, and I have currently achieved creating a movement ...
10
votes
2answers
396 views

How can I support component-to-object communication safely and with cache-friendly component storage?

I'm making a game that uses component-based game objects, and I am having a hard time implementing a way for each component to communicate with its game object. Rather than explain everything at once,...
2
votes
0answers
226 views

When NOT to use ECS architecture? [closed]

I'm familiar with the notion of entity-component-system architecture, and its advantages over traditional class trees. That being said, are there scenarios where one wouldn't want to use entity-...
0
votes
1answer
149 views

Component messaging system - using integers vs message objects

I'm currently working on a component based system for my game, and I've decided to use a messaging system to communicate between components. I've read some on the subject and it seems that most people ...
2
votes
1answer
2k views

Updating a multithreaded Entity-Component-System

I am currently trying to implement an (sort-of) Entity-Component-System. I've got the gist of it, that is, how an ECS is supposed to work. So far i have 4 classes in my design (not yet fully ...
0
votes
1answer
34 views

Issue with Button component

When I add a Button component, it looks like this: Normally, it should look like this: How can I fix this issue?
7
votes
2answers
2k views

ECS: AI components and systems

I'm trying to find the best design pattern for my AI code using an ECS. Right now the entities that act as CPU-controlled have components like: WeaponComponent ChargeComponent MovementComponent ...