Skip to content

Commit

Permalink
sync on 2024/11/13, rev 74a089e04b4efe3b67b0d61cff4b7b6d10974174
Browse files Browse the repository at this point in the history
  • Loading branch information
NicSavichev committed Nov 13, 2024
1 parent e03ad4c commit 4888824
Show file tree
Hide file tree
Showing 558 changed files with 18,872 additions and 14,437 deletions.
2 changes: 1 addition & 1 deletion DagorEngine.rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3d88ac71b14c53f13993848988e2531e13355879
74a089e04b4efe3b67b0d61cff4b7b6d10974174
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 14 additions & 12 deletions _docs/source/api-references/dagor-ecs/dagor_ecs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Basic concepts
# Dagor ECS

## Basic concepts

**Entity:** An entity is a set of components created based on a template using
an initializer (a data set) for each component. It is important to note that an
Expand Down Expand Up @@ -101,7 +103,7 @@ eventually be received by the clients. It is done in order to not resend
"obsolete" data, if the packet containing replication has been lost, while
relevant components have been changed.

# Characteristics
## Characteristics

- **Components are Code-Free:** Components do not contain any code. They are not
OOP objects, as encapsulation, inheritance, and polymorphism contradict the
Expand Down Expand Up @@ -198,7 +200,7 @@ relevant components have been changed.
milliseconds (because measuring that is slow) but in Events. Therefore, it is
crucial that a single `onEvent` does not cause significant delays.

# Working Directly
## Working Directly

- **Working with Components Directly:** Direct manipulation of components is
allowed only under one condition — it must not occur inside
Expand All @@ -216,7 +218,7 @@ relevant components have been changed.
- **Avoid Get/Set:** In general, it is advisable to avoid using `get`/`set`
methods.

# Entity States
## Entity States

When writing network code, especially when dealing with an external Entity Id
(not included in a query/es) through get/set operations (which should be avoided
Expand Down Expand Up @@ -246,7 +248,7 @@ assert in such cases but in release builds will still return a reference to
empty memory), use `getNullable`/g`etNullableRW`. An entirely empty entity will
return an "empty" template name.

# Legacy (OOP)
## Legacy (OOP)

If you have an OOP object that you want to turn into a component, this does not
inherently violate the ECS paradigm. However, all the code (object methods)
Expand All @@ -260,7 +262,7 @@ shared library rather than leaving it as a class method to clearly distance it
from OOP. If the OOP object is polymorphic, this should not be used at all (and
it's better not to do this).

# Difference in Approaches
## Difference in Approaches

Let’s say you want to create triggers (e.g., something happens when entering a
trigger). Previously, you had a spherical trigger, and now you need a cubic one
Expand Down Expand Up @@ -337,7 +339,7 @@ As you can see, both approaches are possible, but:
implementations, and instance creation code. The ECS version contains all the
necessary code (excluding what is generated by codegen).

# Performance
## Performance

- **Typical Entity Characteristics:** In most game worlds, typical entities have
at least 5-10 components, and sometimes even several hundred, consuming
Expand All @@ -360,7 +362,7 @@ As you can see, both approaches are possible, but:
data-oriented approach, it features high speed and excellent cache locality.


## Entity Creation
### Entity Creation

- **Framework Overhead:** The overhead of the framework during entity creation
is negligible.
Expand Down Expand Up @@ -402,7 +404,7 @@ events for these entities.
**Conclusion:** Entity creation in daECS is very fast! There is no need to
implement spawn pools or other such complexities.
## Data Handling/Frame Update
### Data Handling/Frame Update
To evaluate this, we use the same entity and a trivial kinematic update: `pos +=
dt * vel`.
Expand Down Expand Up @@ -443,7 +445,7 @@ Unity algorithm, and daECS performs approximately 4-8 times faster.
**Conclusion:** Working with daECS is incredibly fast!
# Codegen
## Codegen
We have a *codegen* (code generation) tool that automatically generates
standardized bindings for system registration using "lambda" that process one
Expand Down Expand Up @@ -565,7 +567,7 @@ Broadcast events:
- `EventEntityManagerBeforeClear`, `EventEntityManagerAfterClear`: Sent
before&after all scene (all entities) destruction.

# Code Example
## Code Example

```
rect
Expand Down Expand Up @@ -596,7 +598,7 @@ ball
}
```

# Video Lecture
## Video Lecture

Anton Yudintsev's video lecture on ECS:

Expand Down
2 changes: 1 addition & 1 deletion _docs/source/api-references/dagor-ecs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ within the Dagor Engine.
:caption: Contents:

dagor_ecs.md

schemeful_events.md


Loading

0 comments on commit 4888824

Please sign in to comment.