Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(verse): the Sovereign, the commander's new default skin, with a trailing cloak and Arc Storm (#954)

Ruben Lütke1608c7b3f6cf
diff --git a/art/verse/characters/README.md b/art/verse/characters/README.md
index 6739fae36d..a1c5a8fb23 100644
--- a/art/verse/characters/README.md
+++ b/art/verse/characters/README.md
@@ -31,6 +31,7 @@ Builds are deterministic (no random numbers, fixed iteration order). Run
| `looks.py`, `looks_gear.py` | what the atlases show (faces, hair, tailoring, armour, drones) |
| `anim.py`, `posing.py` | clips |
| `qa.py`, `lookdev.py`, `check_glb.mjs` | checks and look-development renders |
+| `sovereign.py`, `looks_sovereign.py`, `sovereign_qa.py` | the Sovereign skin, its atlas, its look-dev renders |
Human base body: Blender Studio "Human Base Meshes" v1.4.1 (CC0, see
`art/verse/LICENSES.md`), realistic male and female bodies at their base level only.
@@ -44,6 +45,7 @@ SHA-256.
| `SK_Officer_M.glb`, `SK_Officer_F.glb` | Officer, male 1.78 m / female 1.68 m |
| `SK_Technician.glb` | Engineering technician (male skeleton) |
| `SK_Trooper.glb` | Armoured marine, ambient patrols (male skeleton) |
+| `SK_Sovereign.glb` | The commander's default skin: hooded cowl, robe, open cloak (male skeleton + six cloak bones), see `docs/verse/sovereign.md` |
| `SK_Drone_Companion.glb` | The commander's hovering companion drone (own rig + clips) |
| `SK_Drone_Utility.glb` | Ambient floor drone (own rig + clips) |
| `A_Human_M.glb`, `A_Human_F.glb` | Skeleton + every human clip, per body variant |
diff --git a/art/verse/characters/build.py b/art/verse/characters/build.py
index bfea933dbb..258ef8e1db 100644
--- a/art/verse/characters/build.py
+++ b/art/verse/characters/build.py
@@ -25,9 +25,11 @@ from characters import common as C
from characters import crew
from characters import looks as LK
from characters import looks_gear as LG
+from characters import looks_sovereign as LS
from characters import outfits as O
from characters import paint as PT
from characters import posing as P
+from characters import sovereign as SV
CHARACTERS = {
# id: (variant, builder name, kind)
@@ -35,10 +37,17 @@ CHARACTERS = {
"SK_Officer_F": ("F", "build_officer", "officer"),
"SK_Technician": ("M", "build_technician", "technician"),
"SK_Trooper": ("M", "build_trooper", "trooper"),
+ # The commander's default skin; carries its own skeleton (shared bones + cloak bones).
+ "SK_Sovereign": ("M", "build_sovereign", "sovereign"),
}
# Atlas painters per model kind.
-PAINTERS = {"officer": LK.officer, "technician": LG.technician, "trooper": LG.trooper}
+PAINTERS = {
+ "officer": LK.officer,
+ "technician": LG.technician,
+ "trooper": LG.trooper,
+ "sovereign": LS.sovereign,
+}
# Reference colours per rank tier (sRGB hex). The runtime tints by material name.
TIERS = {
@@ -82,6 +91,8 @@ DEFAULTS = {
# Gunner black, lifted a touch so the suit's seams, harness and pads still read at
# the close game camera under dim room light.
"SK_Technician": {"M_Uniform": "#1f2124", "M_Trim": "#34373c"},
+ # pale, aged skin under the hood
+ "SK_Sovereign": {"M_Skin": "#b9a99c"},
}
@@ -190,9 +201,10 @@ def main(argv):
entries = []
for cid in only:
variant, builder, kind = CHARACTERS[cid]
- fn = getattr(O, builder, None) or getattr(crew, builder)
+ fn = getattr(O, builder, None) or getattr(crew, builder, None) or getattr(SV, builder)
ctx = ctxs.get(variant) or ctxs.setdefault(variant, O.Ctx(variant))
ctx.hi, ctx.look = None, {} # set by the builder for its own garment
+ ctx.export_arm = None # a builder with its own skeleton sets it
objs = fn(ctx)
for o in objs:
o.name = o.name.split(".")[0]
@@ -207,7 +219,8 @@ def main(argv):
)
apply_defaults(cid, objs)
with slot_names(cid):
- size = export_glb(out / f"{cid}.glb", [ctx.arm] + objs, animations=False)
+ rig = ctx.export_arm or ctx.arm
+ size = export_glb(out / f"{cid}.glb", [rig] + objs, animations=False)
mats, tris = mesh_info(objs)
built[cid] = (ctx, objs)
print(f"[characters] {cid}: {tris} tris, {size} bytes, materials {mats}")
@@ -226,6 +239,10 @@ def main(argv):
"defaults": DEFAULTS.get(cid, {}),
}
)
+ if ctx.export_arm is not None:
+ entries[-1]["extraBones"] = [
+ b.name for b in ctx.export_arm.data.bones if b.name not in ctx.bones
+ ]
plate = next((o for o in objs if o.name == "RankPlate"), None)
if plate is not None:
entries[-1]["rankPlate"] = rank_plate_socket(plate)
@@ -257,6 +274,7 @@ def main(argv):
from characters import qa
qa.contact_sheet(built, ctxs, full=not args.qa_contact)
+ return built
def write_manifest(out: Path, entries, clip_info, ctxs):
diff --git a/art/verse/characters/looks_sovereign.py b/art/verse/characters/looks_sovereign.py
new file mode 100644
index 0000000000..df09ecb677
--- /dev/null
+++ b/art/verse/characters/looks_sovereign.py
@@ -0,0 +1,110 @@
+"""What the Sovereign's atlas shows: an aged pale face, black velvet, embroidered gold."""
+
+from __future__ import annotations
+
+import numpy as np
+
+from characters import looks as LK
+from characters.paint import band, fbm, groove, mul, rough, smooth
+
+
+def aged_face(surf, an):
+ """Deep lines on a pale face: forehead, crow's feet, nasolabial folds, sunken eyes."""
+ P, N = surf.P, surf.N
+ sk = surf.m("M_Skin") & (P[:, 2] > an.neck_z + 0.01)
+ if not sk.any():
+ return
+ f = an.face
+ X, Z = P[:, 0], P[:, 2] - an.ez
+ ax = np.abs(X)
+ front = smooth(-0.05, -0.35, N[:, 1])
+ # pallor: cool, slightly grey, blotchy
+ mul(surf, sk, (0.92, 0.9, 0.92), 0.6 * fbm(P, 0.012, 3, 41))
+ # brows: thin and grey, not the painted dark arches of the young crew
+ bx = (ax - (an.ex + 0.002)) / (0.022 * an.s)
+ arch = f["brow"] + 0.0045 * (1.0 - bx * bx)
+ brow = band(Z - arch, 0.005, 0.002) * (np.abs(bx) < 1.25) * front
+ grey = np.array([0.5, 0.48, 0.47])
+ a = np.where(sk, brow, 0.0)[:, None]
+ surf.albedo = surf.albedo * (1 - a) + a * grey * (0.8 + 0.2 * fbm(P, 0.003, 2, 7))[:, None]
+ # forehead: four long furrows
+ for k in range(4):
+ zc = 0.032 + 0.011 * k + 0.002 * np.sin(X * 60 + k)
+ g = groove(Z - zc, 0.0016) * smooth(0.055, 0.03, ax) * front
+ mul(surf, sk, (0.5, 0.44, 0.45), 0.85 * g)
+ surf.height += np.where(sk, -0.0016 * g, 0.0)
+ # crow's feet: short rays from the outer eye corner
+ u = ax - (an.ex + 0.017)
+ for k in range(3):
+ ray = groove(Z - (k - 1) * 0.006 - 0.25 * u * (k - 1), 0.0011)
+ g = ray * (u > 0) * (u < 0.018) * front
+ mul(surf, sk, (0.66, 0.6, 0.6), 0.7 * g)
+ surf.height += np.where(sk, -0.0011 * g, 0.0)
+ # sunken eyes and bags under them
+ sock = np.exp(-(((ax - an.ex) / 0.022) ** 2 + ((Z + 0.004) / 0.016) ** 2))
+ mul(surf, sk, (0.55, 0.47, 0.5), 0.7 * sock * front)
+ bag = band(Z + 0.016 + 0.08 * (ax - an.ex) ** 2 * 50, 0.002, 0.002)
+ bag *= np.abs(ax - an.ex) < 0.016
+ surf.height += np.where(sk, -0.0006 * bag * front, 0.0)
+ # nasolabial folds: from beside the nose to past the mouth corners
+ zz = np.clip((Z - f["nose_base"]) / (f["mouth"] - 0.02 - f["nose_base"]), 0, 1)
+ xf = 0.019 + 0.012 * zz
+ nl = groove(ax - xf, 0.0025) * (Z < f["nose_base"] + 0.004) * (Z > f["mouth"] - 0.02) * front
+ mul(surf, sk, (0.6, 0.52, 0.52), 0.85 * nl)
+ surf.height += np.where(sk, -0.0022 * nl, 0.0)
+ # age spots on the temples and the scalp line
+ spots = np.clip((fbm(P, 0.006, 2, 17) - 0.62) * 6, 0, 1) * smooth(0.04, 0.07, ax)
+ mul(surf, sk, (0.72, 0.62, 0.55), 0.6 * spots)
+ # thin, bloodless lips
+ lips = band(Z - f["mouth"], 0.006, 0.002) * (ax < f["mouth_hw"] * an.s)
+ mul(surf, sk, (0.82, 0.78, 0.8), 0.6 * lips * front)
+ rough(surf, sk, 0.6, 0.5 * front)
+
+
+def velvet(surf, mask, seed=0):
+ """Black velvet: soft pile noise, rubbed highlights on the fold crests."""
+ if not mask.any():
+ return
+ n = fbm(surf.P, 0.003, 2, 61 + seed)
+ surf.albedo[mask] *= (0.9 + 0.2 * n[mask])[:, None]
+ big = fbm(surf.P, 0.09, 2, 71 + seed)
+ surf.albedo[mask] *= (0.85 + 0.3 * big[mask])[:, None]
+ surf.height += np.where(mask, 0.00015 * n, 0.0)
+
+
+def embroidery(surf, mask):
+ """Gold embroidery: a raised diamond lattice with dark gaps, worn bright on the ridges."""
+ if not mask.any():
+ return
+ P = surf.P
+ a = (P[:, 0] + P[:, 2]) / 0.018
+ b = (P[:, 1] - P[:, 2] + P[:, 0] * 0.3) / 0.018
+ da = np.abs(a - np.round(a))
+ db = np.abs(b - np.round(b))
+ line = np.clip(1.0 - np.minimum(da, db) / 0.12, 0, 1)
+ dots = np.exp(-((da - 0.5) ** 2 + (db - 0.5) ** 2) / 0.01)
+ relief = np.clip(line + 0.8 * dots, 0, 1)
+ surf.height += np.where(mask, 0.0007 * relief, 0.0)
+ mul(surf, mask, (0.45, 0.4, 0.34), 1.0 - relief)
+ rough(surf, mask, 0.22, relief)
+ rough(surf, mask, 0.55, 1.0 - relief)
+ wear = fbm(P, 0.02, 2, 91)
+ mul(surf, mask, (1.08, 1.04, 0.96), 0.4 * wear)
+
+
+def sovereign(ctx):
+ an = LK.Anatomy(ctx)
+ look = ctx.look
+
+ def paint(surf):
+ LK.face(surf, an, beard=False)
+ aged_face(surf, an)
+ LK.hands(surf, an)
+ velvet(surf, surf.m("M_SovRobe"), 0)
+ velvet(surf, surf.m("M_SovCloak"), 1)
+ velvet(surf, surf.m("M_SovLining"), 2)
+ embroidery(surf, surf.m("M_SovTrim") & ~surf.p("Clasp", "Belt"))
+ LK.boots(surf, an, look)
+ LK.belt(surf, buckle="M_SovTrim")
+
+ return paint
diff --git a/art/verse/characters/sovereign.py b/art/verse/characters/sovereign.py
new file mode 100644
index 0000000000..889e284345
--- /dev/null
+++ b/art/verse/characters/sovereign.py
@@ -0,0 +1,673 @@
+"""The Sovereign: the commander's default skin.
+
+A hooded sovereign in a floor-length robe and a heavy open cloak, charcoal black
+with gold piping, glowing amber eyes deep in the hood. Original design.
+
+Pieces (all on the male skeleton):
+- Garment: the base body as the inner robe (pale aged face and hands, bald scalp
+ under the hood), legs kept slim inside the robe skirt.
+- RobeSkirt: floor-length skirt from the waist with deep folds; follows the legs.
+- Sleeves: bell sleeves from the elbow, gold cuff.
+- Mantle: deep hood and shoulder capelet in one shell, gold rim.
+- Cloak: open at the front, from the shoulders to the floor, gold front edges and
+ hem. It hangs on six extra bones (Cloak_{L,C,R}{1,2}, children of Chest) that the
+ game swings with a spring, so the cloak trails when the commander walks.
+- Clasp, belt, boots, glowing eyes.
+
+The extra bones live on the Sovereign's own copy of the skeleton: the shared clips
+never animate them and the other characters never carry them.
+"""
+
+from __future__ import annotations
+
+import math
+
+import bmesh
+import bpy
+import numpy as np
+from mathutils import Matrix, Vector
+from mathutils.bvhtree import BVHTree
+
+from characters import body as B
+from characters import common as C
+from characters import outfits as O
+from characters import paint as PT
+
+# Materials of this skin (names are its own, so the rank tiers never repaint them).
+O.MATERIALS.update(
+ {
+ # black velvet: a strong sheen gives the folds their highlights
+ "M_SovRobe": ((0.014, 0.013, 0.016), 0.8, 0.0, {"sheen": 0.035}),
+ "M_SovCloak": ((0.010, 0.009, 0.012), 0.62, 0.0, {"sheen": 0.05}),
+ "M_SovLining": ((0.075, 0.008, 0.012), 0.48, 0.0, {"sheen": 0.06}),
+ "M_SovTrim": ((0.66, 0.47, 0.17), 0.32, 1.0, {}),
+ "M_SovEye": ((1.0, 0.52, 0.07), 0.4, 0.0, {"emit": 8.0}),
+ }
+)
+PT.UNTEXTURED.add("M_SovEye")
+
+CLOAK_COLUMNS = (("R", -1.0), ("C", 0.0), ("L", 1.0))
+CLOAK_COLUMN_ANGLE = math.radians(98.0)
+CLOAK_OPEN = math.radians(146.0) # half the cloak's arc, measured from the back
+EXTRA_BONES = [f"Cloak_{c}{k}" for c, _ in CLOAK_COLUMNS for k in (1, 2)]
+
+
+def smoothstep(e0, e1, x):
+ return C.smoothstep(e0, e1, x)
+
+
+# --------------------------------------------------------------------- classifier
+
+
+def gaunt(ctx: O.Ctx, p) -> float:
+ """An old face: hollow cheeks and temples, a heavy brow, slack jowls (metres)."""
+ e = ctx.eyes[0]
+ ax, dz = abs(float(p[0])), float(p[2]) - e.z
+ if float(p[1]) > e.y + 0.05:
+ return 0.0
+
+ def bump(cx, cz, sx, sz):
+ return math.exp(-(((ax - cx) / sx) ** 2 + ((dz - cz) / sz) ** 2))
+
+ return (
+ -0.0055 * bump(0.046, -0.052, 0.017, 0.022)
+ - 0.0035 * bump(0.066, 0.018, 0.012, 0.018)
+ + 0.0028 * bump(0.03, 0.02, 0.022, 0.007)
+ + 0.0022 * bump(0.042, -0.112, 0.016, 0.012)
+ ) * ctx.s
+
+
+def classify_sovereign(ctx: O.Ctx, boot_top: float, belt_z: float):
+ V = ctx.V
+ n = len(V)
+ hands, fore, upper_arm, head, _thigh = O._limbs(ctx)
+ t = ctx.tparam
+ labels = ["M_SovRobe"] * n
+ inflate = np.full(n, 0.007)
+ smooth = np.full(n, 4.0)
+ neck_z = ctx.L["neck"].z
+ for i in range(n):
+ z = V[i, 2]
+ if z < boot_top - 0.03:
+ labels[i] = "DELETE"
+ continue
+ if head[i] and z > neck_z + 0.03 * ctx.s:
+ labels[i] = "M_Skin"
+ inflate[i] = gaunt(ctx, V[i])
+ smooth[i] = 0
+ continue
+ if hands[i] or (fore[i] and t[i] > 0.97):
+ labels[i] = "M_Skin"
+ inflate[i] = 0.0
+ smooth[i] = 0
+ continue
+ if fore[i] or upper_arm[i]:
+ inflate[i] = 0.006
+ smooth[i] = 3
+ continue
+ if z < ctx.crotch:
+ # legs inside the robe skirt: slim, so a stride never pushes them through it
+ inflate[i] = -0.004
+ smooth[i] = 6
+ continue
+ smooth[i] = 8
+ inflate[i] = 0.008 if z > belt_z else 0.004
+ return labels, inflate, smooth
+
+
+# ------------------------------------------------------------------------ helpers
+
+
+def grid(bm, rows, closed=False, mat_of=None):
+ """Quads through rows of points (lists of Vectors, same length). Returns the verts."""
+ vs = [[bm.verts.new(p) for p in row] for row in rows]
+ n = len(rows[0])
+ span = n if closed else n - 1
+ for k in range(len(rows) - 1):
+ a, b = vs[k], vs[k + 1]
+ for j in range(span):
+ j2 = (j + 1) % n
+ f = bm.faces.new((a[j], a[j2], b[j2], b[j]))
+ f.material_index = mat_of(k, j) if mat_of else 0
+ return vs
+
+
+def solidify(ob, thickness, offset=-1.0):
+ m = ob.modifiers.new("solid", "SOLIDIFY")
+ m.thickness = thickness
+ m.offset = offset
+ m.use_rim = True
+ m.use_even_offset = False
+ m.material_offset = 0
+ m.material_offset_rim = 0
+ O.apply_mod(ob, m)
+
+
+def weights_from(ob, bones, fn):
+ """Skin weights from `fn(co) -> dict bone -> weight` (top four kept, normalised)."""
+ res = np.zeros((len(ob.data.vertices), len(bones)))
+ idx = {b: k for k, b in enumerate(bones)}
+ for v in ob.data.vertices:
+ for b, w in fn(v.co).items():
+ res[v.index, idx[b]] += w
+ O.set_weights(ob, bones, res)
+
+
+def transfer_rows(ctx: O.Ctx, ob) -> np.ndarray:
+ """The naked body's barycentric weights at the nearest point, per vertex."""
+ O.Ctx.transfer(ctx, ob)
+ res = np.zeros((len(ob.data.vertices), len(ctx.bones)))
+ gi = {vg.index: ctx.bones.index(vg.name) for vg in ob.vertex_groups}
+ for v in ob.data.vertices:
+ for g in v.groups:
+ res[v.index, gi[g.group]] = g.weight
+ return res
+
+
+def torso_measure(ctx: O.Ctx, z: float, half=0.02, x_max=0.3):
+ sel = (np.abs(ctx.V[:, 2] - z) < half) & (np.abs(ctx.V[:, 0]) < x_max)
+ sel &= ~ctx.bone_mask("ForeArm_L", "ForeArm_R", "Hand_L", "Hand_R", "Fingers_L", "Fingers_R")
+ return ctx.V[sel]
+
+
+# ------------------------------------------------------------------------- pieces
+
+
+def robe_skirt(ctx: O.Ctx, belt_z: float):
+ """Floor-length skirt with deep folds; the hem clears the toes at the front."""
+ s = ctx.s
+ pelvis = ctx.bone_mask("Hips", "Spine") | (
+ ctx.bone_mask("UpperLeg_L", "UpperLeg_R") & (ctx.V[:, 2] > ctx.crotch - 0.05)
+ )
+ Vg = ctx.V[pelvis] + ctx.N[pelvis] * 0.012
+ c = Vg[:, :2].mean(axis=0)
+ na = 48
+ zs = [belt_z - 0.01]
+ z_low = 0.03
+ rows = 18
+ for k in range(1, rows):
+ u = k / (rows - 1)
+ zs.append(belt_z - 0.01 - (belt_z - 0.01 - z_low) * u**0.9)
+ rings = []
+ prev = None
+ for k, z in enumerate(zs):
+ pts = Vg[np.abs(Vg[:, 2] - z) < 0.025]
+ if len(pts) >= 24:
+ ang, r = O.polar_radii(pts, c, na, smooth=4)
+ elif prev is None:
+ raise RuntimeError("robe skirt: no pelvis section at the waist")
+ else:
+ ang, r = prev
+ prev = (ang, r)
+ h = k / (len(zs) - 1)
+ # flare, more to the sides and the back (room for the stride), deep folds below the knee
+ fl = 0.14 * s * h**1.4
+ folds = 0.028 * s * h**1.3 * (0.5 + 0.5 * np.sin(ang * 13 + 0.6)) ** 1.6
+ rr = r + 0.014 + fl + folds
+ # front clears the toes: the hem rises a little at the front (ang = -pi/2 is the front)
+ front = np.clip(-np.sin(ang), 0, 1) ** 2
+ zz = z + (0.035 * front + 0.006 * np.sin(ang * 13 + 0.6)) * h**2
+ rings.append(
+ [
+ Vector((c[0] + rad * math.cos(a), c[1] + rad * math.sin(a), zr))
+ for a, rad, zr in zip(ang, rr, zz, strict=True)
+ ]
+ )
+ # a skirt never tucks in on the way down
+ for k in range(1, len(rings)):
+ for i, p in enumerate(rings[k]):
+ q = rings[k - 1][i]
+ dp = Vector((p.x - c[0], p.y - c[1], 0))
+ dq = Vector((q.x - c[0], q.y - c[1], 0))
+ if dp.length < dq.length + 0.001:
+ dp = dp.normalized() * (dq.length + 0.001)
+ p.x, p.y = c[0] + dp.x, c[1] + dp.y
+ hem_in = [
+ Vector((c[0] + (p.x - c[0]) * 0.965, c[1] + (p.y - c[1]) * 0.965, p.z + 0.012))
+ for p in rings[-1]
+ ]
+ bm = bmesh.new()
+ n_rows = len(rings) + 1
+ grid(bm, rings + [hem_in], closed=True, mat_of=lambda k, j: 1 if k >= n_rows - 3 else 0)
+ ob = O.new_obj("RobeSkirt", bm, ["M_SovRobe", "M_SovTrim"])
+ # Skin: at the waist the body's own weights; below, a bell hung from the hips that
+ # both thighs swing together (never one leg alone, which splits a robe into trousers).
+ body = transfer_rows(ctx, ob)
+ hi = ctx.bones.index("Hips")
+ li = ctx.bones.index("UpperLeg_L")
+ ri = ctx.bones.index("UpperLeg_R")
+ z_waist = zs[0]
+ res = np.zeros_like(body)
+ for v in ob.data.vertices:
+ co = v.co
+ lam = smoothstep(z_waist - 0.03, ctx.crotch - 0.02, co.z)
+ sx = C.clamp(co.x / (0.14 * s), -1.0, 1.0)
+ legs = 0.5 * smoothstep(ctx.crotch, 0.3, co.z)
+ row = np.zeros(len(ctx.bones))
+ row[hi] = 1.0 - legs
+ row[li] = legs * (0.5 + 0.35 * sx)
+ row[ri] = legs * (0.5 - 0.35 * sx)
+ res[v.index] = body[v.index] * (1 - lam) + row * lam
+ O.set_weights(ob, ctx.bones, res)
+ return ob
+
+
+def sleeve(ctx: O.Ctx, side: str):
+ """Bell sleeve from above the elbow to just past the wrist, gold cuff."""
+ rig = ctx.rig
+ e = Vector(rig.head(f"ForeArm_{side}"))
+ w = Vector(rig.tail(f"ForeArm_{side}"))
+ sh = Vector(rig.head(f"UpperArm_{side}"))
+ d = (w - e).normalized()
+ down = Vector((0, 0, -1))
+ down = (down - d * down.dot(d)).normalized()
+ x = d.cross(down).normalized()
+ L = (w - e).length
+ ts = [-0.22, -0.1, 0.05, 0.2, 0.36, 0.52, 0.68, 0.84, 0.96, 1.05, 1.1]
+ na = 24
+ rows = []
+ for t in ts:
+ if t < 0:
+ # follow the upper arm back toward the shoulder
+ base = e + (sh - e).normalized() * (-t * (sh - e).length * 0.8)
+ else:
+ base = e + d * (t * L)
+ k = smoothstep(0.25, 1.1, t)
+ r = (0.052 + 0.075 * k**1.4) * ctx.s
+ if t < 0:
+ r = 0.056 * ctx.s
+ droop = 0.05 * k**1.6 * ctx.s
+ ring = []
+ for j in range(na):
+ a = 2 * math.pi * j / na
+ # the opening hangs: more cloth below the arm than above it
+ sag = 1.0 + 0.25 * k * max(0.0, math.cos(a))
+ fold = 1.0 + 0.06 * k * math.sin(a * 5 + 1.0)
+ off = down * (droop + r * sag * fold * math.cos(a)) + x * (r * fold * math.sin(a))
+ ring.append(base + off)
+ rows.append(ring)
+ bm = bmesh.new()
+ nr = len(rows)
+ grid(bm, rows, closed=True, mat_of=lambda k, j: 1 if k >= nr - 2 else 0)
+ ob = O.new_obj(f"Sleeve_{side}", bm, ["M_SovRobe", "M_SovTrim"])
+ solidify(ob, 0.006)
+ # skin: the upper part follows the body, the bell rides the forearm
+ rows_w = transfer_rows(ctx, ob)
+ fi = ctx.bones.index(f"ForeArm_{side}")
+ ui = ctx.bones.index(f"UpperArm_{side}")
+ res = np.zeros_like(rows_w)
+ for v in ob.data.vertices:
+ t = (v.co - e).dot(d) / L
+ lam = smoothstep(0.05, 0.4, t)
+ lam_u = smoothstep(-0.05, -0.4, t)
+ row = rows_w[v.index] * (1 - lam) * (1 - lam_u)
+ row[fi] += lam
+ row[ui] += lam_u * (1 - lam)
+ res[v.index] = row
+ O.set_weights(ob, ctx.bones, res)
+ return ob
+
+
+def core_bvh(ctx: O.Ctx):
+ """The naked body without its arms (rest pose): what garments must stay outside of."""
+ if getattr(ctx, "_core", None) is None:
+ limbs = ("UpperArm", "ForeArm", "Hand", "Fingers", "Thumb")
+ names = [f"{b}_{sd}" for b in limbs for sd in "LR"]
+ arms = ctx.bone_mask(*names)
+ bm = bmesh.new()
+ bm.from_mesh(ctx.naked.data)
+ bm.verts.ensure_lookup_table()
+ dead = [f for f in bm.faces if any(arms[v.index] for v in f.verts)]
+ bmesh.ops.delete(bm, geom=dead, context="FACES")
+ bm.normal_update()
+ ctx._core = BVHTree.FromBMesh(bm)
+ ctx._core_bm = bm
+ return ctx._core
+
+
+def push_out(ctx: O.Ctx, ob, margin: float, z_min=-1.0, z_max=9.0):
+ """Move every vertex closer than `margin` to the body (arms aside) out to `margin`."""
+ bvh = core_bvh(ctx)
+ for v in ob.data.vertices:
+ if v.co.z < z_min or v.co.z > z_max:
+ continue
+ loc, nrm, _i, _d = bvh.find_nearest(v.co)
+ if loc is None:
+ continue
+ d = (v.co - loc).dot(nrm)
+ if d < margin:
+ v.co += nrm * (margin - d)
+
+
+def mantle(ctx: O.Ctx):
+ """Deep cowl: a hood with a drooping point that falls over the shoulders, gold rim."""
+ s = ctx.s
+ ez = ctx.eyes[0].z
+ head = torso_measure(ctx, ez, 0.01, 0.12)
+ hcy = float(0.5 * (head[:, 1].min() + head[:, 1].max()))
+ fd = float(hcy - head[:, 1].min()) # head centre to the face
+ H = ctx.H
+ neck_z = ctx.L["neck"].z
+ sh = ctx.L["shoulder"]
+ chest = torso_measure(ctx, sh.z - 0.08, 0.02, 0.2)
+ ccy = float(0.5 * (chest[:, 1].min() + chest[:, 1].max()))
+ # (z, rx, ry back, ry front, centre y, half-opening at the front (deg), side drop)
+ spec = [
+ (H + 0.085 * s, 0.012, 0.012, 0.012, hcy + 0.085, 0.0, 0.0),
+ (H + 0.072 * s, 0.050, 0.055, 0.050, hcy + 0.055, 0.0, 0.0),
+ (H + 0.048 * s, 0.100, 0.110, 0.105, hcy + 0.030, 0.0, 0.0),
+ (H + 0.012 * s, 0.140, 0.150, 0.150, hcy + 0.012, 0.0, 0.0),
+ (ez + 0.068 * s, 0.160, 0.164, fd + 0.098, hcy, 0.0, 0.0),
+ (ez + 0.044 * s, 0.163, 0.167, fd + 0.098, hcy, 22.0, 0.0),
+ (ez + 0.010 * s, 0.165, 0.170, fd + 0.088, hcy, 33.0, 0.0),
+ (ez - 0.050 * s, 0.165, 0.170, fd + 0.070, hcy, 38.0, 0.0),
+ (ez - 0.118 * s, 0.162, 0.167, fd + 0.048, hcy - 0.004, 36.0, 0.0),
+ (neck_z + 0.000 * s, 0.190, 0.172, 0.165, 0.5 * (hcy + ccy), 30.0, 0.012),
+ (neck_z - 0.040 * s, 0.245, 0.197, 0.178, ccy, 25.0, 0.030),
+ (neck_z - 0.090 * s, 0.295, 0.217, 0.192, ccy, 21.0, 0.060),
+ (neck_z - 0.150 * s, 0.326, 0.230, 0.200, ccy, 19.0, 0.090),
+ (neck_z - 0.215 * s, 0.342, 0.238, 0.206, ccy, 18.0, 0.110),
+ (neck_z - 0.262 * s, 0.350, 0.242, 0.209, ccy, 18.0, 0.118),
+ (neck_z - 0.278 * s, 0.352, 0.243, 0.210, ccy, 18.0, 0.120),
+ ]
+ na = 48
+ rows = []
+ rim_rows = []
+ nlow = len(spec)
+ for k, (z, rx, ryb, ryf, cy, op, drop) in enumerate(spec):
+ half = math.pi - math.radians(max(op, 0.4))
+ g = C.clamp((k - 8) / (nlow - 9), 0, 1)
+ ring = []
+ for j in range(na + 1):
+ a = -half + 2 * half * j / na # 0 = back (+Y), +-pi = front (-Y)
+ ry = ryb if math.cos(a) > 0 else ryf
+ wave = math.sin(a * 9 + 0.4)
+ # soft folds where the cowl lies on the shoulders and the back
+ fold = 1.0 + 0.05 * g * (0.5 + 0.5 * wave) ** 1.5
+ # the cloth falls over the shoulders: lower at the sides than front and back
+ zz = z - drop * s * abs(math.sin(a)) ** 1.4 - 0.012 * g * wave
+ # the hood's brow sags a little forward and down over the eyes
+ if k in (4, 5):
+ zz -= 0.012 * s * max(0.0, -math.cos(a)) ** 4
+ px = rx * fold * math.sin(a) * s
+ ring.append(Vector((px, cy + ry * fold * math.cos(a) * s, zz)))
+ rows.append(ring)
+ rim_rows.append(op > 1.0)
+ nr = len(rows)
+
+ def mat_of(k, j):
+ if k >= nr - 2:
+ return 1 # cowl hem
+ if (j == 0 or j == na - 1) and (rim_rows[k] or rim_rows[k + 1]):
+ return 1 # face rim and the front edges
+ return 0
+
+ bm = bmesh.new()
+ grid(bm, rows, closed=False, mat_of=mat_of)
+ bmesh.ops.remove_doubles(bm, verts=bm.verts[:], dist=0.004)
+ ob = O.new_obj("Mantle", bm, ["M_SovCloak", "M_SovTrim"])
+ sub = ob.modifiers.new("sub", "SUBSURF")
+ sub.levels = 1
+ O.apply_mod(ob, sub)
+ push_out(ctx, ob, 0.022, z_min=neck_z - 0.35)
+ # relax the bumps the shoulders pushed into the cowl, then clear the body again
+ bm = bmesh.new()
+ bm.from_mesh(ob.data)
+ low = [v for v in bm.verts if v.co.z < neck_z - 0.02]
+ for _ in range(8):
+ bmesh.ops.smooth_vert(bm, verts=low, factor=0.5, use_axis_x=True, use_axis_y=True,
+ use_axis_z=True)
+ bm.to_mesh(ob.data)
+ bm.free()
+ push_out(ctx, ob, 0.016, z_min=neck_z - 0.35)
+ solidify(ob, 0.012, offset=0.0)
+ # skin: the hood rides the head, the cowl the chest and the collarbones
+ hz0, hz1 = neck_z - 0.01, neck_z + 0.06 * s
+
+ def w(co):
+ lam = smoothstep(hz0, hz1, co.z)
+ lat = C.clamp(abs(co.x) / (0.3 * s), 0, 1)
+ side = "L" if co.x > 0 else "R"
+ out = {"Head": lam * 0.8, "Neck": lam * 0.2}
+ rest = 1.0 - lam
+ # over the shoulder tip the cloth rides the upper arm, so the deltoid never
+ # pushes through it when the arm swings
+ arm = 0.45 * smoothstep(0.13 * s, 0.24 * s, abs(co.x))
+ out["Chest"] = rest * (1.0 - arm) * (1.0 - 0.45 * lat)
+ out[f"Shoulder_{side}"] = rest * (1.0 - arm) * 0.45 * lat
+ out[f"UpperArm_{side}"] = rest * arm
+ return out
+
+ weights_from(ob, ctx.bones, w)
+ return ob
+
+
+def cloak(ctx: O.Ctx, belt_z: float):
+ """Open cloak from under the cowl to the floor, on the six cloak bones."""
+ s = ctx.s
+ sh = ctx.L["shoulder"]
+ neck_z = ctx.L["neck"].z
+ chest = torso_measure(ctx, sh.z - 0.08, 0.02, 0.2)
+ cy = float(0.5 * (chest[:, 1].min() + chest[:, 1].max()))
+ back = float(chest[:, 1].max())
+ z_top = neck_z - 0.13 * s
+ z_hem = 0.006
+ rows_n = 26
+ na = 56
+ rows = []
+ for k in range(rows_n):
+ u = k / (rows_n - 1)
+ z = z_top - (z_top - z_hem) * u
+ g = u**0.75
+ rx = (0.275 + 0.12 * g) * s
+ ryb = max(back - cy + 0.045, (0.19 + 0.17 * g) * s)
+ ryf = (0.18 + 0.07 * g) * s
+ half = CLOAK_OPEN - math.radians(6) * (1 - g)
+ ring = []
+ for j in range(na + 1):
+ # inset edge columns make a crisp gold strip along the front edges
+ if j == 0:
+ a = -half
+ elif j == na:
+ a = half
+ else:
+ a = -half + 0.04 + (2 * half - 0.08) * (j - 1) / (na - 2)
+ ry = ryb if math.cos(a) > 0 else ryf
+ wave = math.sin(a * 12 + 0.9 + 0.6 * math.sin(a * 5))
+ fold = 1.0 + (0.02 + 0.13 * g**1.1) * (0.5 + 0.5 * wave) ** 1.8
+ # the top edge follows the shoulder slope, well inside the cowl
+ zz = z - 0.07 * s * abs(math.sin(a)) ** 2 * (1.0 - u) ** 3
+ if k == rows_n - 1:
+ # the hem rises to the front edges and trails on the floor at the back
+ zz = z_hem + 0.055 * (abs(a) / half) ** 3 + 0.008 * wave
+ ring.append(Vector((rx * fold * math.sin(a), cy + ry * fold * math.cos(a), zz)))
+ rows.append(ring)
+ # a gold band just above the hem
+ last = rows[-1]
+ prev = rows[-2]
+ band = [p.lerp(q, 0.3) for p, q in zip(last, prev, strict=True)]
+ rows = rows[:-1] + [band, last]
+ nr = len(rows)
+
+ def mat_of(k, j):
+ if k >= nr - 2:
+ return 1
+ if j == 0 or j == na - 1:
+ return 1
+ return 0
+
+ bm = bmesh.new()
+ grid(bm, rows, closed=False, mat_of=mat_of)
+ ob = O.new_obj("Cloak", bm, ["M_SovCloak", "M_SovTrim"])
+ push_out(ctx, ob, 0.03, z_min=0.5, z_max=z_top - 0.12)
+ solidify(ob, 0.009, offset=0.0)
+ # inner face gets the deep red lining
+ _line_inside(ob, cy)
+ return ob, cy, z_top, z_hem, back
+
+
+def _line_inside(ob, cy):
+ """Faces pointing inwards (toward the body axis) wear the lining."""
+ me = ob.data
+ mats = [m.name for m in me.materials]
+ if "M_SovLining" not in mats:
+ me.materials.append(bpy.data.materials["M_SovLining"])
+ li = len(me.materials) - 1
+ trim = mats.index("M_SovTrim")
+ for p in me.polygons:
+ if p.material_index == trim:
+ continue
+ c = p.center
+ radial = Vector((c.x, c.y - cy, 0.0))
+ if radial.length > 1e-6 and p.normal.dot(radial.normalized()) < -0.2:
+ p.material_index = li
+
+
+def add_cloak_bones(arm_ob, cy, z_top, z_hem, belt_z, s):
+ """Six bones the cloak hangs on: three columns (right, centre, left) of two segments."""
+ C.set_active(arm_ob)
+ bpy.ops.object.mode_set(mode="EDIT")
+ eb = arm_ob.data.edit_bones
+ heads = {}
+ for col, sx in CLOAK_COLUMNS:
+ a = sx * CLOAK_COLUMN_ANGLE
+ rx, ry = 0.3 * s, 0.22 * s
+ x = rx * math.sin(a)
+ y = cy + ry * math.cos(a)
+ top = Vector((x * 0.85, y, z_top - 0.02))
+ mid = Vector((x, y + 0.03, belt_z))
+ low = Vector((x * 1.15, y + 0.07, z_hem + 0.05))
+ b1 = eb.new(f"Cloak_{col}1")
+ b1.head, b1.tail = top, mid
+ b1.align_roll(Vector((0, -1, 0)))
+ b1.parent = eb["Chest"]
+ b2 = eb.new(f"Cloak_{col}2")
+ b2.head, b2.tail = mid, low
+ b2.align_roll(Vector((0, -1, 0)))
+ b2.parent = b1
+ b2.use_connect = True
+ heads[col] = (top, mid, low)
+ bpy.ops.object.mode_set(mode="OBJECT")
+ for b in arm_ob.data.bones:
+ b.use_deform = True
+ return heads
+
+
+def skin_cloak(ob, bones, sh_z, belt_z, s):
+ top0, top1 = sh_z - 0.15, sh_z - 0.01
+ ca = CLOAK_COLUMN_ANGLE
+
+ def w(co):
+ a = math.atan2(co.x, co.y) # 0 = back, + = left
+ lam_top = smoothstep(top0, top1, co.z)
+ seg2 = smoothstep(belt_z + 0.1, belt_z - 0.12, co.z)
+ out = {}
+ side = "L" if a > 0 else "R"
+ k = C.clamp(abs(a) / ca, 0, 1)
+ cols = {"C": 1.0 - k, side: k}
+ body = 1.0 - lam_top
+ for col, cw in cols.items():
+ if cw <= 0:
+ continue
+ out[f"Cloak_{col}1"] = out.get(f"Cloak_{col}1", 0) + body * cw * (1 - seg2)
+ out[f"Cloak_{col}2"] = out.get(f"Cloak_{col}2", 0) + body * cw * seg2
+ lat = C.clamp(abs(co.x) / (0.3 * s), 0, 1)
+ out["Chest"] = lam_top * (1.0 - 0.45 * lat)
+ out[f"Shoulder_{side}"] = lam_top * 0.45 * lat
+ return out
+
+ weights_from(ob, bones, w)
+
+
+def clasp(ctx: O.Ctx, edge_ob, z: float):
+ """Two gold discs on the cowl's front edges at the upper chest, joined by a chain."""
+ s = ctx.s
+ me = edge_ob.data
+ pts = [v.co.copy() for v in me.vertices if abs(v.co.z - z) < 0.03]
+ if not pts:
+ return None
+ left = max(pts, key=lambda p: (-p.y if p.x > 0 else -9))
+ right = Vector((-left.x, left.y, left.z))
+ bm = bmesh.new()
+ for p in (left, right):
+ m = Matrix.Translation(p + Vector((0, -0.012, 0))) @ Matrix.Rotation(math.pi / 2, 4, "X")
+ bmesh.ops.create_cone(bm, cap_ends=True, segments=20, radius1=0.026 * s, radius2=0.022 * s,
+ depth=0.012, matrix=m)
+ m2 = Matrix.Translation(p + Vector((0, -0.019, 0))) @ Matrix.Rotation(math.pi / 2, 4, "X")
+ bmesh.ops.create_cone(bm, cap_ends=True, segments=6, radius1=0.011 * s, radius2=0.004 * s,
+ depth=0.008, matrix=m2)
+ # the chain: a slight sag between the discs
+ links = 9
+ for i in range(links):
+ u = (i + 0.5) / links
+ x = right.x + (left.x - right.x) * u
+ sag = 0.035 * s * math.sin(math.pi * u)
+ p = Vector((x, left.y - 0.012 - 0.01 * math.sin(math.pi * u), z - sag))
+ m = Matrix.Translation(p) @ Matrix.Rotation(math.pi / 2 * (i % 2), 4, "X")
+ m = m @ Matrix.Diagonal((1.6, 1.0, 0.7, 1.0))
+ bmesh.ops.create_uvsphere(bm, u_segments=8, v_segments=4, radius=0.0075 * s, matrix=m)
+ ob = O.new_obj("Clasp", bm, ["M_SovTrim"])
+ ctx.rigid(ob, "Chest")
+ return ob
+
+
+# -------------------------------------------------------------------------- build
+
+
+def dull_specular():
+ """Black cloth reads black: a weak, broad specular on the fabrics."""
+ for name, level in (("M_SovRobe", 0.22), ("M_SovCloak", 0.3), ("M_SovLining", 0.35)):
+ bsdf = bpy.data.materials[name].node_tree.nodes["Principled BSDF"]
+ bsdf.inputs["Specular IOR Level"].default_value = level
+
+
+def build_sovereign(ctx: O.Ctx):
+ s = ctx.s
+ dull_specular()
+ boot_top = 0.13 * s
+ belt_z = 0.585 * ctx.H
+ neck_z = ctx.L["neck"].z
+ cut = classify_sovereign(ctx, boot_top, belt_z)
+ garment = O.garment_body(ctx, lambda c: cut, name="Garment")
+ ctx.hi = {"Garment": O.keep_hi(garment, "Hi_Sovereign")}
+ ctx.look = {"belt_z": belt_z, "boot_top": boot_top, "neck_z": neck_z, "female": False}
+ O.decimate_head_aware(garment, ctx, 7000, 2900)
+ parts = [garment]
+ parts.append(O.boots(ctx, boot_top, flare=0.004, inflate=0.006))
+ parts.append(robe_skirt(ctx, belt_z))
+ parts.append(O.belt(ctx, belt_z, height=0.05, out=0.012, buckle=True, mat="M_Belt",
+ buckle_mat="M_SovTrim", pts=B.verts_np(garment)))
+ parts.append(sleeve(ctx, "L"))
+ parts.append(sleeve(ctx, "R"))
+ col = O.collar(ctx, neck_z - 0.004, neck_z + 0.05 * s, out=0.008, mat="M_SovRobe",
+ piping="M_SovTrim")
+ parts.append(col)
+ parts.append(O.eyes(ctx, mat="M_SovEye"))
+ mantle_ob = mantle(ctx)
+ parts.append(mantle_ob)
+ cls = clasp(ctx, mantle_ob, neck_z - 0.14 * s)
+ if cls is not None:
+ parts.append(cls)
+ body = O.finish(ctx, parts, "Body")
+
+ # the Sovereign's own skeleton: the shared one plus the cloak bones
+ arm = ctx.arm.copy()
+ arm.data = ctx.arm.data.copy()
+ arm.name = "SK_Sovereign_Rig"
+ arm.data.name = "SK_Sovereign_Rig"
+ C.link(arm)
+ cl, cy, z_top, z_hem, _back = cloak(ctx, belt_z)
+ add_cloak_bones(arm, cy, z_top, z_hem, belt_z, s)
+ bones = [b.name for b in arm.data.bones]
+ skin_cloak(cl, bones, ctx.L["shoulder"].z, belt_z, s)
+ extra = [cl]
+ for o in extra:
+ O.bake_vertex_ao(o)
+ for o in [body] + extra:
+ o.parent = arm
+ o.matrix_parent_inverse.identity()
+ mod = next((m for m in o.modifiers if m.type == "ARMATURE"), None)
+ mod = mod or o.modifiers.new("Armature", "ARMATURE")
+ mod.object = arm
+ ctx.export_arm = arm
+ return [body] + extra
diff --git a/art/verse/characters/sovereign_qa.py b/art/verse/characters/sovereign_qa.py
new file mode 100644
index 0000000000..96daa7026a
--- /dev/null
+++ b/art/verse/characters/sovereign_qa.py
@@ -0,0 +1,128 @@
+"""Look-development renders of the Sovereign (Cycles, perspective).
+
+ python scripts/verse/blender.py run art/verse/characters/sovereign_qa.py [--no-build]
+
+Builds SK_Sovereign (no clips), then renders front three-quarter, back, side,
+a walk frame and a close-up of the hood into art/verse/.cache/characters/qa/.
+"""
+
+from __future__ import annotations
+
+import math
+import sys
+
+import bpy
+from mathutils import Vector
+
+from characters import anim as A
+from characters import build
+from characters import common as C
+
+QA = C.CACHE / "qa"
+
+
+def lights():
+ sc = bpy.context.scene
+ sc.render.engine = "CYCLES"
+ sc.cycles.device = "GPU"
+ sc.cycles.samples = 96
+ sc.cycles.use_denoising = True
+ sc.view_settings.view_transform = "AgX"
+ sc.view_settings.look = "AgX - Medium High Contrast"
+ world = bpy.data.worlds.new("SovWorld")
+ world.use_nodes = True
+ world.node_tree.nodes["Background"].inputs[0].default_value = (0.012, 0.014, 0.02, 1)
+ sc.world = world
+ fm = bpy.data.materials.new("SovFloor")
+ fm.use_nodes = True
+ b = fm.node_tree.nodes["Principled BSDF"]
+ b.inputs["Base Color"].default_value = (0.02, 0.021, 0.024, 1)
+ b.inputs["Roughness"].default_value = 0.25
+ bpy.ops.mesh.primitive_plane_add(size=40, location=(0, 0, 0))
+ bpy.context.active_object.data.materials.append(fm)
+ for name, loc, energy, col, size in (
+ ("key", (-2.2, -2.6, 3.4), 300, (1.0, 0.93, 0.85), 1.6),
+ ("rim", (2.4, 2.8, 2.6), 420, (0.75, 0.82, 1.0), 1.0),
+ ("fill", (2.6, -2.2, 1.4), 120, (0.8, 0.85, 1.0), 2.5),
+ ):
+ ld = bpy.data.lights.new(f"sov_{name}", "AREA")
+ ld.energy = energy
+ ld.color = col
+ ld.size = size
+ lo = bpy.data.objects.new(f"sov_{name}", ld)
+ lo.location = loc
+ d = Vector((0, 0, 1.1)) - Vector(loc)
+ lo.rotation_euler = d.to_track_quat("-Z", "Y").to_euler()
+ C.link(lo)
+
+
+def camera(target: Vector, yaw_deg: float, dist: float, lens=50.0, height=1.25, res=(900, 1200)):
+ sc = bpy.context.scene
+ cd = bpy.data.cameras.get("sov_cam") or bpy.data.cameras.new("sov_cam")
+ cd.lens = lens
+ cam = bpy.data.objects.get("sov_cam") or C.link(bpy.data.objects.new("sov_cam", cd))
+ yaw = math.radians(yaw_deg)
+ # yaw 0 = in front of the character (Blender -Y)
+ cam.location = target + Vector((math.sin(yaw) * dist, -math.cos(yaw) * dist, height - target.z))
+ cam.rotation_euler = (target - cam.location).to_track_quat("-Z", "Y").to_euler()
+ sc.camera = cam
+ sc.render.resolution_x, sc.render.resolution_y = res
+ sc.render.resolution_percentage = 100
+
+
+def render(name):
+ bpy.context.scene.render.filepath = str(QA / f"{name}.png")
+ bpy.ops.render.render(write_still=True)
+ print(f"[sovqa] {QA / f'{name}.png'}")
+
+
+def main(argv):
+ built = build.main(["--only", "SK_Sovereign", "--no-clips"])
+ ctx, objs = built["SK_Sovereign"]
+ arm = ctx.export_arm
+ for o in bpy.context.scene.objects:
+ if o.type == "MESH" and o not in objs:
+ o.hide_render = True
+ C.ensure_dir(QA)
+ lights()
+ body = A.Body(ctx.rig)
+ rig = ctx.rig
+
+ def pose(p):
+ # the shared bones' pose from the shared rig, set on the Sovereign's own skeleton
+ for n, m in rig.basis(rig.solve(p)).items():
+ pb = arm.pose.bones[n]
+ pb.rotation_mode = "QUATERNION"
+ loc, q, _ = m.decompose()
+ pb.location = loc if n == "Hips" else Vector()
+ pb.rotation_quaternion = q
+
+ which = argv[0] if argv else "all"
+ if "nocloak" in argv:
+ for o in objs:
+ if o.name.endswith("Cloak"):
+ o.hide_render = True
+ pose(A.clip_idle(body)[40])
+ bpy.context.view_layer.update()
+ mid = Vector((0, 0, 1.0))
+ if which in ("all", "views"):
+ camera(mid, 25, 4.2)
+ render("sov_front34")
+ camera(mid, 180, 4.2)
+ render("sov_back")
+ camera(mid, 90, 4.2)
+ render("sov_side")
+ if which in ("all", "face"):
+ camera(Vector((0, 0, 1.6)), 15, 1.3, lens=70, height=1.62, res=(900, 900))
+ render("sov_face")
+ if which in ("all", "walk"):
+ walk = A.clip_walk(body)
+ for f in (0, 8):
+ pose(walk[f])
+ bpy.context.view_layer.update()
+ camera(mid, 60, 4.2)
+ render(f"sov_walk{f}")
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/docs/verse/sovereign.md b/docs/verse/sovereign.md
new file mode 100644
index 0000000000..cfc6f07edb
--- /dev/null
+++ b/docs/verse/sovereign.md
@@ -0,0 +1,43 @@
+# The Sovereign: the commander's default skin
+
+The person plays the commander in every view (bird's-eye, third and first person, the duel). Their body is
+`SK_Sovereign`, the first of what will become a set of skins. Original design: a hooded sovereign in black velvet
+with gold piping, glowing amber eyes deep in the hood, a deep red cloak lining.
+
+## The model
+
+Built in Blender by `art/verse/characters/sovereign.py` (painter `looks_sovereign.py`) through the normal
+character build:
+
+```
+python scripts/verse/blender.py run --no-lock art/verse/characters/build.py --only SK_Sovereign --no-clips
+python scripts/verse/blender.py run art/verse/characters/sovereign_qa.py all # look-dev renders
+```
+
+- Male skeleton, so every shared clip (`A_Human_M.glb`) drives it.
+- Pieces: inner robe on the body (pale aged face, bare hands), floor-length robe skirt, bell sleeves with gold
+ cuffs, a deep cowl (hood and shoulder drape in one shell), an open cloak to the floor, a gold clasp and chain,
+ belt, boots, emissive eyes (`M_SovEye`).
+- The robe skirt hangs from the hips and is swung by both thighs together, so a stride never splits it.
+- Materials have their own names (`M_Sov*`), so the rank tiers never repaint them. `applyLook` still runs and
+ simply finds nothing to tint.
+- About 39k triangles, 2.1 MB.
+
+## The cloak bones
+
+The Sovereign carries its own copy of the skeleton with six extra bones, `Cloak_{R,C,L}{1,2}` (children of
+`Chest`), listed in the manifest as `extraBones`. The clips never animate them. `actors/cloak.ts` (`CloakRig`)
+poses them every frame as damped springs: the hem lifts behind a walking body, swings against a strafe or a turn,
+and whips a little after a stop. Deck bodies and the duel figure both run it.
+
+## Arc Storm (F)
+
+Hold F on a deck (not in a duel): both arms rise toward the aim (the view at eye level, the body's facing on the
+plate) and violet-white lightning crackles from the hands (`abilities/arcStorm.ts`, sound in `arcSound.ts`).
+In first person the bolts leave from the bottom corners of the view, where the person's own hands are. It is a
+show of power only: it does nothing to the crew or the duel yet.
+
+## Where the commander's body is chosen
+
+`COMMANDER_SKIN` in `actors/characters.ts`. A manifest without it falls back to an officer body, everywhere
+(deck cast, duel figure, first-person arms).
diff --git a/dodaios/ui/web/frontend/public/verse/characters/SK_Sovereign.glb b/dodaios/ui/web/frontend/public/verse/characters/SK_Sovereign.glb
new file mode 100644
index 0000000000..2eadb8f07e
Binary files /dev/null and b/dodaios/ui/web/frontend/public/verse/characters/SK_Sovereign.glb differ
diff --git a/dodaios/ui/web/frontend/public/verse/characters/characters.json b/dodaios/ui/web/frontend/public/verse/characters/characters.json
index 932e1f0229..bec8e35c2c 100644
--- a/dodaios/ui/web/frontend/public/verse/characters/characters.json
+++ b/dodaios/ui/web/frontend/public/verse/characters/characters.json
@@ -337,6 +337,41 @@
]
}
},
+ {
+ "id": "SK_Sovereign",
+ "kind": "sovereign",
+ "url": "verse/characters/SK_Sovereign.glb",
+ "skeleton": "M",
+ "clips": "verse/characters/A_Human_M.glb",
+ "meshes": [
+ "Body",
+ "Cloak"
+ ],
+ "materials": [
+ "M_Skin",
+ "M_SovRobe",
+ "M_Boots",
+ "M_SovTrim",
+ "M_Belt",
+ "M_SovEye",
+ "M_SovCloak",
+ "M_SovLining"
+ ],
+ "height": 1.78,
+ "triangles": 32456,
+ "bytes": 1851112,
+ "defaults": {
+ "M_Skin": "#b9a99c"
+ },
+ "extraBones": [
+ "Cloak_R1",
+ "Cloak_R2",
+ "Cloak_C1",
+ "Cloak_C2",
+ "Cloak_L1",
+ "Cloak_L2"
+ ]
+ },
{
"id": "SK_Technician",
"kind": "technician",
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx b/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx
index 758c6362f3..9f8568106d 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx
+++ b/dodaios/ui/web/frontend/src/components/society/verse/VerseStage.tsx
@@ -662,16 +662,18 @@ export function VerseStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenG
else if (e.code === "KeyV" && !e.repeat) keyActions.current.cycle();
else if (e.code === "KeyE" && !e.repeat) keyActions.current.interact();
else if (e.code === "KeyL" && !e.repeat) keyActions.current.lockPointer();
+ else if (e.code === "KeyF") { e.preventDefault(); runtime.power = true; }
else if (e.code === "F9" && import.meta.env.DEV) setDebug((d) => !d);
};
const up = (e: KeyboardEvent) => {
if (e.key === "Shift") runtime.control.run = false;
+ if (e.code === "KeyF") runtime.power = false;
const key = PAN_KEYS[e.code];
if (!key) return;
runtime.view.setKey(key, false, e.shiftKey);
runtime.control.setKey(key, false, e.shiftKey);
};
- const blur = () => { runtime.view.clearKeys(); runtime.control.clearKeys(); };
+ const blur = () => { runtime.view.clearKeys(); runtime.control.clearKeys(); runtime.power = false; };
window.addEventListener("keydown", escape, true);
window.addEventListener("keydown", down);
window.addEventListener("keyup", up);
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/abilities/arcSound.ts b/dodaios/ui/web/frontend/src/components/society/verse/abilities/arcSound.ts
new file mode 100644
index 0000000000..dfa5e37371
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/components/society/verse/abilities/arcSound.ts
@@ -0,0 +1,80 @@
+/**
+ * Arc Storm's sound, synthesised with WebAudio: a low electric hum under a
+ * crackle of filtered noise whose loudness jumps with every strike. Made on
+ * the first press (a user gesture); silent without WebAudio.
+ */
+export class ArcSound {
+ private ctx: AudioContext | null = null;
+ private failed = false;
+ private out: GainNode | null = null;
+ private crackle: GainNode | null = null;
+ private hum: GainNode | null = null;
+ volume = 0.45;
+
+ private audio(): AudioContext | null {
+ if (this.ctx || this.failed) return this.ctx;
+ try {
+ const AC = (window as unknown as { AudioContext?: typeof AudioContext }).AudioContext;
+ if (!AC) { this.failed = true; return null; }
+ const ctx = new AC();
+ const out = ctx.createGain();
+ out.gain.value = 0;
+ out.connect(ctx.destination);
+ // Crackle: looping white noise through a band-pass, its gain driven per frame.
+ const buf = ctx.createBuffer(1, ctx.sampleRate, ctx.sampleRate);
+ const data = buf.getChannelData(0);
+ for (let i = 0; i < data.length; i++) data[i] = Math.random() * 2 - 1;
+ const noise = ctx.createBufferSource();
+ noise.buffer = buf;
+ noise.loop = true;
+ const band = ctx.createBiquadFilter();
+ band.type = "bandpass";
+ band.frequency.value = 2600;
+ band.Q.value = 0.7;
+ const crackle = ctx.createGain();
+ crackle.gain.value = 0;
+ noise.connect(band).connect(crackle).connect(out);
+ noise.start();
+ // Hum: two detuned saws, low-passed.
+ const low = ctx.createBiquadFilter();
+ low.type = "lowpass";
+ low.frequency.value = 420;
+ const hum = ctx.createGain();
+ hum.gain.value = 0;
+ for (const f of [55, 56.3]) {
+ const o = ctx.createOscillator();
+ o.type = "sawtooth";
+ o.frequency.value = f;
+ o.connect(low);
+ o.start();
+ }
+ low.connect(hum).connect(out);
+ this.ctx = ctx;
+ this.out = out;
+ this.crackle = crackle;
+ this.hum = hum;
+ return ctx;
+ } catch {
+ this.failed = true;
+ return null;
+ }
+ }
+
+ /** Every frame: `level` 0..1 is how far the power is up. */
+ update(level: number, held: boolean): void {
+ if (!held && !this.ctx) return;
+ const ctx = this.audio();
+ if (!ctx || !this.out || !this.crackle || !this.hum) return;
+ if (ctx.state === "suspended" && held) void ctx.resume();
+ const t = ctx.currentTime;
+ this.out.gain.setTargetAtTime(this.volume * level, t, 0.04);
+ this.hum.gain.setTargetAtTime(0.35 * level, t, 0.05);
+ // Jumps of loudness are the strikes.
+ this.crackle.gain.setTargetAtTime(level * (0.25 + Math.random() * 0.9), t, 0.01);
+ }
+
+ dispose(): void {
+ void this.ctx?.close();
+ this.ctx = null;
+ }
+}
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/abilities/arcStorm.ts b/dodaios/ui/web/frontend/src/components/society/verse/abilities/arcStorm.ts
new file mode 100644
index 0000000000..76770ad402
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/components/society/verse/abilities/arcStorm.ts
@@ -0,0 +1,213 @@
+/**
+ * Arc Storm, the Sovereign's signature power: while it is held, violet-white
+ * lightning crackles from both hands toward where the commander aims.
+ *
+ * Every bolt is a jagged polyline (midpoint displacement, a few forks) drawn
+ * twice with fat lines: a thin white-hot core and a wide violet glow, both
+ * additive. The bolts re-strike many times a second, a light at the hands
+ * flickers with them and sparks burst where they land. Pure geometry
+ * (`boltPoints`) is separate from the three.js drawing.
+ */
+import {
+ AdditiveBlending, Color, Group, PointLight, Vector2, Vector3, type WebGLRenderer,
+} from "three";
+import { LineSegments2 } from "three/examples/jsm/lines/LineSegments2.js";
+import { LineSegmentsGeometry } from "three/examples/jsm/lines/LineSegmentsGeometry.js";
+import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
+
+/** Tuning of the power (seconds, metres). */
+export const ARC = {
+ /** How far the bolts reach. */
+ reach: 5.2,
+ /** Seconds between strikes (each strike redraws every bolt). */
+ restrike: 0.045,
+ /** Bolts per hand per strike. */
+ bolts: 3,
+ /** Segments of a main bolt (a power of two). */
+ segments: 16,
+ /** Sideways jitter of the midpoints, as a share of the segment's length. */
+ jitter: 0.2,
+ /** The arms rise into the cast pose over this long. */
+ raise: 0.18,
+ core: "#f4ecff",
+ glow: "#8b5cff",
+};
+
+/** A small deterministic random generator (mulberry32). */
+export function rng(seed: number): () => number {
+ let a = seed >>> 0;
+ return () => {
+ a = (a + 0x6d2b79f5) >>> 0;
+ let t = a;
+ t = Math.imul(t ^ (t >>> 15), t | 1);
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+
+/**
+ * A lightning bolt from `a` to `b`: `segments + 1` points, the ends exact, the
+ * inside displaced at random across the line (larger at the middle). Pure.
+ */
+export function boltPoints(a: Vector3, b: Vector3, segments: number, jitter: number, rand: () => number): Vector3[] {
+ const pts: Vector3[] = [a.clone(), b.clone()];
+ const dir = new Vector3().subVectors(b, a);
+ const len = dir.length();
+ if (len < 1e-6) return [a.clone(), b.clone()];
+ dir.multiplyScalar(1 / len);
+ // Two directions across the bolt.
+ const helper = Math.abs(dir.y) < 0.9 ? new Vector3(0, 1, 0) : new Vector3(1, 0, 0);
+ const u = new Vector3().crossVectors(dir, helper).normalize();
+ const v = new Vector3().crossVectors(dir, u).normalize();
+ let span = len * jitter;
+ let out = pts;
+ while (out.length - 1 < segments) {
+ const next: Vector3[] = [];
+ for (let i = 0; i < out.length - 1; i++) {
+ const p = out[i];
+ const q = out[i + 1];
+ next.push(p);
+ const m = new Vector3().addVectors(p, q).multiplyScalar(0.5);
+ m.addScaledVector(u, (rand() - 0.5) * span).addScaledVector(v, (rand() - 0.5) * span);
+ next.push(m);
+ }
+ next.push(out[out.length - 1]);
+ out = next;
+ span *= 0.5;
+ }
+ return out;
+}
+
+const tmpA = new Vector3();
+const tmpB = new Vector3();
+const tmpDir = new Vector3();
+
+export class ArcStorm {
+ readonly group = new Group();
+ private readonly core: LineSegments2;
+ private readonly glow: LineSegments2;
+ private readonly coreMat: LineMaterial;
+ private readonly glowMat: LineMaterial;
+ private readonly light = new PointLight(new Color(ARC.glow), 0, 7, 1.6);
+ private readonly impact = new PointLight(new Color(ARC.glow), 0, 4, 1.8);
+ private untilStrike = 0;
+ private seed = 1;
+ private readonly size = new Vector2();
+ /** 0..1: how far the power is up (the arms rise, the bolts thicken). */
+ level = 0;
+
+ constructor() {
+ const mat = (color: string, width: number, opacity: number) => new LineMaterial({
+ color: new Color(color).getHex(), linewidth: width, worldUnits: true, transparent: true, opacity,
+ blending: AdditiveBlending, depthWrite: false, toneMapped: false,
+ });
+ this.coreMat = mat(ARC.core, 0.008, 1);
+ this.glowMat = mat(ARC.glow, 0.036, 0.5);
+ this.core = new LineSegments2(new LineSegmentsGeometry(), this.coreMat);
+ this.glow = new LineSegments2(new LineSegmentsGeometry(), this.glowMat);
+ for (const l of [this.glow, this.core]) {
+ l.frustumCulled = false;
+ l.renderOrder = 50;
+ this.group.add(l);
+ }
+ this.group.add(this.light, this.impact);
+ this.group.visible = false;
+ }
+
+ /** Raise or drop the power for this frame (call before the caster's body is posed). */
+ rise(dtS: number, held: boolean): number {
+ const dt = Math.min(0.1, Math.max(0, dtS));
+ this.level = Math.max(0, Math.min(1, this.level + (held ? dt / ARC.raise : -dt / 0.12)));
+ return this.level;
+ }
+
+ /**
+ * One frame. `hands` are the fingertips the bolts leave from (none: the power is down), `aim` the unit direction
+ * they go, `floorY` the floor under the caster.
+ */
+ update(
+ dtS: number, held: boolean, hands: readonly Vector3[], aim: Vector3, floorY: number, renderer: WebGLRenderer | null, thickness = 1,
+ ): void {
+ const dt = Math.min(0.1, Math.max(0, dtS));
+ const on = held && this.level > 0.6 && hands.length > 0;
+ this.group.visible = on || this.light.intensity > 0.01;
+ if (renderer) {
+ renderer.getSize(this.size);
+ this.coreMat.resolution.copy(this.size);
+ this.glowMat.resolution.copy(this.size);
+ }
+ if (!on) {
+ this.core.visible = this.glow.visible = false;
+ this.light.intensity *= 0.6;
+ this.impact.intensity *= 0.6;
+ return;
+ }
+ this.core.visible = this.glow.visible = true;
+ this.untilStrike -= dt;
+ if (this.untilStrike > 0) {
+ // Between strikes the light still flickers.
+ this.light.intensity = 3 + Math.random() * 5;
+ return;
+ }
+ this.untilStrike = ARC.restrike * (0.6 + Math.random() * 0.8);
+ const rand = rng(this.seed++);
+ const seg: number[] = [];
+ const hit = new Vector3();
+ tmpDir.copy(aim).normalize();
+ for (const hand of hands) {
+ for (let k = 0; k < ARC.bolts; k++) {
+ // Each bolt lands somewhere in a cone ahead, the first one straightest.
+ const spread = k === 0 ? 0.25 : 0.9;
+ const reach = ARC.reach * (0.65 + rand() * 0.45);
+ tmpB.copy(hand).addScaledVector(tmpDir, reach);
+ tmpB.x += (rand() - 0.5) * spread * 2;
+ tmpB.z += (rand() - 0.5) * spread * 2;
+ tmpB.y += (rand() - 0.6) * spread;
+ tmpB.y = Math.max(floorY + 0.05, tmpB.y);
+ hit.add(tmpB);
+ const pts = boltPoints(hand, tmpB, ARC.segments, ARC.jitter, rand);
+ pushPolyline(seg, pts);
+ // Forks: short side bolts off the main one.
+ for (let f = 0; f < 2; f++) {
+ const i = 2 + Math.floor(rand() * (pts.length - 4));
+ const from = pts[i];
+ tmpA.subVectors(tmpB, from).multiplyScalar(0.25 + rand() * 0.3);
+ tmpA.x += (rand() - 0.5) * 0.9;
+ tmpA.y += (rand() - 0.5) * 0.7;
+ tmpA.z += (rand() - 0.5) * 0.9;
+ pushPolyline(seg, boltPoints(from, tmpA.add(from), 4, 0.4, rand));
+ }
+ }
+ }
+ for (const l of [this.core, this.glow]) {
+ const g = l.geometry as LineSegmentsGeometry;
+ g.setPositions(seg);
+ l.computeLineDistances();
+ }
+ this.coreMat.linewidth = (0.005 + 0.006 * Math.random()) * thickness;
+ this.glowMat.linewidth = 0.036 * thickness;
+ this.glowMat.opacity = 0.35 + 0.25 * Math.random();
+ const mid = hands.reduce((acc, h) => acc.add(h), tmpA.set(0, 0, 0)).multiplyScalar(1 / hands.length);
+ this.light.position.copy(mid).addScaledVector(tmpDir, 0.4);
+ this.light.intensity = 6 + Math.random() * 8;
+ this.impact.position.copy(hit.multiplyScalar(1 / (hands.length * ARC.bolts)));
+ this.impact.intensity = 3 + Math.random() * 5;
+ }
+
+ dispose(): void {
+ this.core.geometry.dispose();
+ this.glow.geometry.dispose();
+ this.coreMat.dispose();
+ this.glowMat.dispose();
+ this.light.dispose();
+ this.impact.dispose();
+ }
+}
+
+function pushPolyline(out: number[], pts: readonly Vector3[]): void {
+ for (let i = 0; i < pts.length - 1; i++) {
+ const a = pts[i];
+ const b = pts[i + 1];
+ out.push(a.x, a.y, a.z, b.x, b.y, b.z);
+ }
+}
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/abilities/sovereign.test.ts b/dodaios/ui/web/frontend/src/components/society/verse/abilities/sovereign.test.ts
new file mode 100644
index 0000000000..9364c8c865
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/components/society/verse/abilities/sovereign.test.ts
@@ -0,0 +1,81 @@
+import { describe, expect, it } from "vitest";
+import { Bone, Group, Vector3 } from "three";
+import { boltPoints, rng } from "./arcStorm";
+import { CloakRig, cloakTarget } from "../actors/cloak";
+
+describe("Arc Storm bolts", () => {
+ it("run from the hand to the target with the asked number of segments", () => {
+ const a = new Vector3(0, 1.3, 0);
+ const b = new Vector3(0, 1, 5);
+ const pts = boltPoints(a, b, 16, 0.3, rng(7));
+ expect(pts).toHaveLength(17);
+ expect(pts[0].equals(a)).toBe(true);
+ expect(pts[16].equals(b)).toBe(true);
+ });
+
+ it("stay near the line between the ends", () => {
+ const a = new Vector3(0, 0, 0);
+ const b = new Vector3(0, 0, 4);
+ for (const p of boltPoints(a, b, 16, 0.3, rng(3))) {
+ expect(Math.hypot(p.x, p.y)).toBeLessThan(4 * 0.3);
+ expect(p.z).toBeGreaterThan(-0.5);
+ expect(p.z).toBeLessThan(4.5);
+ }
+ });
+
+ it("are the same for the same seed", () => {
+ const a = new Vector3(1, 1, 1);
+ const b = new Vector3(3, 0, 2);
+ const p = boltPoints(a, b, 8, 0.3, rng(11));
+ const q = boltPoints(a, b, 8, 0.3, rng(11));
+ expect(p.map((v) => v.toArray())).toEqual(q.map((v) => v.toArray()));
+ });
+});
+
+describe("the Sovereign's cloak", () => {
+ it("hangs still when the body stands", () => {
+ const t = cloakTarget(0, 0, 0, 0);
+ expect(t.pitch).toBeCloseTo(0, 5);
+ expect(t.roll).toBeCloseTo(0, 5);
+ });
+
+ it("lifts behind a walking body and swings against a strafe", () => {
+ expect(cloakTarget(1.4, 0, 0, 0).pitch).toBeGreaterThan(0.3);
+ expect(cloakTarget(0, 1, 0, 0).roll).toBeLessThan(0);
+ expect(cloakTarget(0, -1, 0, 0).roll).toBeGreaterThan(0);
+ // never swings forward into the legs much when backing off
+ expect(cloakTarget(-2, 0, 0, 0).pitch).toBeGreaterThanOrEqual(-0.08);
+ });
+
+ it("is found on a skeleton with cloak bones and poses them while walking", () => {
+ const root = new Group();
+ const chest = new Bone();
+ chest.name = "Chest";
+ root.add(chest);
+ for (const c of ["R", "C", "L"]) {
+ const up = new Bone();
+ up.name = `Cloak_${c}1`;
+ const low = new Bone();
+ low.name = `Cloak_${c}2`;
+ low.position.set(0, -0.6, 0);
+ up.add(low);
+ chest.add(up);
+ }
+ const rig = CloakRig.find(root);
+ expect(rig).not.toBeNull();
+ const up = root.getObjectByName("Cloak_C1") as Bone;
+ const rest = up.quaternion.clone();
+ for (let i = 0; i < 60; i++) rig!.update(1 / 60, 0, i * (1.4 / 60), 0);
+ expect(up.quaternion.angleTo(rest)).toBeGreaterThan(0.1);
+ rig!.reset();
+ expect(up.quaternion.angleTo(rest)).toBeCloseTo(0, 6);
+ });
+
+ it("is absent on a body without cloak bones", () => {
+ const root = new Group();
+ const chest = new Bone();
+ chest.name = "Chest";
+ root.add(chest);
+ expect(CloakRig.find(root)).toBeNull();
+ });
+});
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/actors/ActorsLayer.tsx b/dodaios/ui/web/frontend/src/components/society/verse/actors/ActorsLayer.tsx
index facb4e1cfd..23cea5a009 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/actors/ActorsLayer.tsx
+++ b/dodaios/ui/web/frontend/src/components/society/verse/actors/ActorsLayer.tsx
@@ -9,7 +9,9 @@
*/
import { useEffect, useMemo, useRef } from "react";
import { useFrame, useThree } from "@react-three/fiber";
-import { CanvasTexture, type Texture } from "three";
+import { CanvasTexture, Vector3, type Texture } from "three";
+import { ArcStorm } from "../abilities/arcStorm";
+import { ArcSound } from "../abilities/arcSound";
import type { Deck } from "../content/deck";
import type { StageRuntime } from "../runtime";
import { seatedCrew } from "../../crewFeeds/seated";
@@ -91,6 +93,19 @@ function spawnPoint(deck: Deck, entry: CastMember["entry"]): Pose | null {
export function ActorsLayer({ runtime, deck, library, cast, commanderId, reduced, saluteAt }: Props) {
const scene = useThree((s) => s.scene);
+ const gl = useThree((s) => s.gl);
+ // The commander's power: the bolts, their light and their sound.
+ const power = useMemo(() => ({
+ storm: new ArcStorm(), sound: new ArcSound(), aim: new Vector3(), left: new Vector3(), right: new Vector3(), hands: [] as Vector3[],
+ }), []);
+ useEffect(() => {
+ scene.add(power.storm.group);
+ return () => {
+ scene.remove(power.storm.group);
+ power.storm.dispose();
+ power.sound.dispose();
+ };
+ }, [scene, power]);
const actors = useRef(new Map<string, Actor>());
const loading = useRef(new Set<string>());
/** Cast members who walked off on purpose (to the lift) and must not be spawned again for the same goal. */
@@ -220,6 +235,18 @@ export function ActorsLayer({ runtime, deck, library, cast, commanderId, reduced
}
// In a duel the duellist's own body stands in for the commander's.
if (lead) lead.group.visible = !runtime.duelActive && !(runtime.eye && runtime.commanderHidden);
+ // Arc Storm: held, the arms rise toward the aim (the view's at eye level, the body's facing on the plate).
+ const held = runtime.power && !runtime.duelActive && !!lead;
+ const level = power.storm.rise(dtS, held);
+ if (lead) {
+ if (runtime.eye) {
+ const sh = runtime.shoulder;
+ power.aim.set(Math.sin(sh.yaw) * Math.cos(sh.pitch), -Math.sin(sh.pitch), Math.cos(sh.yaw) * Math.cos(sh.pitch));
+ } else {
+ power.aim.set(Math.sin(lead.yaw), -0.06, Math.cos(lead.yaw));
+ }
+ lead.cast = level > 0 ? { level, aim: power.aim } : null;
+ }
const area = runtime.duelActive ? runtime.duelArea : null;
for (const actor of actors.current.values()) {
actor.update(dtS, ctx);
@@ -244,6 +271,18 @@ export function ActorsLayer({ runtime, deck, library, cast, commanderId, reduced
if (at && at.kind === "seat" && screenSeats.has(at.id)) seatedCrew.add(actor.id);
else seatedCrew.delete(actor.id);
}
+ power.hands.length = 0;
+ const eyeCam = runtime.eye?.camera;
+ if (lead && level > 0 && eyeCam && runtime.shoulder.firstShare > 0.5) {
+ // First person: from where the person's own hands are on screen, low left and right of the view.
+ eyeCam.updateMatrixWorld();
+ power.left.set(-0.2, -0.2, -0.5).applyMatrix4(eyeCam.matrixWorld);
+ power.right.set(0.2, -0.2, -0.5).applyMatrix4(eyeCam.matrixWorld);
+ power.hands.push(power.left, power.right);
+ } else if (lead && level > 0 && lead.fingertips(power.left, power.right)) power.hands.push(power.left, power.right);
+ // Seen from far above (the plate) the bolts are drawn thicker to read at that scale.
+ power.storm.update(dtS, held, power.hands, power.aim, lead?.y ?? 0, gl, runtime.eye ? 1 : 3);
+ power.sound.update(reduced ? level * 0.6 : level, held);
runtime.stats.actors = actors.current.size;
// The third-person camera stays on the commander, leading them a little while they walk and easing back onto
// them when they stop; a drag looks around until they walk again.
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/actors/actor.ts b/dodaios/ui/web/frontend/src/components/society/verse/actors/actor.ts
index 8bb155ec02..3fc8d56077 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/actors/actor.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/actors/actor.ts
@@ -15,7 +15,8 @@
* and it stands where it is.
*/
import {
- AnimationMixer, Group, LoopOnce, LoopRepeat, Mesh, MeshBasicMaterial, PlaneGeometry, type AnimationAction, type Texture,
+ AnimationMixer, Group, LoopOnce, LoopRepeat, Mesh, MeshBasicMaterial, PlaneGeometry, Quaternion, Vector3,
+ type AnimationAction, type Bone, type Texture,
} from "three";
import type { Deck, NavGrid, Socket } from "../content/deck";
import { findPath, floorHeight, nearestWalkable, type Point } from "../nav/pathfind";
@@ -26,6 +27,8 @@ import { disposeInstance, type CharacterInstance } from "./characters";
import { clipFor, SEATED, type Motion } from "./clips";
import { avoidance, BODY_RADIUS, lerpAngle, PathFollower, sidestep, turnPace, turnToward, wrapAngle, yawTo, type Neighbour } from "./locomotion";
import { RoomLight } from "./roomLight";
+import { CloakRig } from "./cloak";
+import { aimBone, solveElbow } from "../duel/figure";
import { hash32 } from "../life/crew";
export type Goal =
@@ -67,7 +70,7 @@ const DRIVE_STAND_BELOW = 0.08;
/** A driven body stops this close to another person, metres between centres. */
const DRIVE_PERSONAL_SPACE = BODY_RADIUS * 1.7;
/** Materials whose surfaces make up a body's x-ray silhouette (character contract names). */
-const SILHOUETTE = new Set(["M_Uniform", "M_Skin", "M_Hair", "M_Cap", "M_Shell", "M_Chassis"]);
+const SILHOUETTE = new Set(["M_Uniform", "M_Skin", "M_Hair", "M_Cap", "M_Shell", "M_Chassis", "M_SovCloak", "M_SovRobe"]);
type Phase = "idle" | "standing_up" | "walking" | "settling" | "settled" | "driven";
@@ -104,6 +107,12 @@ export function socketPose(deck: Pick<Deck, "sockets" | "nav">, socket: Socket,
return { x: socket.x, y: socket.y, z: socket.z, yaw: socket.yaw };
}
+const CAST_TMP = {
+ a: new Vector3(), b: new Vector3(), aim: new Vector3(), flat: new Vector3(), lat: new Vector3(),
+ s: new Vector3(), e: new Vector3(), h: new Vector3(), target: new Vector3(), pole: new Vector3(),
+ elbow: new Vector3(), tip: new Vector3(), q0: new Quaternion(), q1: new Quaternion(), q2: new Quaternion(),
+};
+
export class Actor {
readonly group = new Group();
readonly mixer: AnimationMixer;
@@ -139,6 +148,14 @@ export class Actor {
private steerFace: { yaw: number; reverse: boolean } | null = null;
private readonly clipNames: ReadonlySet<string>;
private readonly shadow: Mesh<PlaneGeometry, MeshBasicMaterial>;
+ /** The skin's cloak, when its skeleton carries one (it trails the body's motion). */
+ private readonly cloak: CloakRig | null;
+ /**
+ * A power being cast (Arc Storm): `level` 0..1 raises both arms toward `aim` (a unit direction in the world),
+ * over whatever the clip plays. Null: the clip alone.
+ */
+ cast: { level: number; aim: Vector3 } | null = null;
+ private castBones: Record<string, Bone> | null = null;
constructor(
readonly id: string,
@@ -148,6 +165,16 @@ export class Actor {
shadow: Texture,
) {
this.mixer = new AnimationMixer(instance.root);
+ this.cloak = CloakRig.find(instance.root);
+ const bones: Record<string, Bone> = {};
+ for (const side of ["L", "R"]) {
+ for (const n of ["UpperArm", "ForeArm", "Hand", "Fingers"]) {
+ const b = instance.root.getObjectByName(`${n}_${side}`) as Bone | undefined;
+ if (b) bones[`${n}_${side}`] = b;
+ }
+ }
+ const chest = instance.root.getObjectByName("Chest") as Bone | undefined;
+ if (chest && Object.keys(bones).length === 8) this.castBones = { ...bones, Chest: chest };
this.clipNames = new Set(instance.clips.keys());
// The silhouette needs the body's big shapes only, a few draw calls rather than every material.
const outline = instance.meshes.filter((m) => !Array.isArray(m.material) && SILHOUETTE.has(m.material.name));
@@ -212,6 +239,7 @@ export class Actor {
this.z = pose.z;
this.yaw = wrapAngle(pose.yaw);
this.sync();
+ this.cloak?.reset();
}
/** Change where the body is going; the same key keeps the current walk. `arrive` takes the pose at once. */
@@ -242,12 +270,19 @@ export class Actor {
update(dtS: number, ctx: ActorContext): void {
this.mixer.update(dtS);
+ // Casting turns the body to face the way the power goes (unless the keys steer its facing).
+ const cast = this.cast;
+ if (cast && cast.level > 0.05 && !this.steerFace) {
+ this.yaw = turnToward(this.yaw, Math.atan2(cast.aim.x, cast.aim.z), DRIVE_TURN_RATE, dtS);
+ }
const goal = this.goal;
this.moving = false;
if (this.steer) {
this.driven(this.steer, dtS, ctx);
this.light.update(ctx.deck, this.x, this.y, this.z, dtS);
this.sync();
+ this.castArms();
+ this.cloak?.update(dtS, this.x, this.z, this.yaw, ctx.reduced);
return;
}
if (this.phase === "driven") {
@@ -273,6 +308,66 @@ export class Actor {
}
this.light.update(ctx.deck, this.x, this.y, this.z, dtS);
this.sync();
+ this.castArms();
+ this.cloak?.update(dtS, this.x, this.z, this.yaw, ctx.reduced);
+ }
+
+ /** Both fingertips in the world (for the power's bolts); false when the body has no arms. */
+ fingertips(left: Vector3, right: Vector3): boolean {
+ const b = this.castBones;
+ if (!b) return false;
+ for (const [side, out] of [["L", left], ["R", right]] as const) {
+ const fingers = b[`Fingers_${side}`];
+ const hand = b[`Hand_${side}`];
+ fingers.getWorldPosition(out);
+ // A little beyond the finger bone's root: the tips.
+ hand.getWorldPosition(CAST_TMP.a);
+ out.addScaledVector(CAST_TMP.b.subVectors(out, CAST_TMP.a).normalize(), 0.07);
+ }
+ return true;
+ }
+
+ /** Raise both arms toward the cast's aim, blended over the clip by its level. */
+ private castArms(): void {
+ const cast = this.cast;
+ const b = this.castBones;
+ if (!cast || !b || cast.level <= 0.001) return;
+ const w = cast.level * cast.level * (3 - 2 * cast.level);
+ const root = this.instance.root;
+ root.updateMatrixWorld(true);
+ const t = CAST_TMP;
+ const aim = t.aim.copy(cast.aim);
+ aim.y = Math.max(-0.35, Math.min(0.5, aim.y));
+ aim.normalize();
+ const flat = t.flat.set(aim.x, 0, aim.z).normalize();
+ const lateral = t.lat.set(flat.z, 0, -flat.x); // the body's left
+ for (const side of ["L", "R"] as const) {
+ const upper = b[`UpperArm_${side}`];
+ const fore = b[`ForeArm_${side}`];
+ const hand = b[`Hand_${side}`];
+ const fingers = b[`Fingers_${side}`];
+ t.q0.copy(upper.quaternion);
+ t.q1.copy(fore.quaternion);
+ t.q2.copy(hand.quaternion);
+ const s = upper.getWorldPosition(t.s);
+ const e = fore.getWorldPosition(t.e);
+ const h = hand.getWorldPosition(t.h);
+ const a = s.distanceTo(e);
+ const len = e.distanceTo(h);
+ const sx = side === "L" ? 1 : -1;
+ // Hands forward at chest height, a little apart, palms toward the target.
+ const target = t.target.copy(s).addScaledVector(aim, (a + len) * 0.86).addScaledVector(lateral, -sx * 0.06);
+ target.y -= 0.1;
+ const pole = t.pole.set(0, -0.8, 0).addScaledVector(lateral, sx * 0.6).normalize();
+ const elbow = solveElbow(s, target, a, len, pole, t.elbow);
+ aimBone(upper, fore, elbow);
+ aimBone(fore, hand, target);
+ aimBone(hand, fingers, t.tip.copy(target).addScaledVector(aim, 0.3).addScaledVector(lateral, sx * 0.05));
+ upper.quaternion.copy(t.q0.slerp(upper.quaternion, w));
+ fore.quaternion.copy(t.q1.slerp(fore.quaternion, w));
+ hand.quaternion.copy(t.q2.slerp(hand.quaternion, w));
+ upper.updateMatrixWorld(true);
+ }
}
private plan(goal: Goal, ctx: ActorContext): void {
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/actors/characters.ts b/dodaios/ui/web/frontend/src/components/society/verse/actors/characters.ts
index b19596018d..cd447cf4c5 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/actors/characters.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/actors/characters.ts
@@ -12,7 +12,13 @@ import { GLTFLoader, type GLTF } from "three/examples/jsm/loaders/GLTFLoader.js"
import { MeshoptDecoder } from "three/examples/jsm/libs/meshopt_decoder.module.js";
import { clone as cloneSkinned } from "three/examples/jsm/utils/SkeletonUtils.js";
-export type BodyKind = "officer" | "technician" | "trooper" | "drone" | "companion";
+export type BodyKind = "officer" | "technician" | "trooper" | "drone" | "companion" | "sovereign";
+
+/**
+ * The commander's skin: the body the person plays in every view (deck, duel, first-person arms). Today the one
+ * default skin; a manifest without it falls back to an officer body.
+ */
+export const COMMANDER_SKIN = "SK_Sovereign";
export type Tier = "deck" | "line" | "command" | "flag";
export interface ModelEntry {
@@ -27,6 +33,8 @@ export interface ModelEntry {
height: number;
hoverHeight?: number;
driveSpeed?: number;
+ /** Bones beyond the shared skeleton (a skin's cloak), posed at run time. */
+ extraBones?: string[];
}
export interface SkeletonEntry {
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/actors/cloak.ts b/dodaios/ui/web/frontend/src/components/society/verse/actors/cloak.ts
new file mode 100644
index 0000000000..cf70abea4c
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/components/society/verse/actors/cloak.ts
@@ -0,0 +1,173 @@
+/**
+ * A cloak that trails: secondary motion for a body whose skeleton carries the
+ * cloak bones (the Sovereign skin: `Cloak_{R,C,L}{1,2}`, children of Chest,
+ * never animated by the shared clips).
+ *
+ * Each of the three columns (right, centre, left) is a damped spring on two
+ * angles in the character's own frame: pitch (the hem lifts backwards as the
+ * body walks forward) and roll (it swings sideways against a strafe or a
+ * turn). The lower segment follows the upper one with more lag, so the hem
+ * whips a little after a stop. A light flutter rides on top while moving.
+ */
+import { Quaternion, Vector3, type Bone, type Object3D } from "three";
+
+export const CLOAK_COLUMNS = ["R", "C", "L"] as const;
+
+/** Spring stiffness (1/s²) and damping (1/s) of the upper and the lower segment. */
+export const CLOAK_SPRING = { k1: 55, c1: 10, k2: 30, c2: 6.5 };
+
+interface Column {
+ side: number;
+ phase: number;
+ upper: Bone;
+ lower: Bone;
+ restUpper: Quaternion;
+ restLower: Quaternion;
+ // spring state: angles (rad) and rates (rad/s)
+ p1: number; r1: number; vp1: number; vr1: number;
+ p2: number; r2: number; vp2: number; vr2: number;
+}
+
+function wrap(a: number): number {
+ return Math.atan2(Math.sin(a), Math.cos(a));
+}
+
+function clamp(v: number, lo: number, hi: number): number {
+ return Math.min(hi, Math.max(lo, v));
+}
+
+/** Where the cloak wants to hang for a body moving at `forward`/`lateral` m/s, turning at `yawRate` rad/s. Pure. */
+export function cloakTarget(forward: number, lateral: number, yawRate: number, side: number): { pitch: number; roll: number } {
+ const speed = Math.hypot(forward, lateral);
+ const pitch = clamp(0.3 * forward, -0.08, 0.62) * (side === 0 ? 1 : 0.88) + 0.04 * Math.abs(lateral);
+ const roll = clamp(-0.09 * lateral - 0.05 * yawRate, -0.3, 0.3) + side * 0.05 * Math.min(speed, 2.5);
+ return { pitch, roll };
+}
+
+const qa = new Quaternion();
+const qb = new Quaternion();
+const qParent = new Quaternion();
+const qRoot = new Quaternion();
+const qInv = new Quaternion();
+const qc = new Quaternion();
+const axisX = new Vector3();
+const axisZ = new Vector3();
+
+export class CloakRig {
+ private readonly columns: Column[];
+ private readonly chest: Object3D;
+ private px = 0;
+ private pz = 0;
+ private pyaw = 0;
+ private primed = false;
+ private vf = 0;
+ private vl = 0;
+ private turn = 0;
+ private t = 0;
+
+ private constructor(private readonly root: Object3D, chest: Object3D, columns: Column[]) {
+ this.chest = chest;
+ this.columns = columns;
+ }
+
+ /** The cloak of a body, or null when its skeleton has no cloak bones. */
+ static find(root: Object3D): CloakRig | null {
+ const chest = root.getObjectByName("Chest");
+ if (!chest) return null;
+ const columns: Column[] = [];
+ CLOAK_COLUMNS.forEach((name, i) => {
+ const upper = root.getObjectByName(`Cloak_${name}1`) as Bone | undefined;
+ const lower = root.getObjectByName(`Cloak_${name}2`) as Bone | undefined;
+ if (!upper || !lower || lower.parent !== upper) return;
+ columns.push({
+ side: i - 1, phase: i * 2.1, upper, lower,
+ restUpper: upper.quaternion.clone(), restLower: lower.quaternion.clone(),
+ p1: 0, r1: 0, vp1: 0, vr1: 0, p2: 0, r2: 0, vp2: 0, vr2: 0,
+ });
+ });
+ return columns.length ? new CloakRig(root, chest, columns) : null;
+ }
+
+ /** Forget the motion (the body was placed somewhere new). */
+ reset(): void {
+ this.primed = false;
+ for (const c of this.columns) {
+ c.p1 = c.r1 = c.vp1 = c.vr1 = c.p2 = c.r2 = c.vp2 = c.vr2 = 0;
+ c.upper.quaternion.copy(c.restUpper);
+ c.lower.quaternion.copy(c.restLower);
+ }
+ }
+
+ /**
+ * Step the springs for a body standing at (x, z) facing `yaw` and pose the cloak bones. Call after the
+ * animation mixer and after the root has been placed for this frame.
+ */
+ update(dtS: number, x: number, z: number, yaw: number, still = false): void {
+ const dt = Math.min(0.1, Math.max(1e-4, dtS));
+ if (!this.primed) {
+ this.px = x; this.pz = z; this.pyaw = yaw; this.primed = true;
+ }
+ const vx = (x - this.px) / dt;
+ const vz = (z - this.pz) / dt;
+ const s = Math.sin(yaw);
+ const c = Math.cos(yaw);
+ // A teleport (a lift ride, a respawn) is not a sprint.
+ const jump = Math.hypot(vx, vz) > 12;
+ const k = Math.min(1, dt * 10);
+ this.vf += ((jump ? 0 : vx * s + vz * c) - this.vf) * k;
+ this.vl += ((jump ? 0 : vx * c - vz * s) - this.vl) * k;
+ this.turn += ((jump ? 0 : wrap(yaw - this.pyaw) / dt) - this.turn) * k;
+ this.px = x; this.pz = z; this.pyaw = yaw;
+ this.t += dt;
+ const speed = Math.hypot(this.vf, this.vl);
+ const flutter = still ? 0 : 0.035 * Math.min(speed, 2);
+
+ // Integrate in small steps: a long frame must not blow the springs up.
+ const steps = Math.max(1, Math.ceil(dt / (1 / 120)));
+ const h = dt / steps;
+ const { k1, c1, k2, c2 } = CLOAK_SPRING;
+ for (const col of this.columns) {
+ const want = cloakTarget(this.vf, this.vl, this.turn, col.side);
+ const tp = want.pitch + flutter * Math.sin(this.t * 6.3 + col.phase);
+ const tr = want.roll + flutter * 0.6 * Math.sin(this.t * 4.7 + col.phase * 1.7);
+ for (let i = 0; i < steps; i++) {
+ col.vp1 += (k1 * (tp - col.p1) - c1 * col.vp1) * h;
+ col.vr1 += (k1 * (tr - col.r1) - c1 * col.vr1) * h;
+ col.p1 += col.vp1 * h;
+ col.r1 += col.vr1 * h;
+ // The lower half bends a little further the same way, later.
+ col.vp2 += (k2 * (0.45 * col.p1 - col.p2) - c2 * col.vp2) * h;
+ col.vr2 += (k2 * (0.45 * col.r1 - col.r2) - c2 * col.vr2) * h;
+ col.p2 += col.vp2 * h;
+ col.r2 += col.vr2 * h;
+ }
+ col.p1 = clamp(col.p1, -0.2, 0.9);
+ col.p2 = clamp(col.p2, -0.3, 0.6);
+ }
+ this.pose();
+ }
+
+ private pose(): void {
+ // The character's own axes in the world: +X its left, +Z its front.
+ this.root.updateMatrixWorld(true);
+ this.root.getWorldQuaternion(qRoot);
+ axisX.set(1, 0, 0).applyQuaternion(qRoot);
+ axisZ.set(0, 0, 1).applyQuaternion(qRoot);
+ this.chest.getWorldQuaternion(qParent);
+ for (const col of this.columns) {
+ // upper: local = parent⁻¹ · R(world) · parent · rest
+ const p = qb.copy(qParent);
+ setLocal(col.upper, p, col.restUpper, col.p1, col.r1);
+ // lower: its parent is the upper bone as just posed
+ p.multiply(col.upper.quaternion);
+ setLocal(col.lower, p, col.restLower, col.p2, col.r2);
+ }
+ }
+}
+
+function setLocal(bone: Bone, parentWorld: Quaternion, rest: Quaternion, pitch: number, roll: number): void {
+ qa.setFromAxisAngle(axisX, pitch);
+ qa.multiply(qc.setFromAxisAngle(axisZ, roll));
+ qInv.copy(parentWorld).invert();
+ bone.quaternion.copy(qInv).multiply(qa).multiply(parentWorld).multiply(rest);
+}
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/duel/DuelLayer.tsx b/dodaios/ui/web/frontend/src/components/society/verse/duel/DuelLayer.tsx
index 5b00790830..2978aded5f 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/duel/DuelLayer.tsx
+++ b/dodaios/ui/web/frontend/src/components/society/verse/duel/DuelLayer.tsx
@@ -18,7 +18,7 @@ import { useFrame, useThree } from "@react-three/fiber";
import { Color, Group, Vector3 } from "three";
import type { Deck } from "../content/deck";
import type { StageRuntime } from "../runtime";
-import { disposeInstance, type CharacterLibrary } from "../actors/characters";
+import { COMMANDER_SKIN, disposeInstance, type CharacterLibrary } from "../actors/characters";
import { applyLook, type Look } from "../actors/look";
import { hash32 } from "../life/crew";
import { CAMERA_RIGS } from "../combat/camera";
@@ -88,7 +88,7 @@ export function DuelLayer({ runtime, controller, deck, library, commanderId, com
useEffect(() => {
if (!library) return;
let alive = true;
- const own = library.model("officer", undefined, hash32(commanderId));
+ const own = library.model("officer", COMMANDER_SKIN, hash32(commanderId));
const foe = library.model("trooper") ?? library.model("technician");
const load = async () => {
const [a, b] = await Promise.all([own ? library.instantiate(own) : null, foe ? library.instantiate(foe) : null]);
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/duel/figure.ts b/dodaios/ui/web/frontend/src/components/society/verse/duel/figure.ts
index 80374e4127..723b3b9cc1 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/duel/figure.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/duel/figure.ts
@@ -20,6 +20,7 @@ import type { Deck } from "../content/deck";
import { disposeInstance, type CharacterInstance } from "../actors/characters";
import { clipFor } from "../actors/clips";
import { RoomLight } from "../actors/roomLight";
+import { CloakRig } from "../actors/cloak";
import type { PlayerView } from "../combat/view";
import { buildBlaster, type Blaster } from "./blaster";
@@ -61,7 +62,7 @@ const tmpQ2 = new Quaternion();
const tmpP = new Quaternion();
/** Turn `bone` so the line from it to `child` points at `target` (world). The bone's parents must be up to date. */
-function aimBone(bone: Object3D, child: Object3D, target: Vector3): void {
+export function aimBone(bone: Object3D, child: Object3D, target: Vector3): void {
const from = bone.getWorldPosition(tmpA);
const cur = child.getWorldPosition(tmpB).sub(from);
const want = target.clone().sub(from);
@@ -99,6 +100,8 @@ export class DuelFigure {
readonly group = new Group();
readonly blaster: Blaster;
private readonly mixer: AnimationMixer;
+ /** The skin's cloak, when it has one. */
+ private readonly cloak: CloakRig | null;
private readonly light = new RoomLight();
private idle: AnimationAction | null = null;
private walk: AnimationAction | null = null;
@@ -124,6 +127,7 @@ export class DuelFigure {
constructor(readonly instance: CharacterInstance, look: FigureLook, shadow: Texture) {
this.mixer = new AnimationMixer(instance.root);
+ this.cloak = CloakRig.find(instance.root);
this.walkSpeed = instance.walkSpeed || 1.4;
for (const name of ["Hips", "Spine", "Chest", "Neck", "Head", "UpperArm_R", "ForeArm_R", "Hand_R", "UpperArm_L", "ForeArm_L", "Hand_L"]) {
const o = instance.root.getObjectByName(name) as Bone | undefined;
@@ -310,6 +314,7 @@ export class DuelFigure {
}
this.blaster.setHeat(p.heat, p.venting, p.overheated, timeS);
+ if (!p.dodging && p.alive) this.cloak?.update(dt, x, z, this.legsYaw);
this.shadow.position.set(x, floorY + 0.008, z);
this.shadow.scale.setScalar(p.alive ? 0.95 : 1.6);
if (deck) this.light.update(deck, x, floorY, z, dt);
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/life/cast.ts b/dodaios/ui/web/frontend/src/components/society/verse/life/cast.ts
index 423a9691ab..4be73286aa 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/life/cast.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/life/cast.ts
@@ -7,7 +7,7 @@
import type { Deck, Socket } from "../content/deck";
import type { CastMember } from "../actors/ActorsLayer";
import type { Look } from "../actors/look";
-import type { CharacterContract } from "../actors/characters";
+import { COMMANDER_SKIN, type CharacterContract } from "../actors/characters";
import { hash32, type CrewMember } from "./crew";
import { socketKey, type Placement } from "./planner";
import { commanderTarget, type CommanderOrders } from "./commander";
@@ -90,7 +90,7 @@ export function buildCast(input: CastInput): CastMember[] {
}
const t = commanderTarget(deck, commander.orders);
cast.push({
- id: COMMANDER_ID, body: "officer", look: commander.look,
+ id: COMMANDER_ID, body: "officer", model: COMMANDER_SKIN, look: commander.look,
goal: { kind: "point", x: t.x, z: t.z }, goalKey: `point:${commander.orders.order}:${t.x.toFixed(2)}:${t.z.toFixed(2)}`,
pace: 1.45, entry: commander.orders.fromLift ? "lift" : "placed",
});
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/runtime.ts b/dodaios/ui/web/frontend/src/components/society/verse/runtime.ts
index 24dbf7c225..9bc8527f58 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/runtime.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/runtime.ts
@@ -100,6 +100,8 @@ export class StageRuntime {
viewmodel: ViewmodelDraw | null = null;
/** A duel holds the commander: the deck neither walks nor shows their usual body. */
duelActive = false;
+ /** The commander's power (Arc Storm) is held down (the F key), on the deck outside a duel. */
+ power = false;
/** The duel's hall while a duel runs: crew standing in it are not drawn (nobody walks into the line of fire). */
duelArea: { x0: number; x1: number; z0: number; z1: number } | null = null;
/** Put the commander here on the next frame (a duel ended), snapped onto the deck's nav grid. */
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/ViewmodelLayer.tsx b/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/ViewmodelLayer.tsx
index f6b32617da..e73e3e2e9e 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/ViewmodelLayer.tsx
+++ b/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/ViewmodelLayer.tsx
@@ -12,7 +12,7 @@ import { useFrame } from "@react-three/fiber";
import type { SkinnedMesh } from "three";
import type { Deck } from "../content/deck";
import type { StageRuntime } from "../runtime";
-import { disposeInstance, type CharacterLibrary } from "../actors/characters";
+import { COMMANDER_SKIN, disposeInstance, type CharacterLibrary } from "../actors/characters";
import type { Look } from "../actors/look";
import type { DuelController } from "../duel/duelController";
import { OWN_ACCENT } from "../duel/DuelLayer";
@@ -36,13 +36,17 @@ const FALLBACK: ArmColours = { uniform: "#3b3f47", trim: "#5a5f68" };
/** A walking officer's speed (the bob is measured against it) when the library has none. */
const WALK_SPEED = 1.4;
+/** The Sovereign's sleeves: black velvet with a gold cuff (its own colours, whatever the rank). */
+export const SOVEREIGN_ARMS: ArmColours = { uniform: "#201e23", trim: "#201e23", cuff: "#d1a650", skin: "#c2b4a8" };
+
export function armColours(library: CharacterLibrary | null, look: Look): ArmColours {
+ if (library?.contract.models.some((m) => m.id === COMMANDER_SKIN)) return SOVEREIGN_ARMS;
const tier = library?.contract.tiers[look.tier];
return tier ? { uniform: tier.M_Uniform, trim: tier.M_Trim } : FALLBACK;
}
export function ViewmodelLayer({ runtime, duel, deck, library, commanderId, commanderLook }: Props) {
- const { uniform, trim } = armColours(library, commanderLook);
+ const { uniform, trim, cuff, skin } = armColours(library, commanderLook);
const vmRef = useRef<Viewmodel | null>(null);
const [vm, setVm] = useState<Viewmodel | null>(null);
useEffect(() => {
@@ -61,7 +65,7 @@ export function ViewmodelLayer({ runtime, duel, deck, library, commanderId, comm
// The arms are the commander's own: the officer body the deck and the duel draw for them (same choice by id).
useEffect(() => {
if (!library || !vm) return;
- const model = library.model("officer", undefined, hash32(commanderId));
+ const model = library.model("officer", COMMANDER_SKIN, hash32(commanderId));
if (!model) return;
let alive = true;
library.instantiate(model).then((instance) => {
@@ -76,7 +80,7 @@ export function ViewmodelLayer({ runtime, duel, deck, library, commanderId, comm
return () => { alive = false; };
}, [vm, library, commanderId]);
// The sleeves wear the commander's uniform (a promotion repaints them).
- useEffect(() => { vm?.setColours({ uniform, trim }); }, [vm, uniform, trim]);
+ useEffect(() => { vm?.setColours({ uniform, trim, cuff, skin }); }, [vm, uniform, trim, cuff, skin]);
const frame = useMemo<ViewmodelFrame>(() => ({
visibility: { arms: false, mode: "deck", hideOwnBody: false, raise: 0 },
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/armMesh.ts b/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/armMesh.ts
index 89580d996e..b37fd78d2a 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/armMesh.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/armMesh.ts
@@ -116,8 +116,8 @@ export const CUT = {
const SLOT_CODES: ArmSlot[] = ["uniform", "trim", "skin", "other"];
function slotOf(name: string): ArmSlot {
- if (name === "M_Uniform" || name === "M_Undersuit") return "uniform";
- if (name === "M_Trim") return "trim";
+ if (name === "M_Uniform" || name === "M_Undersuit" || name === "M_SovRobe") return "uniform";
+ if (name === "M_Trim" || name === "M_SovTrim") return "trim";
if (name === "M_Skin" || name === "M_Gloves") return "skin";
return "other";
}
diff --git a/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/viewmodel.ts b/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/viewmodel.ts
index e33790c1fc..1614a1ac7d 100644
--- a/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/viewmodel.ts
+++ b/dodaios/ui/web/frontend/src/components/society/verse/viewmodel/viewmodel.ts
@@ -148,6 +148,10 @@ const POLE_L = new Vector3();
export interface ArmColours {
uniform: string;
trim: string;
+ /** A cuff of its own colour (the Sovereign's gold); without it the cuff wears the cloth. */
+ cuff?: string;
+ /** Bare hands of this colour instead of the gloves. */
+ skin?: string;
}
/** The arms' own drawing: the bones of both arms, their skinned mesh and its material. */
@@ -366,7 +370,7 @@ export class Viewmodel {
const gloves = VIEWMODEL.gloves;
const cloth = new Color(colours.uniform);
const tint: Record<ArmSlot, Color> = {
- uniform: cloth, trim: cloth, skin: gloves ? new Color(gloves) : src.authored.skin, other: src.authored.other,
+ uniform: cloth, trim: colours.cuff ? new Color(colours.cuff) : cloth, skin: colours.skin ? new Color(colours.skin) : gloves ? new Color(gloves) : src.authored.skin, other: src.authored.other,
};
const order: ArmSlot[] = ["uniform", "trim", "skin", "other"];
const attr = arms.mesh.geometry.getAttribute("color") as BufferAttribute;
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json
index 6031fbe0b2..48a8fc47ba 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.de.json
@@ -5,8 +5,8 @@
"loading": "Deck wird geladen",
"unavailable": "Das Schiff braucht WebGL, das dieses Fenster gerade nicht starten kann.",
"deck_missing": "Dieses Deck ist noch nicht gebaut.",
- "help": "Third Person: WASD oder Pfeiltasten steuern den Kommandanten, Shift läuft schneller, E benutzt die Station in Reichweite. 1, 2 und 3 wählen Vogelperspektive, Third Person oder Ego-Perspektive; V schaltet der Reihe nach durch. Ziehen verschiebt die Ansicht, Scrollen zoomt. Ein Klick auf das Deck schickt dich dorthin, ein Klick auf ein Crewmitglied öffnet seine Akte.",
- "help_eye": "Third Person und Ego-Perspektive steuern sich wie ein Shooter: Ein Klick in die Ansicht fängt die Maus, Bewegen dreht die Kamera, Esc gibt sie frei. WASD läuft relativ zur Blickrichtung, Shift läuft schneller; die linke Maustaste oder E benutzt, worauf das Fadenkreuz zeigt (ein Crewmitglied, eine Station), sonst benutzt E die Station in Reichweite. Scrollen holt die Kamera näher heran oder weiter weg: ganz heran ist die Ego-Perspektive, wieder herausscrollen kehrt zurück. 1, 2 und 3 wählen Vogelperspektive, Third Person oder Ego-Perspektive; V schaltet der Reihe nach durch. Der Einstellungsknopf in der Werkzeugleiste regelt Mausempfindlichkeit, umgekehrte Achse, Sichtfeld und Qualität."
+ "help": "Third Person: WASD oder Pfeiltasten steuern den Kommandanten, Shift läuft schneller, E benutzt die Station in Reichweite. 1, 2 und 3 wählen Vogelperspektive, Third Person oder Ego-Perspektive; V schaltet der Reihe nach durch. Ziehen verschiebt die Ansicht, Scrollen zoomt. Ein Klick auf das Deck schickt dich dorthin, ein Klick auf ein Crewmitglied öffnet seine Akte. F gedrückt halten entfesselt den Bogensturm: Blitze aus beiden Händen.",
+ "help_eye": "Third Person und Ego-Perspektive steuern sich wie ein Shooter: Ein Klick in die Ansicht fängt die Maus, Bewegen dreht die Kamera, Esc gibt sie frei. WASD läuft relativ zur Blickrichtung, Shift läuft schneller; die linke Maustaste oder E benutzt, worauf das Fadenkreuz zeigt (ein Crewmitglied, eine Station), sonst benutzt E die Station in Reichweite. Scrollen holt die Kamera näher heran oder weiter weg: ganz heran ist die Ego-Perspektive, wieder herausscrollen kehrt zurück. 1, 2 und 3 wählen Vogelperspektive, Third Person oder Ego-Perspektive; V schaltet der Reihe nach durch. Der Einstellungsknopf in der Werkzeugleiste regelt Mausempfindlichkeit, umgekehrte Achse, Sichtfeld und Qualität. F gedrückt halten entfesselt den Bogensturm: Blitze aus beiden Händen."
},
"deck": {
"label": "Deck {n}",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json
index 5c44515323..241d321986 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.en.json
@@ -5,8 +5,8 @@
"loading": "Loading deck",
"unavailable": "The ship needs WebGL, which this window cannot start right now.",
"deck_missing": "This deck has not been built yet.",
- "help": "Third person: WASD or the arrow keys walk the commander, Shift hurries, E works the station within reach. 1, 2 and 3 pick the bird's-eye view, third or first person; V cycles them. Drag to look around, scroll to zoom. Click the deck to walk there, click a crew member for their record.",
- "help_eye": "Third and first person play like a shooter: a click on the view takes the mouse, moving it turns the camera, Esc gives it back. WASD walks relative to the view, Shift hurries; the left button or E works what the crosshair is on (a crew member, a station), else E works the station within reach. Scroll to move the camera in or out: all the way in is first person, scrolling out of it comes back. 1, 2 and 3 pick the bird's-eye view, third or first person; V cycles them. The settings button on the tool rail sets mouse sensitivity, inverted look, field of view and quality."
+ "help": "Third person: WASD or the arrow keys walk the commander, Shift hurries, E works the station within reach. 1, 2 and 3 pick the bird's-eye view, third or first person; V cycles them. Drag to look around, scroll to zoom. Click the deck to walk there, click a crew member for their record. Hold F to unleash Arc Storm, lightning from both hands.",
+ "help_eye": "Third and first person play like a shooter: a click on the view takes the mouse, moving it turns the camera, Esc gives it back. WASD walks relative to the view, Shift hurries; the left button or E works what the crosshair is on (a crew member, a station), else E works the station within reach. Scroll to move the camera in or out: all the way in is first person, scrolling out of it comes back. 1, 2 and 3 pick the bird's-eye view, third or first person; V cycles them. The settings button on the tool rail sets mouse sensitivity, inverted look, field of view and quality. Hold F to unleash Arc Storm, lightning from both hands."
},
"deck": {
"label": "Deck {n}",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json
index 5ef3618d79..9d525d499d 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.es.json
@@ -5,8 +5,8 @@
"loading": "Cargando cubierta",
"unavailable": "La nave necesita WebGL y esta ventana no puede iniciarlo ahora.",
"deck_missing": "Esta cubierta aún no está construida.",
- "help": "Tercera persona: WASD o las flechas mueven al comandante, Shift acelera, E usa la estación al alcance. 1, 2 y 3 eligen vista de pájaro, tercera o primera persona; V las recorre. Arrastra para mirar, desplaza para hacer zoom. Haz clic en la cubierta para ir allí, en un tripulante para ver su ficha.",
- "help_eye": "La tercera y la primera persona se juegan como un shooter: un clic en la vista captura el ratón, moverlo gira la cámara, Esc lo libera. WASD camina según la vista, Shift acelera; el botón izquierdo o E usa lo que señala la mira (un tripulante, una estación); si no, E usa la estación al alcance. La rueda acerca o aleja la cámara: del todo cerca es primera persona y alejarse vuelve. 1, 2 y 3 eligen vista de pájaro, tercera o primera persona; V las recorre. El botón de ajustes de la barra regula la sensibilidad del ratón, el eje invertido, el campo de visión y la calidad."
+ "help": "Tercera persona: WASD o las flechas mueven al comandante, Shift acelera, E usa la estación al alcance. 1, 2 y 3 eligen vista de pájaro, tercera o primera persona; V las recorre. Arrastra para mirar, desplaza para hacer zoom. Haz clic en la cubierta para ir allí, en un tripulante para ver su ficha. Mantén F para desatar la Tormenta de Arcos: rayos de ambas manos.",
+ "help_eye": "La tercera y la primera persona se juegan como un shooter: un clic en la vista captura el ratón, moverlo gira la cámara, Esc lo libera. WASD camina según la vista, Shift acelera; el botón izquierdo o E usa lo que señala la mira (un tripulante, una estación); si no, E usa la estación al alcance. La rueda acerca o aleja la cámara: del todo cerca es primera persona y alejarse vuelve. 1, 2 y 3 eligen vista de pájaro, tercera o primera persona; V las recorre. El botón de ajustes de la barra regula la sensibilidad del ratón, el eje invertido, el campo de visión y la calidad. Mantén F para desatar la Tormenta de Arcos: rayos de ambas manos."
},
"deck": {
"label": "Cubierta {n}",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json
index 8c519e68cf..aab7d215da 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.pt.json
@@ -5,8 +5,8 @@
"loading": "Carregando o convés",
"unavailable": "A nave precisa de WebGL, que esta janela não consegue iniciar agora.",
"deck_missing": "Este convés ainda não foi construído.",
- "help": "Terceira pessoa: WASD ou as setas movem o comandante, Shift acelera, E usa a estação ao alcance. 1, 2 e 3 escolhem vista aérea, terceira ou primeira pessoa; V alterna entre elas. Arraste para olhar, role para dar zoom. Clique no convés para ir até lá, num tripulante para ver a ficha.",
- "help_eye": "A terceira e a primeira pessoa funcionam como um shooter: um clique na vista captura o mouse, movê-lo gira a câmera, Esc o libera. WASD anda conforme a vista, Shift acelera; o botão esquerdo ou E usa o que a mira aponta (um tripulante, uma estação); senão, E usa a estação ao alcance. A roda aproxima ou afasta a câmera: tudo perto é primeira pessoa, e afastar volta. 1, 2 e 3 escolhem vista aérea, terceira ou primeira pessoa; V alterna entre elas. O botão de ajustes da barra define a sensibilidade do mouse, o eixo invertido, o campo de visão e a qualidade."
+ "help": "Terceira pessoa: WASD ou as setas movem o comandante, Shift acelera, E usa a estação ao alcance. 1, 2 e 3 escolhem vista aérea, terceira ou primeira pessoa; V alterna entre elas. Arraste para olhar, role para dar zoom. Clique no convés para ir até lá, num tripulante para ver a ficha. Segure F para liberar a Tempestade de Arcos: raios das duas mãos.",
+ "help_eye": "A terceira e a primeira pessoa funcionam como um shooter: um clique na vista captura o mouse, movê-lo gira a câmera, Esc o libera. WASD anda conforme a vista, Shift acelera; o botão esquerdo ou E usa o que a mira aponta (um tripulante, uma estação); senão, E usa a estação ao alcance. A roda aproxima ou afasta a câmera: tudo perto é primeira pessoa, e afastar volta. 1, 2 e 3 escolhem vista aérea, terceira ou primeira pessoa; V alterna entre elas. O botão de ajustes da barra define a sensibilidade do mouse, o eixo invertido, o campo de visão e a qualidade. Segure F para liberar a Tempestade de Arcos: raios das duas mãos."
},
"deck": {
"label": "Convés {n}",
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json
index 76ce75d5de..1f37428f82 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/ship/verse.zh.json
@@ -5,8 +5,8 @@
"loading": "正在载入甲板",
"unavailable": "飞船需要 WebGL,但此窗口目前无法启动它。",
"deck_missing": "这层甲板尚未建成。",
- "help": "第三人称:WASD 或方向键操控指挥官,Shift 加速,E 使用附近的工作站。1、2、3 分别选择鸟瞰、第三人称或第一人称;V 依次切换。拖动环顾四周,滚轮缩放。点击甲板走过去,点击船员查看其档案。",
- "help_eye": "第三人称和第一人称的操作与射击游戏相同:点击画面锁定鼠标,移动鼠标转动镜头,Esc 释放。WASD 按视角方向行走,Shift 加速;鼠标左键或 E 使用准星所指的对象(船员或工作站),否则 E 使用附近的工作站。滚轮拉近或拉远镜头:拉到最近即进入第一人称,向外滚动则返回。1、2、3 分别选择鸟瞰、第三人称或第一人称;V 依次切换。工具栏中的设置按钮可调整鼠标灵敏度、反转视角、视野和画质。"
+ "help": "第三人称:WASD 或方向键操控指挥官,Shift 加速,E 使用附近的工作站。1、2、3 分别选择鸟瞰、第三人称或第一人称;V 依次切换。拖动环顾四周,滚轮缩放。点击甲板走过去,点击船员查看其档案。 按住 F 释放电弧风暴:双手迸发闪电。",
+ "help_eye": "第三人称和第一人称的操作与射击游戏相同:点击画面锁定鼠标,移动鼠标转动镜头,Esc 释放。WASD 按视角方向行走,Shift 加速;鼠标左键或 E 使用准星所指的对象(船员或工作站),否则 E 使用附近的工作站。滚轮拉近或拉远镜头:拉到最近即进入第一人称,向外滚动则返回。1、2、3 分别选择鸟瞰、第三人称或第一人称;V 依次切换。工具栏中的设置按钮可调整鼠标灵敏度、反转视角、视野和画质。 按住 F 释放电弧风暴:双手迸发闪电。"
},
"deck": {
"label": "第 {n} 层甲板",