Expand description
Thread markup — the HTML/CSS authoring surface for worlds.
A .thread file reads like HTML + CSS and compiles to a World Manifest
(the JSON “DOM” browsers fetch) — the same source→DOM split the web has. The
goal is the low floor: a handful of tags and a <style> block get you a
walkable place, no JSON by hand. Browsers accept .thread files directly
(see WorldManifest::from_text); serving markup at .well-known/thread/
is as valid as serving JSON — exactly like serving HTML.
<world id="grove" title="The Grove" description="A quiet clearing"
sky="0.1 0.1 0.2 / 0.5 0.3 0.2" rules="gathering">
<spawn at="0 0 8" yaw="180"/>
<tree class="harvestable" at="3 0 -2" scale="1 3 1"/>
<cube at="0 0 -5" rot="0 45 0" codex="the-thread">
<sphere at="0 1 0"/>
</cube>
<quad id="sign" at="0 1.4 -6" scale="5 2 0.2" url="https://example.com"/>
<portal to="thread://market" at="0 0 -8" label="Market"/>
</world>
<style>
tree { mesh: "trees/oak.glb" }
.harvestable {
interaction: "Chop";
interaction-hits: 3;
interaction-gives: 20100001 3;
interaction-message: "You chopped the old oak.";
interaction-despawns: true;
}
#sign { color: 0.2 0.25 0.35; emissive: 0.4 }
</style>Grammar summary:
<world id title description sky year rules>— the root.skyis a named preset (dawn/day/dusk/night/void) or explicit gradients"zr zg zb / hr hg hb [/ sx sy sz]"(the third segment aims the sun).rulesopts into game mechanics (survival gathering combat), default none.<spawn at name yaw>— an arrival point (yawin degrees). A world with no<spawn>gets a default one so every compiled world is enterable.- Any builtin tag (
cube/sphere/cylinder/capsule/plane/quad) or a tag given amesh:style rule places an object. Attributes:id,class,at,rot(Euler degrees, applied yaw→pitch→roll),scale,codex="slug"(inspect opens its lore),url="…"(signboard → the web reader), anddata-*(arbitrary per-object data, numbers auto-typed). Children nest — child transforms are relative to the parent. <portal to at rot scale label>— a veil to another world.- Structure vocabulary:
<room at r h gates columns gate-width>— a round walled colonnaded chamber (gates are azimuths in degrees, 180 = toward the default spawn; children are authored relative to the room’s centre);<wall from="x z" to="x z" h thick>— a straight wall between two ground points. Architecture as elements, not hand-mathed cubes. light="r g b [intensity] [range]"(attr or style property) — the placement emits a point light; lamps are content, not configuration.<style>properties:mesh,color(named orr g b [a]),metallic,roughness,emissive(glow, blooms),light, room’sfloor-color/accent-color,interaction(the verb) with longhandsinteraction-hits,interaction-gives(<item-id> [count]),interaction-message,interaction-effect,interaction-despawns.
Functions§
- compile
- Compile Thread markup into a validated
WorldManifest.