Small things you can build

Docs / Examples

Start with something you can see and understand. Change one field, run the checker and look at what the engine builds. These are complete Dream 2 files, checked alongside the compiler tests.

Two tables, one rule gives a square table and a round pedestal table the same impact policy. Each keeps its own shape, fragments and damage. Read the shared-rule contract.

Town errands, garden and habitat care and class preparation are runnable logical task environments. They share prices, budgets, capacity, services and objectives. Prompt and run them in Dream Lab.

City car uses a concave shell profile, sloped glazing and two rigid axle bearings. City bicycle uses paired forks and stays, mounted axles and a rolling crank. Both are the complete assemblies used by the mock world. See their construction.

Utility vehicles supplies the complete pickup and parcel-truck library. Both reuse a disc and axle component, with separate proportions and the existing car controls. Construction and depot locations.

Walkable garden steps pair three round treads with matching cylinder contacts. Each rise is 30 cm, below the walking controller's 40 cm step limit. The movement guide explains headroom, jumping and water support.

The complete light aircraft uses tapered sections for its fuselage and wings, endpoint braces and independent wheel/propeller animation. Its asset guide explains the joins and physical scale.

Airport terminal is the exact 24-part assembly used in the live airport. Airport and medical shuttle is a standalone world with both destination kinds, attached entrances, a connected platform and a passenger bus. Its source distinguishes terminal meaning from the geometry and transport needed to support it.

A resting sidewalk population reuses the full rig as instanced scenery with explicit pose=rest and a clear inner walking corridor.

The complete humanoid binds twelve joints to the engine's walk, run and swim cycles. The model supplies anatomy and connected parts; the engine supplies motion. Close-up recordings and binding rules.

A bakery and an overnight supplier uses daily counter hours, finite recipes, hungry customers and a physical courier. Check closing, reopening and saved waits.

An ownable bakery separates the operator, personal owner account and company treasury. The same owner/sale capability is playable at the live station depot. Business ownership.

Wildlife constructions contains the nine complete live animals. Distance-driven joints is a smaller five-part example: hip and knee cycles follow travel while the head retains a separate swing. Bounds and rendered source.

Two finishes, one assembly

These two tables share their top and four legs. Numeric parameters set dimensions; material parameters select a finish and pass it through nested components. The complete file compiles to ten parts, with no special renderer recipe.

dream
dream 2;
material timber(style=wood,colors=[#98724e,#62452f]);
material blue(style=toon,colors=[#537eaa,#3c5f87]);
component leg(params=[h],materials=[finish]){
  beam post(shape=box,material=finish,from=[0,0,0],to=[0,h,0],width=4,depth=4);
}
component table(params=[h],materials=[finish]){
  repeat ends(index=i,count=2){
    repeat sides(index=j,count=2){
      use support(component=leg,args=[h],materials=[finish],at=[i*44-22,0,j*24-12]);
    }
  }
  part top(shape=box,material=finish,at=[0,h+2,0],size=[58,4,38]);
}
object oak_table(label="Oak table"){
  measure(kind=table,axis=x,meters=1.8);
  body(interaction=solid,radius=26,height=28);
  use furniture(component=table,args=[24],materials=[timber]);
}
object blue_table(label="Blue table"){
  measure(kind=table,axis=x,meters=1.8);
  body(interaction=solid,radius=26,height=28);
  use furniture(component=table,args=[24],materials=[blue]);
}

A ball that bounces

A sphere supplies the shape. The knockable body and bounce declaration supply the behavior. measure makes the ball sixty centimetres tall; it scales the body with the mesh.

Download bouncing-ball.dream

dream
dream 2;
material rubber(style=toon,colors=[#df714f,#aa4637]);
object ball(label="Red ball"){
  measure(kind=custom,axis=y,meters=.6);
  body(interaction=knockable,radius=8,height=16,friction=.65);
  impact(mode=bounce(restitution=.74,lift=.24));
  part shell(shape=sphere,material=rubber,at=[0,8,0],size=[16,16,16]);
}

A bench that breaks

The slats and frame are separate fragments. A hard impact releases those groups using the splinter pattern. A gentle touch leaves the bench intact.

Download breakable-bench.dream

dream
dream 2;
material wood(style=grain,colors=[#ad784e,#624331]);
material metal(style=toon,colors=[#354849,#263839]);
object park_bench(label="Park bench"){
  measure(kind=bench,axis=x,meters=1.8);
  body(interaction=solid,radius=28,height=31);
  impact(mode=break(speed=95,scatter=65,lift=65,spin=4,lifetime=6,pattern=splinter));
  repeat slats(index=i,count=3){
    fragment seat(){
      part plank(shape=box,material=wood,at=[0,16,-8+i*8],size=[60,4,6]);
    }
  }
  repeat sides(index=i,count=2){
    fragment frame(){
      part front(shape=box,material=metal,at=[i*44-22,6.5,10],size=[5,13,5]);
      part rear(shape=box,material=metal,at=[i*44-22,15,-12],size=[5,30,5]);
    }
  }
  fragment back(){
    part plank(shape=box,material=wood,at=[0,26,-14],size=[60,6,4]);
  }
}

A sign with a moving hinge

The same support component builds both posts. The hinge owns its panel and stripe, so they swing together around the crossbar. Part dimensions never move the joint's pivot.

Download swinging-sign.dream

dream
dream 2;
material timber(style=grain,colors=[#b1855e,#694b33]);
material paint(style=toon,colors=[#527f75,#284c47]);
component support(params=[x]){
  beam post(shape=box,material=timber,from=[x,0,0],to=[x,40,0],width=3,depth=3);
}
object sign(label="Wind over the bicycle lane"){
  measure(kind=custom,axis=y,meters=2.4);
  body(interaction=solid,radius=12,height=43);
  use left(component=support,args=[-12]);
  use right(component=support,args=[12]);
  beam crossbar(shape=box,material=timber,from=[-14,40,0],to=[14,40,0],width=3,depth=3);
  joint hinge(at=[0,38,0],motion=swing(axis=x,deg=8,hz=.35,phase_deg=0)){
    part panel(shape=box,material=paint,at=[0,-7,0],size=[22,12,2]);
    part stripe(shape=box,material=timber,at=[0,-7,1.1],size=[15,2,.5]);
  }
}

A tree that falls as one piece

The trunk and crown stay connected inside one fragment. topple gives the whole tree a terrain-aware fall instead of scattering its parts. Place this swaying asset as a static prop in a world with damage_pool=true.

Download toppling-tree.dream

dream
dream 2;
material bark(style=grain,colors=[#846044,#4b392c]);
material leaf(style=toon,colors=[#77a05b,#426b45]);
object oak(label="Oak"){
  measure(kind=tree,axis=y,meters=10);
  body(interaction=solid,radius=4,height=69);
  impact(mode=topple(speed=110,duration=1.1,lifetime=8));
  fragment tree(){
    part trunk(shape=cylinder,material=bark,at=[0,24,0],size=[6,48,6]);
    part crown(shape=icosphere,material=leaf,at=[0,52,0],size=[36,34,32],motion=sway(deg=2,hz=.2));
    part branch(shape=icosphere,material=leaf,at=[-12,44,3],size=[24,24,23],motion=sway(deg=1.5,hz=.17));
  }
}

Keep going

The controllable bicycle shows a measured vehicle with rolling wheels and rideable(at=[-3,26,0],control=bicycle). Its controls come from the engine; the model supplies the assembly and seat.

The dedicated path is a complete playable world with a four-metre cycle circuit kept clear of the racing road. The larger world example adds water, a timber bridge, terrain, effects and checkpoints.

sh
node scripts/dream.mjs check docs/examples/bouncing-ball.dream
node scripts/dream.mjs check docs/examples/swinging-sign.dream
node scripts/dream.mjs check docs/examples/dedicated-path.dream

The source files are the examples. Tests compare these complete snippets with their source files, so the highlighted version cannot drift from the version the compiler checks. On GitHub, follow the file links below; on the documentation site, copy the complete highlighted block.

Ball source · Bench source · Sign source · Tree source

Tapered wood builds a connected snag with a narrowing trunk, rising branch and cut face. The object guide includes the complete source.

Ambient wildlife composes a pair of birds with wing joints and a continuous airborne loop. The behavior guide includes the complete source.

A neighborhood

The complete neighborhood module joins two streets and paints a basketball court with a repeated center circle. It can be included in a full world. The planned-world guide shows the larger town, suburbs and sports park built from the same primitives.

Connected cycle junctions uses shared anchors for a T-junction and a four-way intersection. cycle_width and explicit junction crossings supply the connected surface; no overlapping paint patches are needed.

Programmable pedestrian pauses its route near the player and turns toward them. The NPC guide includes the complete source and explains timed routines, roles and runtime ownership.

A carved voxel wall

Download voxel-wall.dream. One fill, an opening and repeated top cuts become a four-piece breakable wall. Read voxel construction for geometry and collision boundaries.

Constructed buildings and transport

  • Terraced house: thin framed glazing, gabled roof, chimney and connected drainage.
  • City bus: wheel openings, rolling axles and carved passenger doors.
  • Cabin launch: pointed hull, deck, wheelhouse, outboard and fitted seat.

These complete sources compile to the same assemblies used in the live mock world. Construction notes.

Moving populations puts measured walkers on connected sidewalks and a reactive hare in a dry habitat. How the movement works.

Talk to a person is a complete playable world with two authored replies, interaction range and a timed return to waiting. Conversation semantics.

Market work is a complete world with two NPCs, finite food, ingredient stock, shared wages, needs and timed work. Play and author the market loop.

Market deliveries adds a second food counter. Carry reserved bread between places, earn pay on handoff and let a local customer buy it from the receiving stock. Delivery rules.

Repair a market table connects finite kits and wages to a worker walking out, repairing category-selected damage and returning home. How it works.

Market maintenance and procurement uses one service for tables and crates, then replenishes repair kits from a separate supplier. The receiving business pays for both goods and courier work. Finite supplies and payment rules.

Connected school-bench repair reuses paired furniture seats, shared destruction and one finite paid service across two adjoining school grounds and an authored crossing. Try it in the city.

Connected neighborhood repairs adds a second work ground across a street. The worker must reach it through the authored crossing, then return with its pay. Grounds and routes.

Streetlight destruction and repairs uses measured lamps, a shared topple rule, pooled static geometry, night light pools and finite paid repairs across two connected grounds.

Repair a street lamp

Street-verge repairs connects a home yard to a lamp beyond the opposite sidewalk. The worker uses an authored crossing, steps onto a bounded dry approach, consumes a kit, gets paid and walks home. No extra work-ground surface is drawn beneath the lamp. Coverage and bounds.

sh
node scripts/dream.mjs check docs/examples/street-verge-repairs.dream

Plant and grow a replacement

Orchard recovery combines a whole-tree topple rule, finite saplings, two repair policies on one worker and persistent physical growth. Check it with npm run -s dream -- check docs/examples/orchard-replanting.dream. The guide explains the shorter example timings and live-city loop.

Street-tree recovery adds a wind-animated voxel tree, the shared category rule and connected work beyond a sidewalk through verge=112. Check it with npm run -s dream -- check docs/examples/city-tree-replanting.dream.

Courier resupply lets the same worker repair two damaged objects, collect finite replacement kits across a crossing and bring them home. NPC supply trips explain shared capacity, collection-time checks and saved walking phases.

An enterable market

The complete market assembly declares a real floor, static rectangle walls, an opening and shell cutaways. Interiors explains how to place it, connect work and keep the floor readable at night.

Shared seating is a complete checked world with a breakable two-seat bench, a humanoid customer and finite bread purchases. The seating guide explains approaches, claims and saved meals.

Staff shifts · Complete daytime bakery and overnight depot: physical rest/return, attendance checks and saved journeys.

Shared meals · Player-hosted source · NPC-hosted source: two paid portions, Y/X consent, saved seat claims and dialogue that remembers completed time together. NPC hosts use their own finite money and food.

Full-verge repair connects a measured, fully jointed worker to a lamp near the edge of its declared street verge, with finite supplies, pay and a required crossing.

The faceted fir uses the live tree’s complete visual construction, with tapered branch supports and explicit flat canopy faces. The world entry file supplies its shared toppling rule.

Complete plant constructions reuse rooted leaf and petal profiles, joined foxglove panels and a pot rim across four live objects. Existing measure frames and furnishing reservations are explicit.

Background ground cover defines two reusable components, grass and a flower, plus their combined inspection object. These are the engine's small passable details. Scatter density remains engine-owned.