brickscape 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brickscape-0.1.0/LICENSE +21 -0
- brickscape-0.1.0/PKG-INFO +373 -0
- brickscape-0.1.0/README.md +349 -0
- brickscape-0.1.0/pyproject.toml +39 -0
- brickscape-0.1.0/setup.cfg +4 -0
- brickscape-0.1.0/src/brickscape/__init__.py +11 -0
- brickscape-0.1.0/src/brickscape/__main__.py +66 -0
- brickscape-0.1.0/src/brickscape/catalog/__init__.py +161 -0
- brickscape-0.1.0/src/brickscape/catalog/gobricks.py +146 -0
- brickscape-0.1.0/src/brickscape/catalog/lego.py +72 -0
- brickscape-0.1.0/src/brickscape/config.py +26 -0
- brickscape-0.1.0/src/brickscape/core/__init__.py +1 -0
- brickscape-0.1.0/src/brickscape/core/brick.py +518 -0
- brickscape-0.1.0/src/brickscape/core/free.py +62 -0
- brickscape-0.1.0/src/brickscape/core/geom.py +218 -0
- brickscape-0.1.0/src/brickscape/core/kit.py +888 -0
- brickscape-0.1.0/src/brickscape/core/snaps.py +353 -0
- brickscape-0.1.0/src/brickscape/core/snot.py +52 -0
- brickscape-0.1.0/src/brickscape/core/space.py +51 -0
- brickscape-0.1.0/src/brickscape/io/__init__.py +1 -0
- brickscape-0.1.0/src/brickscape/io/analyze_ref.py +165 -0
- brickscape-0.1.0/src/brickscape/io/export.py +148 -0
- brickscape-0.1.0/src/brickscape/io/lxf.py +125 -0
- brickscape-0.1.0/src/brickscape/plan.py +468 -0
- brickscape-0.1.0/src/brickscape/review/__init__.py +1 -0
- brickscape-0.1.0/src/brickscape/review/appearance.py +122 -0
- brickscape-0.1.0/src/brickscape/review/blender_steps.py +117 -0
- brickscape-0.1.0/src/brickscape/review/blender_view.py +110 -0
- brickscape-0.1.0/src/brickscape/review/instructions.py +158 -0
- brickscape-0.1.0/src/brickscape/review/profile.py +134 -0
- brickscape-0.1.0/src/brickscape/review/render.py +188 -0
- brickscape-0.1.0/src/brickscape/review/views.py +77 -0
- brickscape-0.1.0/src/brickscape/schema.py +166 -0
- brickscape-0.1.0/src/brickscape/server.py +359 -0
- brickscape-0.1.0/src/brickscape/terrain/__init__.py +1 -0
- brickscape-0.1.0/src/brickscape/terrain/facets.py +171 -0
- brickscape-0.1.0/src/brickscape/terrain/greenery.py +570 -0
- brickscape-0.1.0/src/brickscape/terrain/ground.py +340 -0
- brickscape-0.1.0/src/brickscape/terrain/hill.py +235 -0
- brickscape-0.1.0/src/brickscape/terrain/pillars.py +474 -0
- brickscape-0.1.0/src/brickscape/terrain/rock2.py +474 -0
- brickscape-0.1.0/src/brickscape/terrain/rock3.py +453 -0
- brickscape-0.1.0/src/brickscape/terrain/water.py +150 -0
- brickscape-0.1.0/src/brickscape/validate.py +251 -0
- brickscape-0.1.0/src/brickscape.egg-info/PKG-INFO +373 -0
- brickscape-0.1.0/src/brickscape.egg-info/SOURCES.txt +51 -0
- brickscape-0.1.0/src/brickscape.egg-info/dependency_links.txt +1 -0
- brickscape-0.1.0/src/brickscape.egg-info/entry_points.txt +3 -0
- brickscape-0.1.0/src/brickscape.egg-info/requires.txt +6 -0
- brickscape-0.1.0/src/brickscape.egg-info/top_level.txt +1 -0
- brickscape-0.1.0/tests/test_checks.py +67 -0
- brickscape-0.1.0/tests/test_generators.py +19 -0
- brickscape-0.1.0/tests/test_plan.py +71 -0
brickscape-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xanzure
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brickscape
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for designing LEGO builds that can actually be built: terrain generators, strict connection and collision checks, renders, part lists and instructions.
|
|
5
|
+
Author: xanzure
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/xanzure/brickscape
|
|
8
|
+
Project-URL: Repository, https://github.com/xanzure/brickscape
|
|
9
|
+
Project-URL: Issues, https://github.com/xanzure/brickscape/issues
|
|
10
|
+
Keywords: mcp,model-context-protocol,lego,ldraw,bricklink,studio,3d,generative-design
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: numpy>=1.24
|
|
19
|
+
Requires-Dist: pillow>=10
|
|
20
|
+
Requires-Dist: ldraw-mcp>=0.3
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
<p align="center"><img src="https://raw.githubusercontent.com/xanzure/brickscape/main/assets/logo/logo.png" alt="BrickScape spelled in LEGO bricks on a green baseplate with trees, rocks and a stream" width="720"></p>
|
|
26
|
+
|
|
27
|
+
# BrickScape
|
|
28
|
+
|
|
29
|
+
<!-- mcp-name: io.github.xanzure/brickscape -->
|
|
30
|
+
|
|
31
|
+
[](https://github.com/xanzure/brickscape/actions/workflows/tests.yml)
|
|
32
|
+
[](https://glama.ai/mcp/servers/xanzure/brickscape)
|
|
33
|
+
|
|
34
|
+
**Landscape, but for bricks.** An [MCP](https://modelcontextprotocol.io) server that lets an AI
|
|
35
|
+
design LEGO builds that can actually be built.
|
|
36
|
+
|
|
37
|
+
Ask a language model for a LEGO model and you usually get a file with parts floating in the
|
|
38
|
+
air, bricks pushed through each other, and part numbers that don't exist. BrickScape gives the
|
|
39
|
+
model a better way to work: it describes *what* it wants in a short JSON plan (a terraced
|
|
40
|
+
hill here, a cobbled path there, an oak by the stream), and BrickScape places every part on
|
|
41
|
+
real studs, checks the result against the parts' real shapes and connection points, repairs
|
|
42
|
+
what it can, and hands back a BrickLink Studio file, renders, a part list and step-by-step
|
|
43
|
+
instructions.
|
|
44
|
+
|
|
45
|
+
<p align="center"><img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/img/showcase.png" alt="A BrickScape build: a tall grey rock cliff, a stream running past it, a terraced bank with a big oak, a birch, boulders and plants on a green baseplate" width="860"></p>
|
|
46
|
+
<p align="center"><sub>Built by BrickScape from a <a href="https://github.com/xanzure/brickscape/blob/main/examples/showcase.json">seven-operation plan</a>:
|
|
47
|
+
1,466 parts, every one held by a real connection, no two parts intersecting.</sub></p>
|
|
48
|
+
|
|
49
|
+
> **Benchmark** (blind, position-swapped judging against plain Claude on 6 briefs): BrickScape was
|
|
50
|
+
> **8.9x cheaper and 7.9x faster**, **all 6 of its builds pass the strict checker (plain Claude: 0 of 6)**,
|
|
51
|
+
> and it won **accuracy 5-1-0** and **looks 5-1-0** (wins-ties-losses), with average judge scores of
|
|
52
|
+
> 8.2 vs 4.2 and 7.4 vs 4.8 out of 10. [Details](#benchmark).
|
|
53
|
+
|
|
54
|
+
## Contents
|
|
55
|
+
- [How it works](#how-it-works)
|
|
56
|
+
- [Install](#install)
|
|
57
|
+
- [Tools](#tools)
|
|
58
|
+
- [Brick companies](#brick-companies)
|
|
59
|
+
- [Using references](#using-references)
|
|
60
|
+
- [Build plans](#build-plans)
|
|
61
|
+
- [What "buildable" means here](#what-buildable-means-here)
|
|
62
|
+
- [Benchmark](#benchmark)
|
|
63
|
+
- [Command line](#command-line)
|
|
64
|
+
- [Limitations](#limitations)
|
|
65
|
+
- [Credits](#credits)
|
|
66
|
+
|
|
67
|
+
## How it works
|
|
68
|
+
|
|
69
|
+
<p align="center"><img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/img/pipeline.svg" alt="Pipeline: AI client sends a JSON plan; BrickScape compiles, repairs, validates and returns the deliverables" width="860"></p>
|
|
70
|
+
|
|
71
|
+
1. **Plan, don't place.** The client never computes LDraw coordinates. It sends operations
|
|
72
|
+
such as `hill`, `path`, `water`, `tree` or `block` with areas in studs. The compiler turns
|
|
73
|
+
each one into parts using terrain and plant generators written against real building
|
|
74
|
+
techniques (hollow frames, leaning cliff faces, paths set into the ground, leaves on studs).
|
|
75
|
+
A height map means later operations land on top of earlier ones.
|
|
76
|
+
2. **Fit as you go.** Every decorative part (leaves, stems, flowers) is checked against its
|
|
77
|
+
neighbours as it is placed. If it clashes it is turned about its stud, and if no turn fits it
|
|
78
|
+
is left out. Bar-ended stems are slid down their stud until the bar is really held.
|
|
79
|
+
3. **Repair.** After compiling, parts that are loose or clash are removed when nothing depends
|
|
80
|
+
on them, and every part/colour pair that doesn't exist in real LEGO is moved to the nearest
|
|
81
|
+
colour (by perceived colour distance) that does.
|
|
82
|
+
4. **Validate.** The strict checker runs on everything that leaves the server (details
|
|
83
|
+
[below](#what-buildable-means-here)). The report says what was removed, recoloured or still
|
|
84
|
+
fails, and what was *not* checked.
|
|
85
|
+
5. **Deliver.** A Studio `.io` file, four renders from fixed angles, a part list
|
|
86
|
+
(CSV and BrickLink wanted-list XML), and on request PDF instructions.
|
|
87
|
+
|
|
88
|
+
<p align="center"><img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/img/instructions_preview.png" alt="Pages of generated instructions: a cover and three steps, each with a parts box and the build so far" width="860"></p>
|
|
89
|
+
<p align="center"><sub>Generated instructions: the build order follows the connection graph, so every step can really be built.</sub></p>
|
|
90
|
+
|
|
91
|
+
## Install
|
|
92
|
+
|
|
93
|
+
Requires Python 3.10+ and [Blender](https://www.blender.org) 4.x (for renders and instructions).
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install git+https://github.com/xanzure/brickscape
|
|
97
|
+
brickscape setup
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`brickscape setup` downloads the LDraw parts library and the ImportLDraw Blender add-on (through
|
|
101
|
+
[ldraw-mcp](https://github.com/musharna/ldraw-mcp)), the LDCad connection data, and
|
|
102
|
+
Rebrickable's part and colour tables into `~/.cache/brickscape`. None of these are bundled.
|
|
103
|
+
|
|
104
|
+
Add the server to your MCP client:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
claude mcp add brickscape -- brickscape-mcp # Claude Code
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{ "mcpServers": { "brickscape": { "command": "brickscape-mcp" } } }
|
|
112
|
+
```
|
|
113
|
+
(Claude Desktop and other clients: add the block above to the client's MCP config.)
|
|
114
|
+
|
|
115
|
+
| Environment variable | Default | Meaning |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `BRICKSCAPE_OUT` | `./brickscape-out` | where builds are saved |
|
|
118
|
+
| `BRICKSCAPE_SOURCE` | `lego` | default part source: `lego` or `gobricks` |
|
|
119
|
+
| `LDRAW_LIBRARY_PATH` | `~/.ldraw` | LDraw parts library |
|
|
120
|
+
| `LDRAW_MCP_BLENDER` | `blender` on PATH | Blender binary |
|
|
121
|
+
|
|
122
|
+
## Tools
|
|
123
|
+
|
|
124
|
+
| Tool | What it does |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `guide` | The planning guide: coordinates, every operation, style tips, an example. Read first. |
|
|
127
|
+
| `search_parts` | Find parts by description, with availability and colour count at the part source. |
|
|
128
|
+
| `part_info` | A part's size, its connection points (studs, anti-studs, bars, clips, hinges) and real colours. |
|
|
129
|
+
| `build` | Compile a plan, repair it, validate it, save it. Returns the validation report. |
|
|
130
|
+
| `render` | The four standard views (front-left, front-right, back-right, back-left) as one image. |
|
|
131
|
+
| `compare` | The build rendered from a reference photo's viewpoint, side by side with the photo. |
|
|
132
|
+
| `study_reference` | Analyse a reference build (.io / .ldr): size, density, hollowness, SNOT share, colours, most used parts. |
|
|
133
|
+
| `parts_list` | `parts.csv` and `bricklink.xml` (a BrickLink wanted list); prices in GoBricks mode. |
|
|
134
|
+
| `export` | A BrickLink Studio `.io` file. |
|
|
135
|
+
| `instructions` | Step-by-step building instructions as a PDF (plus an `.ldr` with `STEP`s for Studio). |
|
|
136
|
+
| `check` | Strictly validate any `.ldr`, `.mpd` or `.io` file, including ones not made by BrickScape. |
|
|
137
|
+
|
|
138
|
+
## Brick companies
|
|
139
|
+
|
|
140
|
+
BrickScape isn't tied to one brick maker. Every build is checked against a **part source**: the
|
|
141
|
+
list of parts, and of the colours each part comes in, that a company actually makes. Pass
|
|
142
|
+
`source` to `build`, `check`, `search_parts`, `part_info` and `parts_list`, or set
|
|
143
|
+
`BRICKSCAPE_SOURCE`.
|
|
144
|
+
|
|
145
|
+
| Source | Company | What it knows | Data |
|
|
146
|
+
|---|---|---|---|
|
|
147
|
+
| `lego` (default) | LEGO | Every part/colour pair LEGO has produced as an element | Rebrickable's free downloads, fetched by `brickscape setup` |
|
|
148
|
+
| `gobricks` | GoBricks / Brickwith | GoBricks moulds, the colours each is sold in, prices | a GoBricks catalog file in `~/.cache/brickscape/gobricks` (not distributed) |
|
|
149
|
+
|
|
150
|
+
What changes with the source:
|
|
151
|
+
- **Validation:** parts the company doesn't make, and colours a part doesn't come in, are
|
|
152
|
+
reported. A part that GoBricks makes under a different mould number is matched to it.
|
|
153
|
+
- **Repair:** a colour that doesn't exist for a part is swapped for the closest colour that
|
|
154
|
+
does at *that* company, so a GoBricks build only uses GoBricks colours.
|
|
155
|
+
- **Parts lists:** GoBricks mode adds a price for each part and an estimated total.
|
|
156
|
+
- **Search:** `search_parts` and `part_info` show availability and colours for that company.
|
|
157
|
+
|
|
158
|
+
Adding another company (Mould King, Cada, BrickLink stock, your own collection) is one small
|
|
159
|
+
class in `src/brickscape/catalog/` with four methods: `resolve(part)`, `colours(part)`,
|
|
160
|
+
`price(part)` and `substitute(part)`.
|
|
161
|
+
|
|
162
|
+
## Using references
|
|
163
|
+
|
|
164
|
+
You can give the builder reference pictures or reference builds, and it uses them to get much
|
|
165
|
+
closer to what you want. Hand your AI client a photo or a Studio `.io` / `.ldr` along with the brief:
|
|
166
|
+
|
|
167
|
+
- **Photos:** the client reads the layout from the picture (where the rock, water and trees are,
|
|
168
|
+
roughly how big in studs), plans it, then uses `compare` to look at its build from the photo's
|
|
169
|
+
viewpoint next to the photo and fix the biggest differences.
|
|
170
|
+
- **Builds:** `study_reference` measures the reference (footprint, height, parts per stud, how
|
|
171
|
+
hollow it is, colours, the parts it relies on) so the client can match its proportions,
|
|
172
|
+
palette and techniques instead of guessing.
|
|
173
|
+
|
|
174
|
+
The benchmark includes a reference prompt for exactly this ([below](#benchmark)).
|
|
175
|
+
|
|
176
|
+
## Build plans
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"name": "forest clearing",
|
|
181
|
+
"board": {"width": 32, "depth": 32},
|
|
182
|
+
"seed": 1,
|
|
183
|
+
"ops": [
|
|
184
|
+
{"op": "hill", "area": {"ellipse": [22, 24, 9, 7], "rough": 0.5}, "height": 8, "style": "terraces"},
|
|
185
|
+
{"op": "hill", "area": {"ellipse": [6, 26, 5, 4]}, "height": 12, "style": "rock"},
|
|
186
|
+
{"op": "path", "points": [[0, 10], [14, 13], [31, 9]], "width": 3, "style": "cobble"},
|
|
187
|
+
{"op": "boulder", "at": [[12, 3, 4], [20, 4, 2]]},
|
|
188
|
+
{"op": "tree", "kind": "oak", "size": "medium", "at": [27, 4]},
|
|
189
|
+
{"op": "scatter", "area": {"rect": [0, 0, 32, 32]}, "kinds": ["tuft", "flower", "bush"], "density": 0.06}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Coordinates are studs: `x` runs left to right, `z` from the front edge (0) to the back; heights
|
|
195
|
+
are plates (3 plates = 1 brick). Boards of any size work: multiples of 16 get baseplates,
|
|
196
|
+
other sizes a floor of plates.
|
|
197
|
+
|
|
198
|
+
| Operation | Builds |
|
|
199
|
+
|---|---|
|
|
200
|
+
| `hill` | Raised ground: `terraces` (grass treads, earth and stone risers) or `rock` (an outcrop with cliff faces that lean back, grass on top). |
|
|
201
|
+
| `block` | A raised area built like real LEGO: hollow brick frame, crossed plate decks, tiles, studs or grass on top. |
|
|
202
|
+
| `path` | A cobbled or dirt path set into the ground, with raised verges. |
|
|
203
|
+
| `water` | A stream along points or a pond over an area: smooth tiles, ripples, banks raised 1-2 plates. |
|
|
204
|
+
| `boulder` | Rounded boulders of 1, 2, 4 or 6 studs. |
|
|
205
|
+
| `tree` | Oak (small, medium, tall, fat, big), birch, pine, palm, cypress; moves up to 2 studs to find room. |
|
|
206
|
+
| `plant` / `scatter` | Single plants, or plants scattered over an area: tufts, flowers, bushes, ferns, reeds, bamboo, cactus, succulents, stones, trees. |
|
|
207
|
+
| `brick` | One part at an exact stud position. |
|
|
208
|
+
| `ldraw` | Raw LDraw part lines, for anything the generators don't cover (still validated). |
|
|
209
|
+
|
|
210
|
+
Areas are `rect`, `ellipse`, `polygon` or a `cells` list, with an optional `rough` edge.
|
|
211
|
+
|
|
212
|
+
## What "buildable" means here
|
|
213
|
+
|
|
214
|
+
The checker works on the parts' real geometry, not their bounding boxes:
|
|
215
|
+
|
|
216
|
+
| Check | How |
|
|
217
|
+
|---|---|
|
|
218
|
+
| Real parts | Every part exists in the LDraw library and at the part source. |
|
|
219
|
+
| Real colours | Every part/colour pair exists (LEGO: produced elements; GoBricks: sold colours). |
|
|
220
|
+
| Rotations | Proper rotations only: no mirrored or scaled parts. |
|
|
221
|
+
| No duplicates | No two identical parts in the same place. |
|
|
222
|
+
| No intersections | Each part's mesh is ray-cast into a stack of solid boxes (1.25 LDU columns, hollow undersides and tubes kept hollow). Two parts clash if they interpenetrate deeper than 0.8 LDU. Leaves may rest on each other up to 4 LDU, since real leaves bend. |
|
|
223
|
+
| Connected | Typed connection points from the [LDCad shadow library](https://github.com/RolandMelkert/LDCadShadowLibrary): studs into anti-studs, bars into holes and clips, hinge fingers, pins and balls. A connection needs coaxial, overlapping, size-compatible points of opposite gender. Every part must reach the baseplate through these connections. |
|
|
224
|
+
|
|
225
|
+
It does **not** check balance under gravity or how firmly parts clutch, and it says so in every
|
|
226
|
+
report.
|
|
227
|
+
|
|
228
|
+
The checker was tuned on real models made by human designers in BrickLink Studio (their
|
|
229
|
+
remaining reports are mostly parts the connection data doesn't cover, such as some flower
|
|
230
|
+
stems), and it immediately found real problems in this project's own earlier generators:
|
|
231
|
+
|
|
232
|
+
<p align="center"><img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/img/collisions_before_after.svg" alt="Bar chart: intersecting part pairs before and after the fit-aware placement rewrite. Terraced hill 89 to 9, rolling hills 63 to 13, rock cliff 27 to 0, river 5 to 4" width="560"></p>
|
|
233
|
+
|
|
234
|
+
Those remaining pairs are what the repair step then removes. All 25 plant and rock generators
|
|
235
|
+
pass the strict check on their own (`pytest`).
|
|
236
|
+
|
|
237
|
+
## Benchmark
|
|
238
|
+
|
|
239
|
+
Does an AI design better LEGO with BrickScape than without it? Six briefs, each built twice by
|
|
240
|
+
fresh Claude Code sessions (one with BrickScape, one without), then scored with blind,
|
|
241
|
+
position-swapped judging. Run `v1`, 2026-11-27.
|
|
242
|
+
|
|
243
|
+
### Results
|
|
244
|
+
|
|
245
|
+
| | BrickScape | plain Claude |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| total build time (6 builds) | **21.5 min** | 170.5 min (**7.9x** longer) |
|
|
248
|
+
| total cost, API-equivalent | **$2.06** | $18.35 (**8.9x** more) |
|
|
249
|
+
| builds passing the strict checker | **6 / 6** | 0 / 6 |
|
|
250
|
+
| accuracy (wins-ties-losses for BrickScape) | **5-1-0**, average score **8.2** / 10 | 4.2 / 10 |
|
|
251
|
+
| looks (wins-ties-losses for BrickScape) | **5-1-0**, average score **7.4** / 10 | 4.8 / 10 |
|
|
252
|
+
| efficiency (cheaper and faster) | **6-0-0** | |
|
|
253
|
+
|
|
254
|
+
Win rate / win-or-tie rate: efficiency 100% / 100%, accuracy 83% / 100%, looks 83% / 100%.
|
|
255
|
+
|
|
256
|
+
<p align="center">
|
|
257
|
+
<img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/bench/cost.svg" alt="Cost per build in US dollars for each prompt, BrickScape against plain Claude" width="560">
|
|
258
|
+
<img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/bench/minutes.svg" alt="Minutes per build for each prompt, BrickScape against plain Claude" width="560">
|
|
259
|
+
</p>
|
|
260
|
+
<p align="center">
|
|
261
|
+
<img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/bench/scores.svg" alt="Average judge score out of 10 for accuracy and looks" width="560">
|
|
262
|
+
<img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/bench/validity.svg" alt="Share of builds passing the strict checker: BrickScape 100 percent, plain Claude 0 percent" width="560">
|
|
263
|
+
</p>
|
|
264
|
+
|
|
265
|
+
| prompt | kind | cheaper | faster | accuracy (scores) | looks (scores) | BrickScape: parts, valid, min, $ | plain: parts, valid, min, $ |
|
|
266
|
+
|---|---|---|---|---|---|---|---|
|
|
267
|
+
| big-tree-16 | constrained | 12.4x | 10.2x | win (8.5 vs 3.0) | tie (6.5 vs 6.5) | 180, yes, 3.0, 0.31 | 127, no, 30.6, 3.86 |
|
|
268
|
+
| cliff-grey-green | constrained | 5.2x | 5.4x | tie (6.5 vs 7.5) | win (7.0 vs 2.0) | 910, yes, 2.7, 0.29 | 120, no, 14.6, 1.50 |
|
|
269
|
+
| forest-stream | broad | 9.0x | 6.1x | win (8.5 vs 2.5) | win (7.5 vs 5.5) | 665, yes, 3.9, 0.34 | 103, no, 23.9, 3.02 |
|
|
270
|
+
| garden-20 | constrained | 5.0x | 5.4x | win (9.0 vs 2.5) | win (8.0 vs 5.0) | 229, yes, 4.6, 0.47 | 121, no, 25.0, 2.36 |
|
|
271
|
+
| lakeside | broad | 11.3x | 8.4x | win (8.5 vs 5.0) | win (8.0 vs 4.5) | 518, yes, 3.7, 0.32 | 82, no, 30.9, 3.61 |
|
|
272
|
+
| mountain-pass | broad | 12.1x | 12.6x | win (8.0 vs 4.5) | win (7.5 vs 5.5) | 1868, yes, 3.6, 0.33 | 220, no, 45.5, 3.99 |
|
|
273
|
+
|
|
274
|
+
<p align="center"><img src="https://raw.githubusercontent.com/xanzure/brickscape/main/docs/bench/pairs.png" alt="Front-left renders of all six benchmark prompts: BrickScape's build on the left, plain Claude's on the right" width="760"></p>
|
|
275
|
+
<p align="center"><sub>Every benchmark build from the same front-left camera: BrickScape left, plain Claude right.</sub></p>
|
|
276
|
+
|
|
277
|
+
What the judges said, in short: plain Claude's builds are much simpler (a flat blue slab for a
|
|
278
|
+
lake, a single grey wall for a cliff, columns for a mountain pass) and none of them is
|
|
279
|
+
buildable as delivered: every one has intersecting or floating parts, or colours LEGO doesn't
|
|
280
|
+
make. The two ties are fair calls: on the cliff, one judge felt BrickScape's rock spread over the
|
|
281
|
+
whole board instead of forming a clear wall along the back; on the big tree, each judge
|
|
282
|
+
preferred a different tree.
|
|
283
|
+
|
|
284
|
+
Costs are Claude Code's API-equivalent estimates per session; with a Claude subscription they
|
|
285
|
+
count against the plan's usage instead of being billed.
|
|
286
|
+
|
|
287
|
+
### Prompts
|
|
288
|
+
|
|
289
|
+
[bench/prompts.json](https://github.com/xanzure/brickscape/blob/main/bench/prompts.json): three broad briefs, three with
|
|
290
|
+
constraints, and one recreation from a reference photo.
|
|
291
|
+
|
|
292
|
+
| id | kind | brief |
|
|
293
|
+
|---|---|---|
|
|
294
|
+
| forest-stream | broad | A small forest clearing with a stream running through it. |
|
|
295
|
+
| mountain-pass | broad | A rocky mountain pass with a path winding between the rocks. |
|
|
296
|
+
| lakeside | broad | A peaceful lakeside scene with a rocky shore and some trees. |
|
|
297
|
+
| garden-20 | constrained | On a 20 x 20 flat space: a garden with a pond, flower beds and a path; at most 400 parts. |
|
|
298
|
+
| cliff-grey-green | constrained | On 32 x 16: a cliff along the back at least 4 bricks tall; only grey and green parts. |
|
|
299
|
+
| big-tree-16 | constrained | On 16 x 16: one large tree with roots and undergrowth; fewer than 250 parts. |
|
|
300
|
+
| waterfall-ref | reference | Recreate the diorama in a photo: a rock cliff with a waterfall, a stream, a large tree. *(in the benchmark, not in run v1 yet)* |
|
|
301
|
+
|
|
302
|
+
The reference photo is ["Waterfall" by Fuchs (MOC-59853)](https://rebrickable.com/mocs/MOC-59853/fuchs/waterfall/)
|
|
303
|
+
on Rebrickable, used with credit as the target for the recreation prompt. Both builders get the
|
|
304
|
+
same photo, and the accuracy judges compare each build against it.
|
|
305
|
+
|
|
306
|
+
### Method
|
|
307
|
+
|
|
308
|
+
Code: [bench/run.py](https://github.com/xanzure/brickscape/blob/main/bench/run.py).
|
|
309
|
+
1. For each prompt, two fresh headless Claude Code sessions get the same brief and the same
|
|
310
|
+
requirements (real parts and colours, physically buildable, deliver `model.ldr`). Each runs
|
|
311
|
+
in its own empty folder with no project instructions, no memory and no other MCP servers.
|
|
312
|
+
One has BrickScape; the other has the same file and shell tools and the LDraw library path.
|
|
313
|
+
2. Both models go through the same renderer (the same four camera angles) and the same strict
|
|
314
|
+
checker.
|
|
315
|
+
3. Each prompt is scored in three categories, each a win, tie or loss for BrickScape:
|
|
316
|
+
- **Efficiency** (measured, no judge): cost and wall-clock time of the build session.
|
|
317
|
+
Cheaper *and* faster is a win, worse on both is a loss, a mix is a tie.
|
|
318
|
+
- **Accuracy** (judged): how closely the build delivers the brief and keeps its limits
|
|
319
|
+
(board size, part count, colours, required features), and whether it can be built. The
|
|
320
|
+
judge sees the renders plus measured facts about each build: size, part count, colours
|
|
321
|
+
used and the strict checker's results.
|
|
322
|
+
- **Looks** (judged): the renders only, nothing else, and the judge is told to score
|
|
323
|
+
appearance alone.
|
|
324
|
+
4. Every judged category uses two fresh Claude sessions with A and B swapped, so the position
|
|
325
|
+
can't decide it: BrickScape wins both rounds = win, one each = tie, neither = loss. A prompt
|
|
326
|
+
where neither side produced a model is left out rather than scored.
|
|
327
|
+
5. Reported per category: **win rate** and **win-or-tie rate**, plus how many builds of each side
|
|
328
|
+
pass the strict checker, and total cost and time.
|
|
329
|
+
|
|
330
|
+
Run it yourself (it resumes where it stopped, e.g. after hitting a usage limit):
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
python bench/run.py --run myrun # build, render, judge, report
|
|
334
|
+
python bench/run.py --run myrun --prompts waterfall-ref
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
The report writes `bench/results/<run>/results.json` and the charts and table in `docs/bench/`.
|
|
338
|
+
|
|
339
|
+
## Command line
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
brickscape guide # the planning guide
|
|
343
|
+
brickscape build examples/forest-clearing.json
|
|
344
|
+
brickscape render forest-clearing # 4 standard views
|
|
345
|
+
brickscape export forest-clearing # Studio .io
|
|
346
|
+
brickscape parts forest-clearing # parts.csv + bricklink.xml
|
|
347
|
+
brickscape instructions forest-clearing # PDF
|
|
348
|
+
brickscape check some_model.io # validate any model
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Limitations
|
|
352
|
+
|
|
353
|
+
- Generators are landscape-focused: terrain, rock, water, paths and plants. Buildings and
|
|
354
|
+
vehicles have to come from `brick` / `ldraw` operations.
|
|
355
|
+
- Connection checking is only as complete as the LDCad data. Parts without detailed data get
|
|
356
|
+
studs on top and anti-studs under their bottom face, and the report lists them.
|
|
357
|
+
- No gravity or clutch-strength check.
|
|
358
|
+
- Studio `.io` export writes the LDraw model (`model.ldr`, LDraw colours) in Studio's encrypted
|
|
359
|
+
zip format; it round-trips through Python's zip reader but has not yet been tested in every
|
|
360
|
+
Studio version.
|
|
361
|
+
|
|
362
|
+
## Credits
|
|
363
|
+
|
|
364
|
+
- [LDraw](https://www.ldraw.org) parts library (CC BY 4.0).
|
|
365
|
+
- [ldraw-mcp](https://github.com/musharna/ldraw-mcp) by Jaret Arnold (MIT): Blender rendering pipeline and setup.
|
|
366
|
+
- [ImportLDraw](https://github.com/TobyLobster/ImportLDraw) by Toby Nelson: the Blender add-on.
|
|
367
|
+
- [LDCad shadow library](https://github.com/RolandMelkert/LDCadShadowLibrary) by Roland Melkert
|
|
368
|
+
(CC BY-SA 4.0): connection data, downloaded at setup.
|
|
369
|
+
- [Rebrickable](https://rebrickable.com/downloads/): part, colour and element tables, downloaded at setup.
|
|
370
|
+
- Benchmark reference photo: ["Waterfall" by Fuchs](https://rebrickable.com/mocs/MOC-59853/fuchs/waterfall/) (MOC-59853).
|
|
371
|
+
|
|
372
|
+
MIT licensed. LEGO is a trademark of the LEGO Group, which does not sponsor or endorse this
|
|
373
|
+
project.
|