Hot answers tagged

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

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() < ...


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 ...


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