Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideas for more flexibility, performance, and usability #13

Open
spacekitteh opened this issue Jan 24, 2020 · 1 comment
Open

Ideas for more flexibility, performance, and usability #13

spacekitteh opened this issue Jan 24, 2020 · 1 comment

Comments

@spacekitteh
Copy link

spacekitteh commented Jan 24, 2020

  1. Split ComponentType into two new types, MembershipType (for Field and Virtual) and Semantics (Unique). This might allow easier extensions in both directions, such as adding Flag semantics and Required membership.

  2. Allow user-defined storage equations, particularly for WorldOf. For example, if the previous idea isn't implemented, this would still allow many of the same performance benefits, such as using compressed bitmaps for Boolean values, or unboxed Vectors for positions/velocities/etc.

  3. Expose an optical interface!

@spacekitteh
Copy link
Author

spacekitteh commented Jan 24, 2020

Some more concrete syntax ideas:

Style #1:

do
    pos@(Position x y)<- with
    vel <- with @Velocity
    Not @Flying <- with
    pos.x += vel.x

Style #2:

process l a = do
    ecs <- get
    iforMOf l ecs a

movement =
    process (with @Position . with @Velocity . with @(Not Flying)) $ \ent (position, velocity) -> do
        position.x += velocity.x
        if ent `in` bosses then
            putStrLn "gotta go fast"
            else pure ()

Style #2 seems like it would be more amenable to having GHC.Generics produce the correct code to minimise traversal, pushing the filtering of entities into the traversal code, and not relying on, say, Alternative/MonadPlus instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant