Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
minecrawler committed Oct 2, 2023
1 parent 0e72f5b commit 2519d78
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $ npm install sim-ecs
or used as direct import for Deno:

```typescript
import * as simEcs from "https://deno.land/x/sim_ecs@v0.6.2/src/index.ts";
import * as simEcs from "https://deno.land/x/sim_ecs@v0.6.3/src/index.ts";
```


Expand Down Expand Up @@ -163,6 +163,10 @@ Also, there is a [generated API-documentation](https://nsstc.github.io/sim-ecs/)
In an ECS, a world is like a container for entities.
Sim-ecs comes, by default, with two variants: A prepare-time world and a runtime world.

_See
["Counter" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/counter.ts)
 _


### Prepare-Time World

Expand All @@ -174,7 +178,8 @@ const prepWorld = buildWorld().build();
```

_See
[IPreptimeWorld](https://nsstc.github.io/sim-ecs/interfaces/IPreptimeWorld.html)
[IPreptimeWorld](https://nsstc.github.io/sim-ecs/interfaces/IPreptimeWorld.html),
["Counter" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/counter.ts)
 _


Expand All @@ -189,7 +194,8 @@ const runWorld = await prepWorld.prepareRun();
```

_See
[IRuntimeWorld](https://nsstc.github.io/sim-ecs/interfaces/IRuntimeWorld.html)
[IRuntimeWorld](https://nsstc.github.io/sim-ecs/interfaces/IRuntimeWorld.html),
["Counter" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/counter.ts)
 _


Expand Down Expand Up @@ -247,6 +253,11 @@ const prepWorld = buildWorld()
.build();
```

_See
["Counter" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/counter.ts),
["Pong" example](https://github.com/NSSTC/sim-ecs/tree/master/examples/pong)
 _


## Setting Resources

Expand All @@ -259,6 +270,11 @@ prepWorld.addResource(Date);
console.log(world.getResource(Date).getDate());
```

_See
[addResource()](https://nsstc.github.io/sim-ecs/interfaces/IMutableWorld.html#addResource),
[getResource()](https://nsstc.github.io/sim-ecs/interfaces/IWorld.html#getResource),
[getResources()](https://nsstc.github.io/sim-ecs/interfaces/IWorld.html#getResources)
 _

## Defining Systems

Expand All @@ -278,7 +294,9 @@ const CountSystem = createSystem({

_See
[createSystem()](https://nsstc.github.io/sim-ecs/functions/createSystem.html),
[ISystemBuilder](https://nsstc.github.io/sim-ecs/classes/SystemBuilder.html)
[ISystemBuilder](https://nsstc.github.io/sim-ecs/classes/SystemBuilder.html),
["Counter" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/counter.ts),
["Pong" example](https://github.com/NSSTC/sim-ecs/tree/master/examples/pong)
 _


Expand Down Expand Up @@ -329,6 +347,10 @@ const CountSystem = createSystem({
}).build();
```

_See
[createSystem()](https://nsstc.github.io/sim-ecs/functions/createSystem.html)
 _


### Hot Reloading Systems

Expand Down Expand Up @@ -379,6 +401,10 @@ hmr:if (import.meta.hot) {

Note: The label `hmr` was chosen as an easy and reliable way to remove this code block from a prod build.

_See
["Pong" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/pong/src/systems/ball.ts)
 _


## Defining Components

Expand All @@ -400,10 +426,12 @@ to the entity builder later on. If you don't do so, it is assumed that the compo
You can also use a default-type de-/serializer on save/load, which allows for a variety of standard types (such as `Date`) as components.

_See
[IWorldBuilder](https://nsstc.github.io/sim-ecs/interfaces/IWorldBuilder.html),
[buildEntity()](https://nsstc.github.io/sim-ecs/interfaces/IPreptimeWorld.html#buildEntity),
[IEntityBuilder](https://nsstc.github.io/sim-ecs/interfaces/IEntityBuilder.html)
 _


## Adding Entities

Entities are like glue. They define which components belong together and form one data.
Expand Down Expand Up @@ -431,6 +459,10 @@ If no state is passed to the dispatcher, all systems are run by default.
While the world is running (using `run()`), the state can be changed using commands.
Single calls to `step()` do not offer the benefits of a PDA.

_See
["Pong" example](https://github.com/NSSTC/sim-ecs/tree/master/examples/pong/src/states)
 _


## Update loop

Expand Down Expand Up @@ -458,6 +490,10 @@ but still only run at times when it is actually safe to do them.
Such sync points include any major transitions in a step's life-cycle, and sim-ecs will always trigger the execution
of all queued commands at the end of the step.

_See
[ICommands](https://nsstc.github.io/sim-ecs/interfaces/ICommands.html)
 _


## Saving and using Prefabs

Expand Down Expand Up @@ -538,6 +574,12 @@ const saveData = runWorld.save(queryEntities(With(Player))).toJSON();
localStorage.setItem('save', saveData);
```

_See
[load()](https://nsstc.github.io/sim-ecs/interfaces/IWorld.html#load),
[save()](https://nsstc.github.io/sim-ecs/interfaces/ITransitionActions.html#save),
["Pong" example](https://github.com/NSSTC/sim-ecs/blob/master/examples/pong/src/states/game.ts)
 _


## Syncing instances

Expand Down

0 comments on commit 2519d78

Please sign in to comment.