Log inGet started
World

Crystal Isle

Branchmain
Branchesmain
Commit88bf5ef824

README.md

crystal_isle.Core

The one module every slice of Crystal Isle reads, and the one thing they agree through.

What it holds

  • ISLAND — the plateau's radius, the walkable half-width, the top's height.
  • POS — where Crystal Haven stands and where a player arrives.
  • CRYSTALS — the mining rule: a cluster breaks in 2 to 5 hits, how many shards a hit and a break are worth, how far off a crystal is visible, how near one raises your staff, how long a mined cluster takes to grow back, and how many clusters the island carries.
  • PICKAXES — the four staffs, cheapest first: cost, hits per crystal, shardsPerHit, shardsOnBreak, the beam colour, and a line of flavour.
  • DRESSES — the five outfits, each with a cost, a blurb and the colors its mesh is built from.
  • PALETTE — the whole island's colours, so every screen and material stays in one evening.

The live state

Kept as attributes on the entity crystal_isle_state — a LOCAL entity, so every peer keeps its own shard purse and its own wardrobe while standing on the same island:

Attribute
shardsnumberhow many crystal shards you carry
pickaxenumberwhich PICKAXES entry you hold (1-based)
dressstringthe DRESSES id worn
ownedstringcomma-separated ids of every dress owned

Who consumes it

Every slice: ci_mining mines through M.addShards, ci_shop buys through M.buyPickaxe / M.buyDress / M.equipDress, ci_hero dresses the body from M.dress(), ci_screens draws the HUD from M.shards() and subscribes with M.subscribe, ci_island lays the island out from M.ISLAND and M.POS.

The rule

Nothing writes those four attributes except this module. Mining calls M.addShards; the shop calls M.spend / M.buyPickaxe / M.buyDress / M.equipDress. That is what keeps the two halves of the game — what you dig up and what you spend it on — agreeing with each other.