ohhecs-0.0.2: An Entity-Component-Systems engine core.
Copyright(C) 2020 Sophie Taylor
LicenseAGPL-3.0-or-later
MaintainerSophie Taylor <sophie@spacekitteh.moe>
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageGHC2021

Games.ECS.System

Description

Infrastructure for defining ECS Systems.

Synopsis

Documentation

class (World w, Monad m, KnownSymbol (AppendSymbol name " started"), KnownSymbol (AppendSymbol name " finished")) => System (name :: Symbol) (sys :: k) (w :: Access -> Type) (m :: Type -> Type) | name -> sys, sys -> name where Source #

A system which operates on entities which matches certain constraints on components.

Minimal complete definition

Nothing

Associated Types

type RunsAfter (sys :: k) :: [Symbol] Source #

What this systems runs after

type RunsAfter (sys :: k) = '[] :: [Symbol]

type RunsBefore (sys :: k) :: [Symbol] Source #

What this systems runs before

type RunsBefore (sys :: k) = '[] :: [Symbol]

type ComponentFilters (name :: Symbol) (sys :: k) (w :: Access -> Type) (m :: Type -> Type) Source #

Constraints required to run the system.

type ComponentFilters (name :: Symbol) (sys :: k) (w :: Access -> Type) (m :: Type -> Type) = ()

Methods

componentFilter :: (ComponentFilters name sys w m, Monoid r) => Getting r (w 'Storing) IntersectionOfEntities Source #

The filter on components which the system affects

processPredicate :: w 'Individual -> Bool Source #

Should this entity be processed?

processEntity :: w 'Individual -> m (w 'Individual) Source #

Process a single entity

initialiseSystem :: w 'Storing -> m (w 'Storing) Source #

Initialise the system with preliminary data based on a fresh world. The system is allowed to modify the world if it wishes.

runSystem :: w 'Storing -> m (w 'Storing) Source #

Run the system. By default, it runs processEntity for each entity.

postTickCleanup :: w 'Storing -> m (w 'Storing) Source #

Run any cleanup necessary at the end of a tick, such as clearing cached data only necessary for the tick, or marking things as dirty.

runAfterEffects :: w 'Storing -> m (w 'Storing) Source #

Ran after the effect system has finished. This is so that one can, for example, collect all effects to apply during the effect system processing; and once all effects are collected, apply them all at once. This can eliminate redundant processing, as well as later effects not overriding previously-processed effects.