Skip to content

Commit 1211250

Browse files
README intro
1 parent 449c1b3 commit 1211250

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/core/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# `@typeonce/ecs`
22
An **Entity Component System** (ECS) implementation in TypeScript, extensible, working with any renderer, type safe and composable 🕹️
33

4+
> `@typeonce/ecs` has zero dependencies. It makes no assumptions about your game engine, renderer or any other library or framework.
5+
6+
It is designed to provide a **solid and type-safe ECS implementation** to keep the logic of your game organized and easy to understand.
7+
8+
How you choose to render, apply physics, manage input, etc. is up to you, `@typeonce/ecs` **doesn't impose any constraints**.
9+
410
## Getting started
511
The package is available on [npm](https://www.npmjs.com/package/@typeonce/ecs):
612

@@ -18,7 +24,7 @@ const world = ECS.create(() => {
1824
});
1925
```
2026

21-
> Every call to `ECS.create` creates a new world. You can use multiple worlds for different scenes.
27+
> Every call to `ECS.create` creates a new world. You can use *multiple worlds for different scenes*.
2228
2329
The function inside `ECS.create` is where you initialize the game:
2430
- Add systems
@@ -117,8 +123,6 @@ export class FoodSpawnSystem extends SystemFactory<{
117123
}) {}
118124
```
119125

120-
The library does nothing more than organizing the logic of your game into entity, components and systems.
121-
122126
The created `ECS` instance provides an `update` function that you can call each frame to update the game, using whatever other library or framework you prefer:
123127

124128
> Calling `update` will execute all the systems in the world **one time**. You are expected to call `update` once per frame (or whatever other frequency you prefer).
@@ -182,6 +186,9 @@ export interface GameEventMap extends EventMap {
182186
You can then emit an event using the `emit` function:
183187

184188
```ts
189+
// 👇 Apply the `GameEventMap` type to the `SystemFactory` function to make events type-safe
190+
const SystemFactory = System<SystemTags, GameEventMap>();
191+
185192
export class CollisionSystem extends SystemFactory<{}>("Collision", {
186193
execute: ({ emit }) => {
187194
if (/* collision detected */) {

0 commit comments

Comments
 (0)