-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f92753
commit 75097eb
Showing
9 changed files
with
93 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
description: >- | ||
Arch is not enough for you and you think that features are missing? No way, | ||
there's even more power here! | ||
--- | ||
|
||
# Arch.Extended | ||
|
||
Arch itself remains **bare minimum**, but that does not mean that it is not expandable. [`Arch.Extended`](https://github.com/genaray/Arch.Extended) has many useful **utilities** and **additional frameworks** **to** **complement** Arch and make it what you've always wanted it to be! | ||
|
||
<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Arch.Systems</strong></td><td>Framework to easy organize, reuse and arrange queries.</td><td><a href="arch.system.md">arch.system.md</a></td></tr><tr><td><strong>Arch.System.SourceGenerator</strong></td><td>Declarative syntax using attributes and source generator, let your queries write themselves!</td><td><a href="arch.system.sourcegenerator.md">arch.system.sourcegenerator.md</a></td></tr><tr><td><strong>Arch.EventBus</strong></td><td>A source generated EventBus, send Events with high-performance!</td><td></td></tr><tr><td><strong>Arch.LowLevel</strong></td><td>Low-level utils and data structures to get rid of GC pressure!</td><td></td></tr><tr><td><strong>Arch.Relationships</strong></td><td>Adds simple relationships between entities to arch!</td><td></td></tr><tr><td><strong>Arch.Persistence</strong></td><td>JSON and Binary (de)serialization to persist your Worlds!</td><td></td></tr><tr><td><strong>Arch.AOT.SourceGenerator</strong></td><td>Helps with AOT compatibility and reduces boilerplate code!</td><td></td></tr></tbody></table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
description: If only there was a way to organize your queries... wait... there is! | ||
--- | ||
|
||
# Arch.System | ||
|
||
You write query after query all the time to order your subordinates around... it's a pure mess, isn't it? Then just use `Arch.System`? It's quite simple... With `Arch.System` you can organize your queries in `Systems` and call and reuse them at will. | ||
|
||
<pre class="language-csharp"><code class="lang-csharp">public class MovementSystem : <a data-footnote-ref href="#user-content-fn-1">BaseSystem<World, float></a> | ||
{ | ||
private QueryDescription _desc = new QueryDescription().WithAll<Position, Velocity>(); | ||
public MovementSystem(World world) : base(world) {} | ||
|
||
// Can be called once per frame | ||
public override void Update(in <a data-footnote-ref href="#user-content-fn-2">float deltaTime</a>) | ||
{ | ||
// Run query, can also run multiple queries inside the update method | ||
World.Query(in _desc, (ref Position pos, ref Velocity vel) => { | ||
pos.X += vel.X; | ||
pos.Y += vel.Y; | ||
}); | ||
} | ||
} | ||
</code></pre> | ||
|
||
{% hint style="info" %} | ||
The example above is of course kept simple. You can simply put anything you want to group into such a `System`, e.g. a `System` for everything that moves your creatures... another `System` that contains everything that causes your creatures to suffer damage and heals them etc. There is no limit to your imagination! | ||
{% endhint %} | ||
|
||
Now we already have a `MovementSystem`, a `System` that groups everything that makes our [`Entities`](../../documentation/entity.md) move. But how do we integrate this now?  | ||
|
||
```csharp | ||
// Create a world and a group of systems which will be controlled | ||
var world = World.Create(); | ||
var _systems = new Group<float>( | ||
new MovementSystem(world), | ||
new PhysicsSystem(world), | ||
new DamageSystem(world), | ||
new WorldGenerationSystem(world), | ||
new OtherGroup(world) | ||
); | ||
|
||
_systems.Initialize(); // Inits all registered systems | ||
_systems.BeforeUpdate(in deltaTime); // Calls .BeforeUpdate on all systems ( can be overriden ) | ||
_systems.Update(in deltaTime); // Calls .Update on all systems ( can be overriden ) | ||
_systems.AfterUpdate(in deltaTime); // Calls .AfterUpdate on all System ( can be overriden ) | ||
_systems.Dispose(); // Calls .Dispose on all systems ( can be overriden ) | ||
``` | ||
|
||
{% hint style="info" %} | ||
A `Group<T>` can also contain other `Group<T>`. `BeforeUpdate`, `Update` and `AfterUpdate` should be called at will to update the systems and queries. | ||
{% endhint %} | ||
|
||
And we have already divided our `Systems` into `Group<T>`s to bring order into it. What more could you want? | ||
|
||
[^1]: `BaseSystem` provides several usefull methods for interacting and structuring systems. `float` is the value that is transmitted to the system. This can be any type. | ||
|
||
[^2]: Can be any type based on the generics of this instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
description: >- | ||
What's the point of organized queries if it's sooo much work to write them? We | ||
have a solution! | ||
--- | ||
|
||
# Arch.System.SourceGenerator | ||
|