Hot answers tagged

13 votes

Cache misses and usability in Entity Systems

First, I wouldn't say that in this case you are optimising too early, depending on your use case. In any case though, you've asked an interesting question and as I have experience with this myself, I'...
  • 701
11 votes
Accepted

Updating a multithreaded Entity-Component-System

The simple version: don't. One could argue that you have perhaps a slight misunderstandings about how to build an ECS (why would you sent a list of Entity* to a system to update? the System is ...
5 votes
Accepted

Should entities auto-register to systems based on their component signature?

TL;DR Entities SHOULD NOT auto-register to systems based on component signatures; prefer instead to explicitly declare component sets/nodes to register your entities to systems that operate on ...
5 votes

Cache misses and usability in Entity Systems

To answer just this: My question is, since I am not iterating linearly one contiguous array at a time in these cases, am I immediately sacrificing the performance gains from allocating ...
  • 821
4 votes

Intersystem communication in a ECS game

Basically speaking, your systems should not need to talk to each other. There may be cases where systems implicitly interact, but this interaction should not be explicit. If you need to have systems ...
  • 2,826
3 votes

Should entities auto-register to systems based on their component signature?

I think you may be overthinking this. The point of ECS is to be simple: An entity is nothing more than an aggregate of components. A system is only interested in a subset of those components. For ...
  • 2,575
3 votes

entity component - get object from entity system without knowing it's ID

I think the Observer Pattern may fit here. Instead of sending a message to your button, let your button observe some component.
3 votes
Accepted

Where should I put the SDL_Renderer* using the ECS with SDL2 and C++?

If you only have a single SDL_Renderer, it should be managed outside of the ECS code and just passed to the rendering system when you call it to render the visual data for each entity. In this way it'...
  • 161
2 votes

Cache misses and usability in Entity Systems

Short Answer: Profile then optimize. Long Answer: But, when I am to iterate component arrays to do something with them from a system on an actual gameplay implementation, I notice that I ...
  • 12.5k
2 votes

How to send components in an ECS System?

Serialization can be implemented in any number of ways, but I would strongly suggest that you find ways to decouple entity/component semantics from network serialization as it will make it easier as ...
  • 1,997
2 votes
Accepted

How to progress an entity-component gamestate in a turn-based game?

Posting the solution I finally settled on, similar to Yakovlev's. Basically, I ended up using an event system since I found it very intuitive to follow its logic over turns. The system ended up ...
  • 121
2 votes

Entity System and "composite" entities

You are possibly conflating two separate things. I'll explain them below, but first I'll strongly note that you should spend some time playing around with existing game engines and get a sense for how ...
2 votes
Accepted

How to propagate component updates? (Changing components at runtime)

Whenever a Entity is added to a Entity Controller (EC), this EC registers to ComponentAdded and ComponentRemoved events from the Entity. When a Component is added or removed from an Entity, fire the ...
  • 457
2 votes
Accepted

How can I make an entity invulnerable to fall damage?

Your onEntityFall method is not registered to the event bus. Notice where your yourPlayerHarvestEvent method is and how its ...
1 vote

Java - Entity Collision only working for last index of the Entity Array

[SOLVED]: Added a CollisionID attached to the "i" variable iteration of each index of the Entities array when collision has been detected. This effectively pinpoints the actual location of the ...
  • 41
1 vote
Accepted

How would a server handle sending entity updates to clients?

First of all, you're using Java and LibGDX, so you have access to UDP. UDP is better in a lot of aspects than TCP if you make anything but a strategy or puzzle game (as a rule of thumb, UDP is better ...
  • 14.6k
1 vote
Accepted

The most correct/efficient way to update millions of entities that change over time in an mmo?

Both scenarios are useful, there are object that will require to be implemented in the second scenario. Yet, I suggest to use the first one as much as possible. Scenario 1 Using scenario 1 falls ...
  • 19k
1 vote

Creating Multiple Render System to Draw Different Entities in Entity-Component-System

What you should ask yourself is what is the actual difference between the two types? An animated entity typically has both some form of a skeleton of bones which are animated through various ...
  • 1,997
1 vote

How to convert and handle (controlling) OOP game objects via ECS?

Both dispatcher and calling systems directly from systems breaks the architecture. A system should never be called directly to update, if anything, only call methods to set some flag or data to be ...
  • 166
1 vote

How to convert and handle (controlling) OOP game objects via ECS?

I'm not too familiar with Ashley's ECS system. The reason they are using the dispatcher is to share information across multiple objects. This is usually to reduce coupling in classes, which makes ...
1 vote
Accepted

Handling data logic on libgdx ai state machine or in ashley system?

Unless there's a specific reason you'd need (want) to process the data in a State you should probably stick to Ashley's own ...
  • 7,680
1 vote

entity component - get object from entity system without knowing it's ID

The game layer probably shouldn't know about the HUD layer. The HUD layer should maybe listen to events from the game layer. Your example is a bit vague, so let's say there is a button above each ...
  • 111
1 vote
Accepted

Data model design using Core Data and Spritekit

I can see you going about this two ways without changing too much of your core data model. Kind of a lazy way to do it if you know that there will be no more than 3 bonuses per item. bonus_1_type (...
1 vote

Data model design using Core Data and Spritekit

That is a fine way to do it. Alternatives would be A field on the item specifying which attribute the bonus applies to, with a modifier ie [{"fire_rate", 5}, {"health", 10}] Each item could have a ...
  • 3,775
1 vote

How do I efficiently deal with entities moving between chunks?

If you need to store entities in chunks it's probably better to actually store them in the chunks rather than a separate array. ...
  • 3,775
1 vote
Accepted

Undefined reference error when trying to access a component using ECS

Your template definition needs to be in the header file. More specifically: ...
  • 880
1 vote

Undefined reference error when trying to access a component using ECS

Move the definition of Entity::GetComponent to the header, Entity.h. In general, template definitions must be put into header files. See this related question: https://stackoverflow.com/questions/...
  • 880

Only top scored, non community-wiki answers of a minimum length are eligible