A mech game prototype, pushed by GPT-6.2-Astra
agent (cont.)
+0:44exec_commandcat kit/light.py kit/figure.py (+3 more)
command
cat kit/light.py kit/figure.py cat kit/ship.py cat kit/lab/pilotlab.py && cat src/render/palette.ts && cat kit/build.py | head -145 ls -l ~/.local/opt/blender-5.2.3-linux-x64/ && which chromium chromium-browser google-chrome firefox || true ls -ld public/assets/light.glb nproc && free -h && df -h . printenv | rg 'PLAYWRIGHT|CHROM'
result, 687 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 15177) Total output lines: 1025 Warning: truncated output (original token count: 20595) Total output lines: 1291 """Light frames: 6 m machines in the knightmare class (docs/sizes.md, docs/light-frames.md). Same joint names as the striker (src/render/mech.ts JOINTS) plus their own: core (the ejectable cockpit block, with the cockpit seat inside, parent of the backpack and the harkens), harken.L/R (wire anchor launchers at the muzzles) and spinner.L/R (heel wheel axles). Proportions from the knightmare study: hip at 54% of the height, a small head with the crest reaching the full height, long arms (hands hang at about 0.42), a narrow waist. The core block is a quarter of the height tall, as wide as the chest and tops out behind the head. At this size the armour is fewer, larger plates: sculpted shells (two_view cages smoothed with creases) split by real seams, over a dark inner frame with the hip, knee and elbow mechanics showing. Variants: knight the lead frame: armet helm with one visor slit and a raked crest, upswept pauldrons with three lames, long pointed tassets, fenders over the heel wheels, broad float blades line the mass-produced grunt in the accent colour: rounded factsphere helm (domed lids that swing open on hinges), slab chest and pauldrons with louvres, a wide boxy block, stub blades lancer the fast assault frame: swept wedge helm with a long blade crest, prow chest, calf thrusters, folding forearm blades, a long block and swept delta blades Left is +X, the model faces -Y, z up, authored in world rest-pose coordinates. """ from mathutils import Matrix, Vector import bpy from lib import (attach, boolean, circle, clip, copy, cylinder, empty, halves, loft, merge, mirror_x, nozzle, octo, panels, piston, prism, rot, solid, subd, transform, two_view) from figure import pilot from mech import gltf_dir, nozzle_pair, place H = 6.0 # ---- helpers ---------------------------------------------------------------------------------------------- def sc(front, side, top=None, sharp=40, levels=2): """A sculpted shell: a two_view cage, smoothed, creased where its faces meet sharper than `sharp`.""" return subd(two_view(front, side, top), levels, sharp) SWAP = {} # role remap for the frame being built: the grunt wears the accent as its body colour def put(name, bm, role, j, **kw): kw.setdefault("smooth", True) return solid(name, bm, SWAP.get(role, role), j, **kw) def two(name, bm, role, jl, jr, **kw): """The left part and its mirror on the right.""" kw.setdefault("smooth", True) r = mirror_x(bm) role = SWAP.get(role, role) return solid(f"{name}.L", bm, role, jl, **kw), solid(f"{name}.R", r, role, jr, **kw) def centre(bm): return sum((v.co for v in bm.verts), Vector()) / max(len(bm.verts), 1) def split(bm, cuts, gap=.025): return panels(bm, [(Vector(c), Vector(n)) for c, n in cuts], gap) def box(x0, x1, y0, y1, z0, z1): rect = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)] return loft([(z0, rect), (z1, rect)]) def sphere(r, at, n=16, rings=8): import math pts = [] for i in range(1, rings): a = math.pi * i / rings pts.append((at[2] - r * math.cos(a), circle(r * math.sin(a), n, at[0], at[1]))) return subd(loft(pts), 1, 90) def lr(J, part): return J[part, "L"], J[part, "R"] def mat(at, rx=0.0, ry=0.0, rz=0.0): return Matrix.Translation(Vector(at)) @ rot("Z", rz) @ rot("Y", ry) @ rot("X", rx) # ---- skeleton --------------------------------------------------------------------------------------------- def joints(variant): J = {"frame": empty("frame", (0, 0, 0), frame=f"light_{variant}", height=H)} J["pelvis"] = empty("pelvis", (0, 0, 3.3), J["frame"]) J["waist"] = empty("waist", (0, 0, 3.48), J["pelvis"]) J["torso"] = empty("torso", (0, 0, 3.78), J["waist"]) J["neck"] = empty("neck", (0, 0, 5.02), J["torso"]) J["head"] = empty("head", (0, 0, 5.2), J["neck"]) back = CORE[variant]["back"] J["core"] = empty("core", (0, .65, 5.05), J["torso"], ejectable=True) J["cockpit"] = empty("cockpit", (0, .62, 5.05), J["core"]) J["backpack"] = empty("backpack", (0, back + .1, 5.35), J["core"]) for s, sx in (("L", 1), ("R", -1)): J["shoulder", s] = empty(f"shoulder.{s}", (.62 * sx, 0, 4.8), J["torso"]) J["upperarm", s] = empty(f"upperarm.{s}", (.82 * sx, 0, 4.74), J["shoulder", s]) J["forearm", s] = empty(f"forearm.{s}", (.84 * sx, 0, 3.92), J["upperarm", s]) J["hand", s] = empty(f"hand.{s}", (.85 * sx, 0, 3.04), J["forearm", s]) J["grip", s] = empty(f"grip.{s}", (.83 * sx, -.01, 2.86), J["hand", s]) J["thigh", s] = empty(f"thigh.{s}", (.36 * sx, 0, 3.24), J["pelvis"]) J["shin", s] = empty(f"shin.{s}", (.4 * sx, 0, 1.78), J["thigh", s]) J["foot", s] = empty(f"foot.{s}", (.4 * sx, .03, .4), J["shin", s]) J["spinner", s] = empty(f"spinner.{s}", (.4 * sx, .42, .31), J["foot", s]) J["binder", s] = empty(f"binder.{s}", (.42 * sx, back + .14, 5.52), J["backpack"]) return J # ---- the dark inner frame, shared -------------------------------------------------------------------------- def inner(J, n): P, W, T, N = J["pelvis"], J["waist"], J["torso"], J["neck"] put(f"{n}_pelvis_core", loft([(2.98, octo(.4, .38, .1)), (3.2, octo(.64, .48, .14)), (3.46, octo(.56, .44, .12))]), "frame", P, smooth=False, bevel=.015) two(f"{n}_hip_ball", cylinder(.13, .18, .5, 12, axis="x", at=(0, 3.24)), "joint", *lr(J, "thigh")) put(f"{n}_abdomen", loft([(3.36, octo(.42, .36, .1)), (3.6, octo(.36, .32, .09)), (3.92, octo(.46, .4, .11))]), "joint", W, smooth=False, bevel=.012) put(f"{n}_chest_core", loft([(3.8, octo(.5, .42, .12, y=.02)), (4.1, octo(.8, .56, .16)), (4.55, octo(1.0, .64, .18)), (4.92, octo(.92, .58, .16)), (5.06, octo(.46, .36, .1))]), "frame", T, smooth=False, bevel=.015) put(f"{n}_neck_core", cylinder(.085, 4.96, 5.34, 10), "joint", N) put(f"{n}_neck_ring", loft([(5.04, octo(.26, .26, .07)), (5.1, octo(.24, .24, .06))]), "frame", N, smooth=False) # arms two(f"{n}_shoulder_block", loft([(.42, octo(.3, .3, .08, y=4.8)), (.74, octo(.28, .28, .08, y=4.8))], axis="x"), "frame", *lr(J, "shoulder"), smooth=False, bevel=.012) two(f"{n}_trunnion", cylinder(.12, .7, .9, 12, axis="x", at=(0, 4.76)), "joint", *lr(J, "shoulder")) two(f"{n}_upperarm_core", loft([(4.0, octo(.18, .2, .05, x=.83)), (4.66, octo(.2, .22, .055, x=.82))]), "joint", *lr(J, "upperarm"), smooth=False, bevel=.01) two(f"{n}_elbow", cylinder(.11, .73, .93, 12, axis="x", at=(0, 3.92)), "joint", *lr(J, "upperarm")) two(f"{n}_forearm_core", loft([(3.08, octo(.15, .17, .04, x=.85)), (3.86, octo(.18, .2, .05, x=.84))]), "frame", *lr(J, "forearm"), smooth=False, bevel=.01) two(f"{n}_wrist", cylinder(.065, 2.96, 3.1, 10, at=(.85, 0)), "joint", *lr(J, "hand")) # legs two(f"{n}_thigh_core", loft([(1.94, octo(.2, .24, .06, x=.4)), (2.75, octo(.27, .3, .08, x=.4)), (3.12, octo(.25, .27, .07, x=.38))]), "frame", *lr(J, "thigh"), smooth=False, bevel=.012) two(f"{n}_knee", cylinder(.125, .3, .5, 12, axis="x", at=(0, 1.78)), "joint", *lr(J, "shin")) two(f"{n}_shin_core", loft([(.45, octo(.17, .2, .05, x=.4, y=.03)), (1.7, octo(.21, .25, .06, x=.4))]), "frame", *lr(J, "shin"), smooth=False, bevel=.01) two(f"{n}_ankle", cylinder(.09, .33, .47, 10, axis="x", at=(.03, .4)), "joint", *lr(J, "foot")) def hands(J, n, guard="main"): jl, jr = lr(J, "hand") two(f"{n}_palm", loft([(2.86, octo(.12, .2, .03, x=.85)), (3.0, octo(.11, .19, .03, x=.85))]), "frame", jl, jr, smooth=False, bevel=.008) # four fingers in two pairs, slightly curled, a thumb across the front for i, y in enumerate((-.06, .04)): f = loft([(2.88, octo(.07, .08, .02, x=.82, y=y)), (2.78, octo(.068, .075, .02, x=.815, y=y - .005)), (2.68, octo(.06, .07, .018, x=.8, y=y - .02))]) two(f"{n}_fingers{i}", f, "frame", jl, jr, smooth=False, bevel=.006) two(f"{n}_thumb", loft([(2.92, octo(.06, .06, .015, x=.82, y=-.12)), (2.78, octo(.05, .05, .012, x=.81, y=-.15))]), "frame", jl, jr, smooth=False, bevel=.006) two(f"{n}_hand_guard", sc([(.89, 2.82), (.93, 2.84), (.94, 3.02), (.9, 3.04)], [(-.1, 2.82), (.1, 2.82), (.11, 3.02), (-.11, 3.04)]), guard, jl, jr) def spinners(J, n, v, r=.3): """Magnetic hull wheels at the heels, 0.1 of the height across: a dark tyre on a bright rim, carried on one arm from the inner heel so the hub shows outboard. The lead tucks the top of the wheel under a blade-shaped heel.""" for s, sx in (("L", 1), ("R", -1)): sp, F = J["spinner", s], J["foot", s] c = Vector(sp.matrix_world.translation) x, y, z = c put(f"{n}_tyre.{s}", cylinder(r, x - .17, x + .17, 24, axis="x", at=(y, z)), "joint", sp) put(f"{n}_rim.{s}", cylinder(r * .72, x - .178, x + .178, 20, axis="x", at=(y, z)), "frame", sp) put(f"{n}_hub.{s}", cylinder(r * .42, x - .188, x + .188, 12, axis="x", at=(y, z)), "metal", sp) put(f"{n}_hubcap.{s}", cylinder(r * .16, x - .2, x + .2, 8, axis="x", at=(y, z)), "trim", sp) xi = x - .215 * sx put(f"{n}_wheel_arm.{s}", sc([(xi - .035, .2), (xi + .035, .2), (xi + .035, .44), (xi - .035, .44)], [(y - .36, .16), (y - .02, .22), (y + .08, .32), (y, .42), (y - .34, .4)], top=[(xi - .035, y - .38), (xi + .035, y - .38), (xi + .035, y + .1), (xi - .035, y + .1)]), "frame", F) put(f"{n}_wheel_strut.{s}", piston((x - .215 * sx, .06, .44), (x - .215 * sx, y, z), r=.04), "metal", F) if v == "line": put(f"{n}_fender.{s}", sc([(x - .19, .46), (x + .19, .46), (x + .19, .66), (x - .19, .66)], [(y - .3, .54), (y - .12, .66), (y + .2, .64), (y + .34, .44), (y + .22, .46), (y + .06, .56), (y - .2, .5)], top=[(x - .19, y - .3), (x + .19, y - .3), (x + .19, y + .34), (x - .19, y + .34)], sharp=50), "accent", F) if v == "knight": fender = sc([(x - .19, .4), (x + .19, .4), (x + .18, .7), (x - .18, .7)], [(y - .4, .5), (y - .26, .68), (y + .06, .7), (y + .3, .56), (y + .42, .34), (y + .34, .28), (y + .2, .5), (y - .04, .6), (y - .3, .46)], top=[(x - .19, y - .4), (x + .19, y - .4), (x + .17, y + .44), (x - .17, y + .44)], sharp=32) for i, p in enumerate(split(fender, [((0, y + .14, 0), (0, 1, -.6))])): put(f"{n}_fender{i}.{s}", p, "main" if centre(p).y < y + .14 else "accent", F) elif v == "lancer": put(f"{n}_fender.{s}", sc([(x - .19, .44), (x + .19, .44), (x + .18, .66), (x - .18, .66)], [(y - .36, .5), (y - .1, .66), (y + .16, .64), (y + .3, .48), (y + .1, .56), (y - .2, .48)], top=[(x - .19, y - .36), (x + .19, y - .36), (x + .17, y + .3), (x - .17, y + .3)], sharp=32), "accent", F) def harken(J, n, at, pod_role="main", back=.75): """Harken launchers on the core block sides: an armoured pod, a cable reel showing outboard and a clawed anchor seated in the muzzle, firing forward. `at` is the left muzzle. harken.L/R sit at the muzzles and move with the block.""" for s, sx in (("L", 1), ("R", -1)): x, y, z = at[0] * sx, at[1], at[2] C = J["core"] pod = sc([(x - .07 * sx, z - .11), (x + .07 * sx, z - .1), (x + .075 * sx, z + .1), (x - .07 * sx, z + .12)], [(y + .06, z - .1), (back, z - .13), (back, z + .13), (y + .1, z + .12), (y, z + .01)], top=[(x - .07 * sx, y), (x + .05 * sx, y), (x + .075 * sx, y + .12), (x + .075 * sx, back), (x - .07 * sx, back)], sharp=36) put(f"{n}_harken_pod.{s}", pod, pod_role, C) ry = (y + back) / 2 + .08 put(f"{n}_reel.{s}", cylinder(.115, x + .05 * sx, x + .12 * sx, 16, axis="x", at=(ry, z)), "joint", C) put(f"{n}_reel_cap.{s}", cylinder(.06, x + .07 * sx, x + .135 * sx, 10, axis="x", at=(ry, z)), "metal", C) p = Vector((x, y, z)) d = Vector((0, -1, 0)) j = empty(f"harken.{s}", p, C, dir=gltf_dir(d)) J["harken", s] = j put(f"{n}_harken_ring.{s}", place(loft([(0, circle(.1, 14)), (-.05, circle(.094, 14))]), p + Vector((0, .02, 0)), d), "frame", j) put(f"{n}_harken_spike.{s}", place(loft([(0, circle(.055, 8)), (-.09, circle(.06, 8)), (-.22, circle(.008, 8))]), p, d), "metal", j) for k in range(3): prong = loft([(0, octo(.04, .026, .008, y=.06)), (-.08, octo(.034, .024, .007, y=.1)), (-.16, octo(.01, .008, .003, y=.066))]) transform(prong, rot("Z", 120 * k + 90)) put(f"{n}_harken_claw{k}.{s}", place(prong, p, d), "trim", j, smooth=False) # ---- the core block (cockpit), shared shape with variant detail --------------------------------------------- CORE = {"knight": dict(w=1.06, top=5.78, back=1.06, ch=.26, sharp=46), "line": dict(w=1.3, top=5.7, back=1.0, ch=.1, sharp=30), "lancer": dict(w=.96, top=5.66, back=1.2, ch=.28, sharp=55)} def core_block(J, n, v): """The cockpit: a module behind the chest as wide as the shoulders and topping out over the head, a notch at its front for the head. The pilot sits on a bike-style seat inside. The rear face is the hatch, the whole block ejects (the core joint) and carries th…13784 tokens truncated…t def box(x0, x1, y0, y1, z0, z1): return loft([(z0, [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]), (z1, [(x0, y0), (x1, y0), (x1, y1), (x0, y1)])]) def front(outline, y0=-1.0, y1=0.0, k=2): """A cutter from a front outline (x, z), corners rounded, pushed along Y.""" return prism(soft(outline, k), y0, y1, "xz") def side(outline, x0=-1.0, x1=1.0, k=2): """A cutter from a side outline (y, z), corners rounded, pushed along X.""" return prism(soft(outline, k), x0, x1, "yz") def mx(poly, sx): return [(x * sx, z) for x, z in poly] def plate(spec, g, *cutters, sx=1, sharp=80): """A plate: the body grown by g, cut by each cutter in turn.""" bm = form(spec, g, sx, sharp=sharp) for c in cutters: bm = cut(bm, c) return bm def seam(bm, co, no, gap=.008): a, b = halves(bm, co, no, gap) return merge(a, b) def tube(p0, p1, r0, r1=None, lv=1): """A rounded capsule from p0 to p1 (fingers, thumb).""" r1 = r0 if r1 is None else r1 p0, p1 = Vector(p0), Vector(p1) L = (p1 - p0).length bm = loft([(-r0 * .6, ell(r0 * 1.2, r0 * 1.2, n=8)), (0, ell(r0 * 2, r0 * 2, n=8)), (L, ell(r1 * 2, r1 * 2, n=8)), (L + r1 * .7, ell(r1 * 1.1, r1 * 1.1, n=8))]) bm = subd(bm, lv, sharp=89) m = Matrix.Translation(p0) @ Vector((0, 0, 1)).rotation_difference((p1 - p0).normalized()).to_matrix().to_4x4() return transform(bm, m) def mirror(bm, sx): if sx < 0: transform(bm, Matrix.Scale(-1, 4, (1, 0, 0))) bmesh.ops.reverse_faces(bm, faces=bm.faces) return bm # ---- body parts (rest pose), each returns [(joint, role, bmesh), ...] -------------------------------------- TORSO = [S(1.02, .28, .18), S(1.1, .28, .185, y=-.002), S(1.18, .31, .2, y=-.006), S(1.27, .35, .215, y=-.01), S(1.35, .375, .22, y=-.008), S(1.41, .385, .19, y=.0, p=2.6), S(1.455, .32, .15, y=.006), S(1.49, .17, .12, y=.01), S(1.52, .12, .11, y=.01)] PELVIS = [S(.8, .13, .11, y=.005), S(.86, .29, .18), S(.93, .335, .2, y=.004), S(1.0, .3, .185), S(1.08, .28, .18)] def torso(acc): out = [("pelvis", "suit", form(PELVIS)), ("chest", "suit", form(TORSO))] # breastplate: a pec plate each side of a raised spine plate, a marker light at its top for sx in (1, -1): out.append(("chest", "main", plate(TORSO, .014, front(mx([(.036, 1.255), (.14, 1.245), (.172, 1.31), (.17, 1.4), (.11, 1.445), (.036, 1.44)], sx), -1, -.01, k=1)))) out.append(("chest", "accent", plate(TORSO, .022, front([(-.024, 1.22), (.024, 1.22), (.028, 1.45), (-.028, 1.45)], -1, -.04, k=1)))) out.append(("chest", acc, plate(TORSO, .028, front([(-.014, 1.36), (.014, 1.36), (.014, 1.42), (-.014, 1.42)], -1, -.06, k=1)))) # abdomen plate in two halves ab = plate(TORSO, .009, front([(-.085, 1.08), (.085, 1.08), (.1, 1.19), (0, 1.205), (-.1, 1.19)], -1, -.03)) out.append(("chest", "accent", seam(ab, (0, 0, 0), (1, 0, 0), .014))) # high collar, open at the front collar = form([S(1.44, .21, .17, y=.012), S(1.5, .19, .162, y=.014), S(1.565, .16, .148, y=.016)], sharp=40) out.append(("chest", "main", cut(collar, front([(-.035, 1.48), (.035, 1.48), (.05, 1.6), (-.05, 1.6)], -1, -.04, k=1), "DIFFERENCE"))) # life support pack on the back, with a stripe in the accent pack = [S(1.16, .2, .05, y=.12), S(1.2, .25, .08, y=.13), S(1.38, .26, .085, y=.13), S(1.44, .19, .06, y=.115)] out.append(("chest", "main", seam(form(pack, sharp=40), (0, .13, 1.3), (0, 0, 1), .01))) out.append(("chest", "accent", plate(pack, .006, side([(.0, 1.31), (.3, 1.31), (.3, 1.345), (.0, 1.345)], k=0)))) # belt and buckle, small hip plates out.append(("pelvis", "accent", plate(PELVIS, .011, box(-1, 1, -1, 1, .985, 1.035)))) out.append(("pelvis", acc, form([S(.988, .06, .03, y=-.1), S(1.032, .06, .03, y=-.1)], lv=1, sharp=40))) for sx in (1, -1): out.append(("pelvis", "main", plate(PELVIS, .012, front(mx([(.12, .98), (.19, .98), (.19, .88), (.15, .86)], sx)), side([(-.07, .7), (.07, .7), (.07, 1.1), (-.07, 1.1)])))) return out def arm(sx, acc): x = .2 up = [S(1.1, .08, .086, x=x, y=.01), S(1.19, .088, .092, x=x, y=.005), S(1.3, .1, .102, x=x), S(1.4, .112, .11, x=x), S(1.47, .095, .098, x=x)] fore = [S(.86, .055, .066, x=x + .002, y=.01), S(.95, .068, .074, x=x, y=.01), S(1.05, .086, .086, x=x, y=.015), S(1.14, .08, .086, x=x, y=.015)] out = [("upperarm", "suit", form(up, sx=sx)), ("forearm", "suit", form(fore, sx=sx))] # pauldron: a rounded cap over the shoulder in two layers, an accent stripe across it pad = [S(1.31, .11, .125, x=.208, y=.008), S(1.39, .13, .138, x=.208, y=.008), S(1.45, .125, .135, x=.2, y=.008), S(1.495, .08, .1, x=.19, y=.008)] cap = plate(pad, .0, front(mx([(.13, 1.38), (.3, 1.33), (.3, 1.6), (.13, 1.6)], sx)), sx=sx, sharp=60) out.append(("upperarm", "main", seam(cap, (0, 0, 1.425), (0, 0, 1), .01))) out.append(("upperarm", acc, plate(pad, .005, side([(-.013, 1.3), (.013, 1.3), (.013, 1.6), (-.013, 1.6)], k=0), front(mx([(.19, 1.37), (.4, 1.33), (.4, 1.6), (.19, 1.6)], sx), k=0), sx=sx))) # elbow cup and forearm guard on the outer face out.append(("forearm", "joint", form([S(1.1, .065, .05, x=x, y=.046), S(1.15, .072, .06, x=x, y=.05), S(1.19, .055, .04, x=x, y=.044)], sx=sx, sharp=60))) guard = plate(fore, .012, front(mx([(.21, .93), (.4, .93), (.4, 1.07), (.21, 1.08)], sx)), side([(-.035, .9), (.05, .9), (.05, 1.1), (-.035, 1.1)]), sx=sx, sharp=60) out.append(("forearm", "main", guard)) out.append(("forearm", acc, plate(fore, .016, front(mx([(.212, .995), (.4, .995), (.4, 1.015), (.212, 1.015)], sx), k=0), side([(-.025, .9), (.04, .9), (.04, 1.1), (-.025, 1.1)]), sx=sx))) # glove cuff out.append(("forearm", "suit", form([S(.86, .07, .08, x=x + .002, y=.01), S(.915, .074, .082, x=x, y=.01)], sx=sx, sharp=50))) return out def hand(sx, fingers=(20, 15), thumb=10): """Palm, four two-joint fin…5177 tokens truncated…", root, 0.1) for bx in (-.8, .8): solid(f"turret_gun{i}{bx}", cylinder(.35, y - 2, y - 8, 8, axis="y", at=(bx, z + 3.2 * up)), "frame", root, smooth=True) for s, sx, role in (("L", 1, "lamp_red"), ("R", -1, "lamp_green")): solid(f"nav.{s}", box(41.5 * sx - .6, 41.5 * sx + .6, -12, -10, 20, 22), role, root, outline=False) # ---- bow: tube mouth frame and doors ---- mouth = merge(box(-TUBE_W - 2, -TUBE_W, TUBE_Y1 - 2.5, TUBE_Y1 + 1.5, -1, TUBE_H + 1), box(TUBE_W, TUBE_W + 2, TUBE_Y1 - 2.5, TUBE_Y1 + 1.5, -1, TUBE_H + 1), box(-TUBE_W - 2, TUBE_W + 2, TUBE_Y1 - 2.5, TUBE_Y1 + 1.5, TUBE_H, TUBE_H + 2)) solid("mouth_frame", mouth, "hull_dark", root, 0.15) solid("mouth_hazard", merge(box(-TUBE_W - 2.05, -TUBE_W - .4, TUBE_Y1 - 2.6, TUBE_Y1 - 1.6, -1, TUBE_H + 1), box(TUBE_W + .4, TUBE_W + 2.05, TUBE_Y1 - 2.6, TUBE_Y1 - 1.6, -1, TUBE_H + 1)), "hazard", root) for s, sx in (("L", 1), ("R", -1)): d = empty(f"door.{s}", (0, TUBE_Y1 + 6, 0), root, slide=gltf_dir((sx, 0, 0))) x0, x1 = sorted((0, (TUBE_W + .5) * sx)) solid(f"door_panel.{s}", box(x0, x1, TUBE_Y1 + 5.4, TUBE_Y1 + 6.6, -.1, TUBE_H + .1), "hull_dark", d, 0.08) xs = sorted((.0, 1.2 * sx)) solid(f"door_edge.{s}", box(xs[0], xs[1], TUBE_Y1 + 5.2, TUBE_Y1 + 5.4, -.1, TUBE_H + .1), "hazard", d) # ---- launch tube interior ---- solid("tube_deck", box(-TUBE_W, TUBE_W, TUBE_Y1 + 1, TUBE_Y0, 0, .25), "deck", root) solid("tube_rails", merge(box(-1.0, -.6, TUBE_Y1 + 4, TUBE_Y0, .25, .55), box(.6, 1.0, TUBE_Y1 + 4, TUBE_Y0, .25, .55)), "metal", root) solid("tube_edges", merge(box(-TUBE_W, -TUBE_W + .8, TUBE_Y1 + 1, TUBE_Y0, .25, .35), box(TUBE_W - .8, TUBE_W, TUBE_Y1 + 1, TUBE_Y0, .25, .35)), "hazard", root) ribs, lights, strips = [], [], [] y = TUBE_Y0 - 6 while y > TUBE_Y1 + 4: ribs += [box(-TUBE_W, -TUBE_W + .8, y - .6, y + .6, 0, TUBE_H), box(TUBE_W - .8, TUBE_W, y - .6, y + .6, 0, TUBE_H), box(-TUBE_W, TUBE_W, y - .6, y + .6, TUBE_H - 1.0, TUBE_H)] lights += [box(-7.3, -6.7, y - 3.6, y - 2.4, .25, .4), box(6.7, 7.3, y - 3.6, y - 2.4, .25, .4)] y -= 8 for x in (-TUBE_W + .02, TUBE_W - .32): strips.append(box(x, x + .3, TUBE_Y1 + 4, TUBE_Y0, 13.0, 13.4)) solid("tube_ribs", merge(*ribs), "hull_dark", root, 0.08) solid("tube_lights", merge(*lights), "light", root, outline=False) solid("tube_strips", merge(*strips), "light", root, outline=False) for s, sx, role in (("red", -1, "lamp_red"), ("green", 1, "lamp_green")): sig = empty(f"signal.{s}", (2.2 * sx, TUBE_Y0 - 8, TUBE_H - 2.2), root) solid(f"signal_{s}", box(2.2 * sx - .9, 2.2 * sx + .9, TUBE_Y0 - 8.6, TUBE_Y0 - 7.4, TUBE_H - 3, TUBE_H - 1.4), role, sig, outline=False) solid("signal_box", box(-4, 4, TUBE_Y0 - 7.2, TUBE_Y0 - 6.4, TUBE_H - 3.6, TUBE_H - .8), "hull_dark", root, 0.05) # ---- catapult shuttle ---- start = Vector((0, TUBE_Y0 - 6, .55)) sh = empty("shuttle", start, root)287 more lines not shown.
exec_commandsed -n '294,420p' kit/light.py && rg -n 'pilot\(|build_light\(' kit/light.py && cat src/render/eject.ts | head -95 (+2 more)
command
sed -n '294,420p' kit/light.py && rg -n 'pilot\(|build_light\(' kit/light.py && cat src/render/eject.ts | head -95 python - <<'PY' import json,struct from pathlib import Path with Path('public/assets/light.glb').open('rb') as f: f.seek(12);l,typ=struct.unpack('2I',f.read(8));g=json.loads(f.read(l)) ns=g['nodes'] def walk(i,d=0): n=ns[i]; name=n.get('name','') if d<4 or any(expr in name for expr in ('pilot','core','seat','hatch','pack','binder','visor')): print(' '*d,name,n.get('translation','')) for j in n.get('children',[]):walk(j,d+1) for n in g['scenes'][0]['nodes']:walk(n) print('materials',[(x['name'],x.get('pbrMetallicRoughness',{}).get('baseColorFactor')) for x in g['materials']]) PY ~/.local/bin/blender -b --version | head -2 && ls /opt/ms-playwright && cat .gitignore && command -v convert && ls /usr/share/fonts/truetyperesult, 276 lines
Script completed Wall time 0.6 seconds Output: Warning: truncated output (original token count: 3454) Total output lines: 225 [(-.22, 5.3), (-.23, 5.47), (-.19, 5.62), (-.05, 5.72), (.13, 5.69), (.22, 5.5), (.21, 5.3), (.1, 5.23), (-.1, 5.24)], top=[(-.07, -.27), (.07, -.27), (.18, -.15), (.19, .15), (.1, .24), (-.1, .24), (-.19, .15), (-.18, -.15)]) helm = subd(cage, 2, 50) fr, rear = halves(helm, (0, .06, 5.5), (0, 1, -.4), .022) o = put(f"{n}_helm", fr, "main", Hd) boolean(o, two_view([(-.125, 5.4), (.125, 5.4), (.135, 5.52), (-.135, 5.52)], [(-1, 5.4), (-.1, 5.4), (-.1, 5.52), (-1, 5.52)]), role="frame") put(f"{n}_helm_rear", rear, "accent", Hd) put(f"{n}_skull", loft([(5.22, octo(.26, .3, .08)), (5.58, octo(.3, .36, .09))]), "frame", Hd, smooth=False) put(f"{n}_visor", two_view([(-.13, 5.405), (.13, 5.405), (.14, 5.515), (-.14, 5.515)], [(-.17, 5.4), (-.12, 5.4), (-.12, 5.52), (-.17, 5.52)]), "visor", Hd, smooth=False) put(f"{n}_slit", two_view([(-.12, 5.458), (.12, 5.458), (.12, 5.476), (-.12, 5.476)], [(-.185, 5.4), (-.17, 5.4), (-.17, 5.52), (-.185, 5.52)]), "glow_eye", Hd, smooth=False) brow = sc([(-.18, 5.49), (.18, 5.49), (.2, 5.55), (.03, 5.6), (-.03, 5.6), (-.2, 5.55)], [(-.3, 5.485), (-.06, 5.485), (-.06, 5.62), (-.22, 5.61)], top=[(-.21, -.05), (.21, -.05), (.21, -.19), (0, -.32), (-.21, -.19)], sharp=30) put(f"{n}_brow", brow, "main", Hd) put(f"{n}_crest", sc([(-.025, 5.56), (.025, 5.56), (.008, 6.02), (-.008, 6.02)], [(-.2, 5.58), (-.32, 6.0), (-.21, 5.86), (-.02, 5.76), (.1, 5.75), (.08, 5.67), (-.05, 5.6)], sharp=30), "trim", Hd) put(f"{n}_crest_shoe", sc([(-.05, 5.6), (.05, 5.6), (.04, 5.72), (-.04, 5.72)], [(-.2, 5.6), (.02, 5.66), (.02, 5.74), (-.16, 5.72)]), "accent", Hd) for s, sx in (("L", 1), ("R", -1)): horn = loft([(0, octo(.05, .09, .02)), (.2, octo(.04, .06, .015)), (.38, octo(.01, .016, .004))], axis="y") transform(horn, mat((.17 * sx, -.1, 5.58), rx=16, rz=-7 * sx)) put(f"{n}_horn.{s}", horn, "main", Hd, smooth=False, bevel=.005) put(f"{n}_cheek.{s}", sc([(.13 * sx, 5.28), (.18 * sx, 5.32), (.19 * sx, 5.5), (.15 * sx, 5.52)], [(-.14, 5.28), (.06, 5.28), (.08, 5.5), (-.14, 5.52)], top=[(.15 * sx, -.16), (.2 * sx, -.12), (.21 * sx, .08), (.15 * sx, .08)]), "accent", Hd) put(f"{n}_bevor", sc([(-.15, 5.27), (.15, 5.27), (.175, 5.44), (-.175, 5.44)], [(-.2, 5.27), (-.06, 5.27), (-.06, 5.445), (-.29, 5.445), (-.27, 5.36)], top=[(-.16, -.06), (.16, -.06), (.16, -.17), (0, -.27), (-.16, -.17)], sharp=30), "main", Hd) def head_line(J, n, shutters_open=False): """The factsphere head: a rounded helm with a round socket in its face, the sensor sphere inside behind two domed lids. Open, the lids swing out on hinges above and below like a visor and the sphere shows its lens cluster.""" Hd = J["head"] helm = clip(subd(loft([(5.22, octo(.36, .42, .12, y=.02)), (5.4, octo(.48, .52, .16)), (5.58, octo(.44, .5, .16, y=.02)), (5.69, octo(.28, .36, .1, y=.04))]), 2, 60), x=(-.19, .19)) # flat side plates make it a cowl, not a ball for s_, sx in (("L", 1), ("R", -1)): put(f"{n}_cowl.{s_}", sc([(.18 * sx, 5.26), (.215 * sx, 5.28), (.215 * sx, 5.58), (.18 * sx, 5.62)], [(-.16, 5.3), (.12, 5.26), (.2, 5.4), (.16, 5.6), (-.12, 5.62), (-.2, 5.48)], sharp=36), "accent", Hd) parts = split(helm, [((0, 0, 5.6), (0, 0, 1)), ((0, .1, 0), (0, 1, .2))], gap=.02) for i, p in enumerate(parts): c = centre(p) if c.z < 5.6 and c.y < .1: o = put(f"{n}_helm{i}", p, "main", Hd) boolean(o, prism(circle(.15, 16, 0, 5.44), -1, -.05, "xz"), role="frame") else: put(f"{n}_helm{i}", p, "accent" if c.z >= 5.6 else "main", Hd) put(f"{n}_socket", prism(circle(.15, 16, 0, 5.44), -.16, -.04, "xz"), "joint", Hd) put(f"{n}_sphere", sphere(.125, (0, -.1, 5.44)), "sensor", Hd) put(f"{n}_sphere_band", cylinder(.128, 5.43, 5.45, 24, at=(0, -.1)), "frame", Hd, smooth=False) put(f"{n}_lens_ring", cylinder(.055, -.235, -.2, 16, axis="y", at=(0, 5.47)), "frame", Hd) for k, (x, z, r) in enumerate(((0, 5.47, .038), (.06, 5.405, .016), (-.06, 5.405, .016))): put(f"{n}_lens{k}", cylinder(r, -.245, -.22, 14, axis="y", at=(x, z)…1206 tokens truncated…, -.3), (.1, -.42), (0, -.52), (-.1, -.42)], sharp=30), "trim", T) rib = sc([(.03, 3.82), (.17, 3.8), (.32, 4.0), (.36, 4.14), (.03, 4.14)], [(-.32, 3.8), (-.1, 3.8), (-.1, 4.14), (-.38, 4.14)], top=[(.03, -.1), (.42, -.1), (.42, -.24), (.2, -.36), (.03, -.4)], sharp=34) for i, p in enumerate(split(rib, [((0, 0, 3.98), (0, 0, 1))], gap=.02)): 853:def build_light(variant="knight", n=None, shutters_open=False): 901: frame = build_light(v, f"{v[0]}{i}", shut) 907: pilot(slot, at=(-1.35, -.4)) import * as THREE from 'three'; import { EJECT, beaconLit, hulksOf, ridden, type Capsule } from '../sim/eject'; import type { EjectEvent } from '../sim/eject'; import { FRAMES, STANDARD_HEIGHT } from '../sim/frames'; import type { World } from '../sim/world'; import { find, model, nodes } from './assets'; // Ejected pilots and the wrecks they leave (src/sim/eject.ts). At the moment of ejection the player's // frame model is copied as it stands: the copy is the hulk, and for a light frame its core block (the // `core` node and everything on it, kit/light.py) comes off the copy and flies as its own object. A // standard or heavy fires the escape pod (kit/escape_pod.py). Each capsule gets a motor plume for its // first moments and a red beacon that blinks with the sim's beacon clock. Reads the sim, never writes. /** Mech centre above its feet at striker size, as in game.ts. */ const CENTRE = 9.5; const centreOf = (h: number) => (CENTRE * h) / STANDARD_HEIGHT; /** Seconds the ejection motor burns, as drawn. */ const BURN = 1.0; const DOWN = new THREE.Vector3(0, -1, 0); const glow = (color: string, k: number) => new THREE.MeshBasicMaterial({ color: new THREE.Color(color).multiplyScalar(k), transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, toneMapped: false, }); /** A soft round glow for the beacon's halo, so it reads far off. */ const HALO = (() => { const c = document.createElement('canvas'); c.width = c.height = 64; const g = c.getContext('2d')!; const r = g.createRadialGradient(32, 32, 0, 32, 32, 32); r.addColorStop(0, 'rgba(255,255,255,1)'); r.addColorStop(0.25, 'rgba(255,120,110,0.8)'); r.addColorStop(1, 'rgba(255,40,30,0)'); g.fillStyle = r; g.fillRect(0, 0, 64, 64); return new THREE.CanvasTexture(c); })(); interface CapsuleView { root: THREE.Object3D; /** The model's own beacon lamps, shown when lit. */ lamps: THREE.Object3D[]; halo: THREE.Sprite; plume: THREE.Mesh; /** World direction the motor threw it, for the plume. */ dir: THREE.Vector3; } /** The pilot's eye in the capsule, from its centre: in the core block where the light cockpit puts * it (kit/light.py cockpit node plus game.ts COCKPITS eye), in a pod a little over the middle. */ const EYE = { block: new THREE.Vector3(0, 0.18, 0.37), pod: new THREE.Vector3(0, 0.2, -0.1) }; /** * The capsule the pilot rides, for the camera: puts `eye` where the pilot's head is and returns how * long it has been out and how far the wreck orbit should stand off (in striker units). Null in a frame. */ export function capsuleView(w: World, eye: THREE.Object3D): { age: number; size: number } | null { const c = ridden(w); if (!c || w.wreck <= 0) return null; eye.position.copy(EYE[c.kind]).applyQuaternion(c.rot).add(c.pos); eye.quaternion.copy(c.rot); return { age: c.age, size: c.radius * 0.2 }; } export class EjectRigs { readonly group = new THREE.Group(); private hulks = new Map<number, THREE.Object3D>(); private capsules = new Map<number, CapsuleView>(); private pod: THREE.Object3D | null = null; private plumeGeo = (() => { // a cone from its tip at the origin, opening along -Y const g = new THREE.ConeGeometry(0.55, 1, 12, 1, true); g.translate(0, -0.5, 0); return g; })(); private plumeMat = glow('#ffb36e', 2.6); /** Hide the capsule the pilot rides (its inside is the cockpit view). */ hideRidden = false; private constructor() { this.group.name = 'eject'; } static async load() { const rigs = new EjectRigs(); rigs.pod = await model('escape_pod'); return rigs; } /** * The frame just ejected: copy `mech` (the player's frame model as drawn now) as the hulk and * make the capsule's model. `mech` is placed with its feet `centre` m under the sim's frame centre. */ eject(e: Extract<EjectEvent, { kind: 'eject' }>, w: World, mech: THREE.Object3D) { const cap = w.capsules.find((c) => c.id === e.capsule); Warning: truncated output (original token count: 1585) Total output lines: 95 frame pelvis [0, 3.299999952316284, 0] k_belt [0, -3.299999952316284, 0] k_cod [0, -3.299999952316284, 0] k_pelvis_core [0, -3.299999952316284, 0] k_rear_tasset.L [0, -3.299999952316284, 0] k_rear_tasset.R [0, -3.299999952316284, 0] k_side_tasset0.L [0, -3.299999952316284, 0] k_side_tasset0.R [0, -3.299999952316284, 0] k_side_tasset1.L [0, -3.299999952316284, 0] k_side_tasset1.R [0, -3.299999952316284, 0] k_tasset0.L [0, -3.299999952316284, 0] k_tasset0.R [0, -3.299999952316284, 0] k_tasset1.L [0, -3.299999952316284, 0] k_tasset1.R [0, -3.299999952316284, 0] k_tasset_edge.L [0, -3.299999952316284, 0] k_tasset_edge.R [0, -3.299999952316284, 0] thigh.L [0.36000001430511475, -0.059999942779541016, 0] k_hip_ball.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh0.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh1.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh2.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh3.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_core.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_hardpoint.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_outer.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_pins.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_plate.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_rear.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_trim.L [-0.36000001430511475, -3.240000009536743, 0] k_thigh_vent.L [-0.36000001430511475, -3.240000009536743, 0] shin.L [0.03999999165534973, -1.4600000381469727, 0] k_shin_core.L [-0.4000000059604645, -1.7799999713897705, 0] thigh.R [-0.36000001430511475, -0.059999942779541016, 0] k_hip_ball.R [0.36000001430511475, -3.240000009536743, 0] k_thigh0.R [0.36000001430511475, -3.240000009536743, 0] k_thigh1.R [0.36000001430511475, -3.240000009536743, 0] k_thigh2.R [0.36000001430511475, -3.240000009536743, 0] k_thigh3.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_core.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_hardpoint.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_outer.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_pins.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_plate.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_rear.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_trim.R [0.36000001430511475, -3.240000009536743, 0] k_thigh_vent.R [0.36000001430511475, -3.240000009536743, 0] shin.R [-0.03999999165534973, -1.4600000381469727, 0] k_shi…253 tokens truncated…1421] k_core2 [0, -5.050000190734863, 0.6499999761581421] k_core3 [0, -5.050000190734863, 0.6499999761581421] k_core4 [0, -5.050000190734863, 0.6499999761581421] k_core5 [0, -5.050000190734863, 0.6499999761581421] k_core6 [0, -5.050000190734863, 0.6499999761581421] k_core7 [0, -5.050000190734863, 0.6499999761581421] k_core8 [0, -5.050000190734863, 0.6499999761581421] k_core9 [0, -5.050000190734863, 0.6499999761581421] k_core10 [0, -5.050000190734863, 0.6499999761581421] k_core11 [0, -5.050000190734863, 0.6499999761581421] k_core_lamp [0, -5.050000190734863, 0.6499999761581421] k_core_rail.L [0, -5.050000190734863, 0.6499999761581421] k_core_rail.R [0, -5.050000190734863, 0.6499999761581421] k_core_ridge [0, -5.050000190734863, 0.6499999761581421] k_core_side0.L [0, -5.050000190734863, 0.6499999761581421] k_core_side0.R [0, -5.050000190734863, 0.6499999761581421] k_core_side1.L [0, -5.050000190734863, 0.6499999761581421] k_core_side1.R [0, -5.050000190734863, 0.6499999761581421] k_core_vent.L [0, -5.050000190734863, 0.6499999761581421] k_core_vent.R [0, -5.050000190734863, 0.6499999761581421] k_hatch [0, -5.050000190734863, 0.6499999761581421] k_hatch_bar [0, -5.050000190734863, 0.6499999761581421] k_chest_core [0, -3.7799999713897705, 0] k_visor [0, -5.199999809265137, 0] k_neck_core [0, -5.019999980926514, 0] k_forearm_core.L [-0.8399999737739563, -3.9200000762939453, 0] k_upperarm_core.L [-0.8199999928474426, -4.739999771118164, 0] k_forearm_core.R [0.8399999737739563, -3.9200000762939453, 0] k_upperarm_core.R [0.8199999928474426, -4.739999771118164, 0] materials [('main', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('trim', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('frame', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('accent', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('joint', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('metal', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('glow_thruster', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('hull', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('lamp_green', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('sensor', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('glow_eye', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1]), ('visor', [0.800000011920929, 0.800000011920929, 0.800000011920929, 1])] Blender 5.2.3 LTS (hash e13b728c6880 built 2026-10-22 01:35:05) Blender 5.2.3 LTS chromium-1200 chromium-1208 chromium-1248 chromium_headless_shell-1200 chromium_headless_shell-1208 chromium_headless_shell-1248 ffmpeg-1011 ffmpeg-1013 firefox-1555 webkit-2370 node_modules/ dist/ review/out/ *.blend1 __pycache__/ # block models are scratch until one is worth keeping public/assets/block_*.glb # worktrees of finished agents, see docs/housekeeping.md .claude/worktrees/ /usr/bin/convert dejavu droid noto ubuntu