Open
Description
What should the ECS process from start-to-finish look like? Something like:
import Recs
main = do
run . build $ do
parallel [ mySys1, mySys2 ]
mySys3 `after` mySys1
mySys4 `after` mySys4Cleanup
mySys1 =
emap (read @(Velocity, Time) -&- write @Position)
(do
(MkPosition v, MkTime t) <- bag
tag (MkPosition $ p + dT *^ v))
mySys2 =
emap (write @(Particle, Kinetic))
(do
MkParticle t <- bag
if t < 0
then untag @(Particle, Kinetic)
else tag (MkParticle $ t - dT)
mySys3 =
-- 'edo' allows you to manually run queries, spawn/despawn/get/tag/untag specific entities
-- 'emap' is an 'edo' wrapper that launches straight into an archetype traversal
edo (write @Velocity -&- inherit mySys2)
(forM_ [0..1000] (const (make $ MkVelocity 0.0)) >> mySys2)
...
Metadata
Assignees
Labels
No labels
Activity