Skip to content

A modular game engine and ECS for Haskell

License

Notifications You must be signed in to change notification settings

aztecs-hs/aztecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

715 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aztecs

License Package CI status

A modular game engine and ECS for Haskell. An ECS is a modern approach to organizing your application state as a database, providing patterns for data-oriented design and parallel processing.

Examples

Features

  • Type-safe: Queries and systems use fully type-checked access with compile-time gurantees
  • High-performance: Components are stored by their unique sets in archetypes
  • Reactive: Component lifecycle hooks enable change-detection and event-based state management
  • Modular design: Aztecs can be extended for a variety of use cases
newtype Position = Position Int deriving (Show)

instance (Monad m) => Component m Position

newtype Velocity = Velocity Int deriving (Show)

instance (Monad m) => Component m Velocity

move :: (Monad m) => Query m Position
move = queryMapWith go query
  where
    go (Velocity v) (Position p) = Position $ p + v

app :: Access IO ()
app = do
  spawn_ $ bundle (Position 0) <> bundle (Velocity 1)
  positions <- system $ runQuery move
  liftIO $ print positions

main :: IO ()
main = runAccess_ app

Packages

Prior art

Aztecs' approach to archetypical ECS is inspired by Bevy and Flecs.

A fantastic lower-level (but higher-performance) Haskell ECS Apecs

About

A modular game engine and ECS for Haskell

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published