Hot answers tagged

7

The combination of components is what makes the entity. Giving entities certain components just so they can be categorized does not seem very useful. For example, consider two entities: A bear and a horse. They're both going to have pretty much identical components, just the data the components contain is going to differentiate them. A simple example would ...


7

The entity component system (ECS) is great. There are plenty of misunderstandings about it though. For example, it's perfectly fine to use event/messages in an ECS. People often think you're supposed to completely avoid inheritance too. Also not true. The ECS methodology is just a strategy for avoiding issues that come with a large hierarchy of inheritance. ...


3

You may be falling into a common trap. Entity component systems are very neat and useful, but they shouldn't be used for everything. Simply add an Information component to your entities that contains, among other information, their empire affiliation. This component can be utilized by lots of other systems, including the whatever Combat system you have. ...


2

There is no need to separate network reading from writing. It's pretty common to have some asynchronous process that reads from sockets in a non-blocking manor and checks whether there is data to send and transmits it when there is. In fact, my network code in C++ uses a boost::asio::io_service in conjunction with a thread pool of approximately 4-5 ...


2

Ideally, MovementSystem should process movement only, and there should be a separate system for collision detection/reaction. The only benefit I see from processing collisions in the movement system is that you could use the same loop that processes movement to process collisions, so it would be more efficient. But unless your game had performance issues due ...


2

Here's an example system that deletes all entities with the "Expires" component: public class DeleteEntitiesSystem extends EntitySystem { public DeleteEntitiesSystem() { super(Aspect.getAspectForAll(Expires.class)); } @Override protected void processEntities(Array<Entity> entities) { for (Entity e : entities) { ...


2

Each system in Artemis has a function called process, the process function in the RenderSystem looks like this: @Override protected void process(Entity e) { Spatial spatial = spatials.get(e.getId()); Transform transform = transformMapper.get(e); if (transform.getX() >= 0 && transform.getY() >= 0 && transform.getX() < ...


1

What's the harm in allowing the input state for both actions & state to be managed by the input system directly and you merely expose methods for querying this state from other systems? Your JumpSystem registers the Jump action with the InputSystem. Perhaps the registration is also accompanyed by the default key for SPACE. As a step in your game's ...


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