Skip to content

Frontend #5

Open
Open
@WinstonHartnett

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)
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions