iluwatar / iluwatar/java-design-patterns

Entity component system (ECS) pattern

Open
#485 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

epic: pattern info: help wanted type: feature
Dominant language
Java
Stars
94.7k
Forks
27.4k
Avg merge
3d 4h
Merged PRs (30d)
10

Description

Description:
The Entity Component System (ECS) design pattern is a robust architectural pattern used in game development and other performance-critical applications. This pattern provides a flexible and efficient way to manage entities and their behaviors by breaking them down into distinct components. The main elements of the ECS pattern include:

  1. Entity: A general-purpose object that serves as a container for components. Entities are usually identified by a unique ID and do not contain any logic.
  2. Component: A modular, reusable piece of data that describes a specific aspect of an entity, such as position, velocity, or health. Components are passive data holders.
  3. System: Logic that operates on entities with specific components. Systems query entities that possess the necessary components and execute game logic, updating component data as needed.

Implementing the ECS pattern involves defining entities, components, and systems, and establishing a way to manage and process these elements efficiently.

References:

Acceptance Criteria:

  1. Create an Entity class that uniquely identifies each entity.
  2. Develop a variety of Component classes that can be associated with entities, such as PositionComponent, VelocityComponent, and HealthComponent.
  3. Implement System classes that operate on entities with specific components, including methods for querying relevant entities and updating their components.
  4. Provide unit tests that validate the correct behavior of entities, components, and systems.
  5. Ensure the implementation adheres to the project's coding standards and contribution guidelines.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced Java Design Patterns contribution guidelines and review how existing patterns in this repository are organized. Define the Entity, Component, and System scope from the acceptance criteria, then add unit tests covering their association, querying, and updates; the work is done when the implementation meets all five criteria and follows the project standards.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.