Skip to content

Commit a756411

Browse files
SatoCodingStuffcrowdin-botItsNeil17Blovien
authored
feat: added ECS guide (#149)
* added file * feat: added a basic introduction into ECS including explanation about entities, components and systems * New Crowdin translations by GitHub Action * chore: lint Signed-off-by: ItsNeil17 <neil@willofsteel.me> * feat: add keywords to metadata Signed-off-by: ItsNeil17 <neil@willofsteel.me> * feat: add keywords as an argument to frontmatter Signed-off-by: ItsNeil17 <neil@willofsteel.me> * chore: lint Signed-off-by: ItsNeil17 <neil@willofsteel.me> * feat: added hynergy project * feat: added a basic introduction into ECS including explanation about entities, components and systems * feat: changed files into ECS directory * feat: added warning and simple composition over inheritance explanation * chrone: lint --------- Signed-off-by: ItsNeil17 <neil@willofsteel.me> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: ItsNeil17 <neil@willofsteel.me> Co-authored-by: Andrea Rossi <andrea.rossi03@pm.me>
1 parent 879188f commit a756411

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Entity Component System
3+
description: A basic introduction into ECS (Entity Component System)
4+
---
5+
6+
<Callout type="warning">
7+
This guide requires basic understanding of OOP concepts such as inheritance.
8+
9+
Please make sure you have a good understading of these concepts before reading this guide.
10+
</Callout>
11+
12+
<Callout type="info">
13+
This guide is currently only on the theory of ECS and will not have code examples.
14+
15+
Code examples are intentionally omitted to avoid confusion about how Hytale’s ECS may be implemented.
16+
</Callout>
17+
18+
19+
# Introduction
20+
21+
An Entity Component System otherwise known as ECS is a design pattern in game development.
22+
23+
ECS is made up of Entities, which reference Components and Systems that operates on Entities.
24+
25+
It also focuses on composition over inheritance, eliminating rigid hierarchy, helps separate behavior and data and makes reusability easier.
26+
27+
# Composition Over Inheritance
28+
29+
Before getting into understanding what ECS is made of, lets understand what is the ECS philosophy.
30+
31+
We can describe composition as "has X" and inheritance as "is X".
32+
When we inherite a class in Java, we inherite all of its attribues and methods.
33+
While in composotion we can choose for each object what it refrence and what systems will work on it.
34+
35+
# Entities, Components and Systems
36+
37+
## Entities
38+
39+
An Entity is just a unique identifier.
40+
- It contains no data.
41+
- It contains no logic
42+
43+
Think of entities as nouns that can be described using components
44+
45+
## Components
46+
47+
Components are just plain data containers.
48+
- They store only data
49+
- They contain no behavior or logic
50+
- They describe traits or aspects of an entity
51+
52+
Examples of components:
53+
- A 'Position' component that stores X, Y and Z coordinates
54+
- A 'Velocity' component that stores the speed along the each axis
55+
- A 'Health' component that stores the current health of the entity
56+
57+
Think of components as adjectives that describe an entity
58+
59+
## Systems
60+
61+
Systems contains the logic for your game (or in this case, a mod).
62+
- It Operates on all entities that have a specific set of components
63+
- It Does not store entity data itself
64+
- It Applies behavior by reading and modifying component data
65+
66+
67+
For example:
68+
- A "WinConditionSystem" may process every Entity that contains the components "Position" and "Velocity"
69+
- If an entity reaches the position `(0, 0, 0)`, the system will trigger a "You Won!" message.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"icon": "IdCardLanyard"
3+
}

0 commit comments

Comments
 (0)