dmnet.st Commando

How it works · write-up

Brick-built art style plan (BACKLOG_3D 3D-13)

docs/BRICK_STYLE_PLAN.md · 11 KB · updated 2026-11-02

Working notes, rendered as they are: they were written while building the game, so expect ROM addresses, register names and references to source files that are not published.

Status: scale chosen (3 studs per tile, 2026-10-19); phases 2–5 implemented in a first version, see BACKLOG_3D 3D-13. Recorded 2026-10-18.

Goal: an alternative art style in which the actors and the static terrain look built from toy construction bricks, in the manner of the brick-built films and games. It sits beside the current low-poly style as a second option of the in-game 3D view (3D-4) and stage lab; gameplay, collision and timing stay untouched.

"LEGO" is a trademark of the LEGO Group, which does not sponsor or endorse this project. The plan therefore avoids LEGO names and logos in the project (plain studs, no stud logos) and treats the result as personal fan work. The minifigure shape is itself protected in some jurisdictions, which matters only if the project is ever distributed or sold.

Recommendation in one paragraph

Generate the bricks ourselves and use real brick geometry only where shape matters. The terrain is built procedurally from the data we already have (tile art, relief heights, structure placements): it becomes plates, bricks and smooth tiles on a stud grid, coloured from a limited brick palette. Structures (walls, bunkers, gates, rocks) are brickified from our existing Blender models by the same voxel-to-brick builder. Soldiers become minifigures assembled from LDraw parts by a small script, using text .ldr files that we write and track. Hero props whose look depends on special parts (palms, vehicles, the gun emplacement) are built by hand in BrickLink Studio or LeoCAD and exported as LDraw. Everything goes through the existing headless Blender pipeline into .glb files with the same clip names, so the renderer and art bindings only gain a style switch.

The tools from the list, judged for this project

Tool Verdict Why
LDraw parts library Use (minifigures, special parts) Accurate geometry for 20k+ parts, plain-text format, scriptable. Licensed CC BY 2.0 / CC BY 4.0 with attribution "The LDraw Parts Library"; converted parts are derivative works, so generated models stay ignored like other generated assets and the attribution goes into docs/licenses/.
BrickLink Studio Use for hand-built hero props Best free building UI with real parts; exports LDraw (File > Export As). Closed source, so it is an authoring tool only, never a build dependency.
LeoCAD Optional alternative to Studio Open source, LDraw-native. Use if Studio is unavailable.
ldr_tools_blender Use for interactive viewing and checking Imports .ldr, .mpd and Studio .io; instances by part and colour; needs Blender 5.1+ (we have 5.2); can drop stud logos to cut vertices. It does not document a headless mode, so the build uses our own small LDraw reader.
three.js LDrawLoader Useful for a lab preview Already in node_modules/three; loads .ldr/.mpd in the browser. Too heavy for the game (raw parts are high-poly), fine for a lab page.
Mecabricks Skip Online builder; good renders but the Blender export path needs paid add-ons.
Bricker Skip Paid Blender add-on. Our own brickifier is needed anyway for the terrain and runs headless and reproducibly.
Poly Haven Use (one 1k HDRI) CC0 environment lighting gives the plastic its reflections. One small file, loaded once.

Scale

The stud pitch decides everything else. Real proportions: stud 8 mm, plate 3.2 mm, brick 9.6 mm, minifigure about 40 mm tall and 2 studs wide.

Choose 3 studs per 16-pixel tile (1 stud = 16/3 ≈ 5.33 pixels).

  • A minifigure is then about 27 pixels tall, close to the 22–24-pixel ROM soldiers, so actors keep their size relative to the terrain and the readability of the original.
  • Tiles map to whole studs (3×3), so terrain colours and structures snap cleanly.
  • The screen is 42 studs wide; Area 1 is 48 × 1,728 studs (about 83,000 stud columns).
  • A plate is about 1.7 pixels and a brick about 5.1 pixels high, so the current relief heights (hills of roughly 20 pixels) become a dozen plates.

The alternative of 2 studs per tile (1 stud = 8 pixels) gives chunkier terrain but 1.7×-oversized minifigures; keep it as a constant to try in the spike.

Terrain

A new brickGround(ground) builder beside reliefAreaGround / groundMeshes:

  1. Grid. Sample the area per stud cell (5.33 px). Height = relief height of the cell, quantised to plates. Colour = the most common brick colour among the cell's pixels (mode, not average, to avoid mud), from a fixed palette of about 20 colours from LDraw's LDConfig.ldr. The spike showed that nearest-RGB matching turns the arcade's dark olive grass brown, so each pixel is classified by colour family (hue, saturation, value) into a bright brick colour instead (brickColourFor).
  2. Surface type from the tile labels (docs/area1-tile-classes.json): grass and rough ground get studs; roads and paths get smooth tiles (no studs), the classic diorama trick; water sits one plate lower in trans-blue smooth tiles; hazards and trenches go down.
  3. Bricks. Greedy-merge each plate layer into 1×N and 2×N bricks and plates so seams read as brick walls on cliff faces; side faces are emitted only where neighbours are lower.
  4. Rendering. One merged mesh per 64-column chunk for tops and sides (no studs); studs as a single InstancedMesh of a 12-sided cylinder, rebuilt only for the chunks near the camera (about 2,000–4,000 visible studs). This keeps the Quest within budget.
  5. Structures. The raise/sink/cliff rules already shape the heights. Model structures (walls, gates, bunkers, bridges, tower) are brickified from their Blender models (below) and placed as now.

Brickifier (shared by terrain features and structures)

tools/brickify.py, headless Blender: voxelise a mesh on the stud × plate grid, colour each voxel from the nearest face's pen material mapped to the brick palette, greedy-merge into the largest bricks that fit (1×1 to 2×4, plates where needed for height), optionally replace stair-step edges with slopes (phase 2), and emit bevelled bricks with stud instances. Output .glb files under assets/models/brick/ with the same node names and clips as the low-poly model, so moving parts (gate door, palm fronds, gun) keep their pivots.

Actors

  • Soldiers as minifigures. Text files in tools/brick/minifigs/*.ldr list the parts (hips, legs, torso, arms, hands, head, helmet, backpack, rifle) with colours and transforms. Player: blue torso and legs with the yellow bandolier as a torso print or a neck accessory; enemies: torso and leg colours from the $16AD palette schemes, so the existing EnemyScheme still selects them; the $05 soldier carries the cyan bazooka on the left shoulder. Exact helmet, rifle and bazooka part numbers are to be chosen in the spike from the LDraw minifig accessory categories.
  • Rig. A minifigure's joints are the hip (both legs together or each leg), shoulders, wrists and neck; there are no knees or elbows. These map onto our existing pivots. Clips keep their names and lengths (walk, throw, die, dieSink, enter, kneel, glide, travel0a, bazooka*), so CLIP_RULES and MODEL_CLIPS stay valid. Walks become the stiff-legged swing of brick games; deaths still fall forward (the user's rule) and may end by popping apart into a few loose parts, the signature brick-game death.
  • Vehicles and props. Jeep, truck, half-track, troop transport, motorbike, turret, mortar, crate, palm and the river gun are hand-built in Studio from real parts and exported as LDraw; a script converts them with our LDraw reader and adds pivots (gun, doors, fronds) by part groups named in the .ldr file.
  • Projectiles and effects. Shots as 1×1 round plates, grenades as a small part, and explosions as a burst of 1×1 bricks and orange/yellow trans plates using the existing explode clip.

Look

  • Plastic material: MeshPhysicalMaterial with roughness about 0.3 and light clearcoat, lit by the Poly Haven HDRI through PMREM plus the existing sun.
  • Bevelled brick edges in generated geometry and a dark seam between bricks (a small gap or an ambient-occlusion term) so individual bricks read at game distance.
  • Desktop-only extras behind a setting: SSAO and a shallow tilt-shift depth of field for the miniature-film feel. The Quest gets material and lighting only. (Done 2026-10-30 for the brick and toy styles: GTAO and a light tilt-shift, src/render3d/desktop-effects.ts, playlab.html checkbox.)
  • No stud logos.

Integration

  • Style switch. An "Art style" setting (low-poly / brick) in the 3D view. componentArt keeps returning ArtModel; the renderer resolves assets/models/<style>/<model>.glb. The binding test also checks the brick .glb clip lists when they are built.
  • Ground. World3DRenderer builds brickGround instead of the relief meshes when the brick style is on; heights for placing actors come from the same quantised grid.
  • Lab. stage.html and lowpoly.html gain the same switch, plus an LDraw preview via three.js LDrawLoader for checking hand-built .ldr files.

Phases and gates

  1. Spike. The first screen of Area 1 as brick terrain at both scales, one minifigure soldier from LDraw with a walk clip, screenshots beside the arcade frame. Gate: the user picks the scale and approves the look.
  2. Terrain. All of Area 1 bricked, with studs instanced near the camera, smooth paths and water; Area 2 flat-bricked from its tile art. Gate: coverage test (every solid collision pixel still raised) and Quest frame time no worse than the low-poly style.
  3. Minifigure actors. Player and every enemy scheme, all clips, compared with the ROM facings in lowpoly.html.
  4. Brickified structures. Walls, gates, bunkers, bridges, tower, fortress, plane wreck, rocks.
  5. Hand-built props. Palms and every vehicle and emplacement from Studio.
  6. Look and effects. Plastic and HDRI, seams, brick-burst explosions, optional pop-apart deaths, desktop extras.
  7. Quest pass. Measure with the performance readout; reduce stud distance and merge further if needed.

Open decisions for the user

  • Scale: decided, 3 studs per tile.
  • Deaths: decided (2026-10-19): the figure falls forward, then falls apart into its pieces.
  • How literal the colours should be: strict brick palette (recommended) or the ROM palette on brick shapes.

Sources

Implementation notes (2026-10-19)

  • Hand-built props were replaced, for a first complete set, by automatic brickification of the existing low-poly builds (tools/blender_brickify.py). Studio-built vehicles can still replace them one by one under the same file names.
  • The palm uses real LDraw palm parts; its leaves are drawn at half size because the large leaf (2518) would make the crown about three times the arcade palm's width.
  • Trees and bushes painted into the tiles become a tree relief class: flat grass with LDraw trees in the brick style, unchanged relief in the low-poly style.