jonnify·bcs /bcs/elixir-core/archetypes/archetypes-are-data

B2.4.1 · dive 1 of 3 · module B2.4

Archetypes are data.

An archetype is an entity in the ARC namespace whose value is a property bundle; an entity carries an archetype id plus overrides. Inheritance is a stored :extends pointer, not a class.

An ARC bundle naming one parent; an entity = archetype id + overrides; no behaviour modules. Select a part.
ARC bundlea property bundle (a map) :extendsparent ARCone parent at most entity = arc_id + overridesa value, not a subclassbehaviour modules: none
readout · Select a part. An archetype is an ARC entity whose value is a property bundle; it names at most one parent via :extends; an entity carries the archetype id plus overrides.
§1

The idea

echo_data · bcs/archetypes.ex

An archetype is not a class; it is an entity. It lives in the ARC namespace and its value is a property bundle — a plain map — that optionally names one parent through an :extends key. There are no behaviour modules and no hierarchy of code; inheritance is a stored pointer from one bundle to another, data all the way down.

An entity that uses an archetype carries two things: the archetype’s id and an overrides map of its own. The archetype supplies the shared defaults, the overrides carry what is particular to this one entity, and neither is baked into a type — both are values a store holds and a fetch returns. Reuse is a reference, not a subclass.

Codemojex models its kinds this way. A tile type is an ARC bundle; a power-up tile is a bundle that extends it; a placed tile is an entity carrying that archetype’s id plus the overrides for this square. Adding a kind is writing a bundle, not deploying code, so the set of types is data the game can grow at runtime.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related