-
Notifications
You must be signed in to change notification settings - Fork 0
ECS (entity-component-system) is a software architecture used in many video game and most notably in roguelikes. Each element in the game (weapon, enemy, item, player, etc.) is an "entity" (typically a number in memory) with associated "components" that can be attached or detached.
In Jupiter Hell, the set of components attached to one entity is structured as a tree. For example, the entity associated to the player may have the "player" component (as a root), a weapon component (as a child of the player) and this weapon can have a perk (as a child of the weapon).
Components are created with blueprints, typically with item:attach("blueprint_name")
that attaches it to item
. To detach something, use world:detach(smthg)
.
(cpiod: should world:attach or ecs:attach be used?)
ecs:root( self )
is the parent of the parent of the parent (etc.) of self
?
ecs:parent( self )
get the parent of self
self:parent()
is identical to ecs:parent( self )
?
ecs:children( entity )
is the list of all the children of entity
item:child("blueprint_name")
gets the child of item
that matches the blueprint name
item:attach("blueprint_name")
creates a new entity with this blueprint and attaches it to item
ecs:add(entity,"blueprint_name")
: what difference with attach?