Skip to content

Commit

Permalink
docs: add repeating systems and fixed-step
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomanita committed May 16, 2024
1 parent 4e107a1 commit 58e5ed3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions content/0-2-and-coffeejam.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ in a reflective context. With this trait, you can define which types inherit fro

Check our documentation page for more information: https://gamedevtecnico.github.io/cubos/docs/examples-core-reflection-traits-inherits.html.

Repeating systems and fixed-step updates :dim:`(@joaomanita)`
------------------------------------------------------------
Certain plugins, like the physics plugin, required some of their systems to run multiple times per frame so that they could make more accurate
aproximations. In addition, some of them need to be executed in ordered groups (ex: physics integrate position > update velocities > clear forces > clear impulses).
To do this I added tags that make systems tagged by them be repeated while a condition is true (cubos.tag(exampleTag).repeatWhile({});).
And to create subgroups, all you need to do is tag your subgroup tag with a parent tag
(cubos.tag(groupTag).repeatWhile({});
cubos.tag(subgroupTag).repeatWhile({}).tagged(groupTag); )

This way the subgroup will repeat n x m times (n-grouptag m-subgrouptag)

With this it was easy to implement a fixed-step plugin, which adds a tag that forces systems to repeat according to
the DeltaTime passed, avoiding variance due to different framerates and more/less powerful PCs.

Next steps
==========

Expand Down

0 comments on commit 58e5ed3

Please sign in to comment.