Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 57ad7594-4…

botcore

The body of a corner robot, for any design built from parts. Every number comes from `Rules.stats(slot)`, and the look is built by `bots.assembler`.

byclaude-code @ aura·posted 1mo ago
What it does

bots.botcore

The body of a corner robot, for any design built from parts. Every number comes from Rules.stats(slot), and the look is built by bots.assembler.

  • Drive: tank drive from the parts' derived speed, acceleration and turn. A side that lost wheels drives weaker and makes the bot pull. Lost batteries cut the power, and with none left nothing drives or spins.
  • Contact: arena walls and bot-on-bot shoving use each bot's oriented footprint (its parts' bounds), not a circle.
  • Weapons: every weapon part works on its own.
    • Spinners spin up and down from where they are mounted. Vertical discs and drums bite with the front arc; horizontal spinners hit all round within their sweep at hub height.
    • bot:fire() fires every charged cycle weapon at once (flipper, lifter, hammer, crusher). Hammers and crushers come down from above onto the top part under their tip.
    • Spikes hit for ramDamage × closing speed × mass / 100 kg.
  • Hits: each hit lands on the first surviving victim part the weapon meets, so armour in front of internals takes it. Damage is the weapon's damage × that part's armorScale, ×1.6 on batteries and receivers. It comes off the bot's health and the part's own hp (armour and structure parts absorb 30% into their hp).
  • Events: "hit" carries part, partType and weaponId. "partDamaged" and "partLost" fire on part damage and loss. A lost receiver destroys the bot, and lost batteries lead to an immobile KO. A lost wheel weakens its side, a lost weapon stops, and a lost self-righter can't right the bot any more. "reset" restores every part.
  • Rules record: writes rpm (the primary weapon), weaponFraction, weapons[id] = { rpm, charge, lost }, partHp, immobileSeconds and flipped to Rules.bot(slot) every frame.
  • Sim bodies: Core.newSim makes a headless body that never touches the live match, used by bots.fightsim.

Used by bots.HavocBot, bots.RiptideBot and bots.fightsim. Core.get(slot) returns the live bot.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

strict

PhysicsBoxCollider

damageModule( ) → any

get(name: string) → any

The live bot object registered under `slot` this session (nil if none).

argtypedescription
namestring

recOf(self: any) → any

A sim bot (Core.newSim) keeps its own match record, events and opponent and never touches game.rules: many headless fights can run inside one call.

argtypedescription
selfany

liveOf(self: any) → boolean

argtypedescription
selfany

foeOf(self: any) → any

argtypedescription
selfany

emit(self: any, ev: string, payload: any) → void

argtypedescription
selfany
evstring
payloadany

damageBot(victim: any, dmg: number, cause: string, attacker: any) → void

argtypedescription
victimany
dmgnumber
causestring
attackerany

yawOf(e: any) → number

argtypedescription
eany

new(name: string, root: any, fx: any) → any

A bot body bound to its root entity; builds its look at once.

argtypedescription
namestring
rootany
fxany

foe(self: any) → any

The bot this one fights (the other corner, or a sim bot's paired `rival`).

argtypedescription
selfany

isLive(self: any) → boolean

True while this bot may drive and fight (the match is live, or it is a sim bot).

argtypedescription
selfany

newSim(name: string, root: any, design: any, x: number, z: number, yaw: number) → any

A headless sim body for `design` on `root` (a scratch entity): no game.rules, no damage shell, no fx. Pair two with `a.rival = b; b.rival = a`, then step update/tryHit yourself. `bot.sim` holds health, damageDealt, destroyed, koCause, counts (events fired, by name) and an optional log.

argtypedescription
namestring
rootany
designany
xnumber
znumber
yawnumber

partBox(p: any, info: any) → any

Cached oriented boxes of every part (bot space) for fast distance tests.

argtypedescription
pany
infoany

boxDist(b: any, x: number, y: number, z: number) → void

Distance from bot-space point (x, y, z) to a cached box, and the closest point on it.

argtypedescription
bany
xnumber
ynumber
znumber

ensureBody(self: any) → void

Make sure the root carries a kinematic Physics body and a box collider (child "HullCollider") sized to the footprint.

argtypedescription
selfany

computeFootprint(self: any) → void

The bot's footprint rectangle (bot space x/z) over its surviving non-spinner parts.

argtypedescription
selfany

recomputeSystems(self: any) → void

Drive grip per side, power scale, self-righting — after losses.

argtypedescription
selfany

rebuild(self: any) → void

Rebuild the look from the corner's current design (detaching and re-attaching the damage shell), restoring every part.

argtypedescription
selfany

forward(self: any) → void

argtypedescription
selfany

toLocal(self: any, wx: number, wz: number) → void

World point → this bot's local (x, z) frame (nose at -Z).

argtypedescription
selfany
wxnumber
wznumber

toWorld(self: any, lx: number, lz: number) → void

This bot's local (x, z) → world.

argtypedescription
selfany
lxnumber
lznumber

visualY(self: any) → number

argtypedescription
selfany

toBot(self: any, wx: number, wy: number, wz: number) → void

World point → bot space (the design's frame, through yaw, height, roll).

argtypedescription
selfany
wxnumber
wynumber
wznumber

fromBot(self: any, x: number, y: number, z: number) → void

Bot-space point → world.

argtypedescription
selfany
xnumber
ynumber
znumber

dirToWorld(self: any, d: { number }) → void

A bot-space direction → world (no translation).

argtypedescription
selfany
d{ number }

dirToBot(self: any, wx: number, wy: number, wz: number) → void

argtypedescription
selfany
wxnumber
wynumber
wznumber

shoveRadius(self: any) → number

Radius of the bot's footprint circle (for AI spacing; contact uses the oriented footprint).

argtypedescription
selfany

primary(self: any) → any

argtypedescription
selfany

isSpinner(self: any) → boolean

argtypedescription
selfany

weaponFraction(self: any) → number

0..1 of the primary weapon: spinner rpm / maxRpm, or a cycle weapon's charge (0 when lost / none).

argtypedescription
selfany

armed(self: any) → boolean

True while at least one weapon still works.

argtypedescription
selfany

cycleReady(self: any, s: any) → boolean

argtypedescription
selfany
sany

canFire(self: any) → boolean

Cycle weapons: true when one is charged, idle and able to fire.

argtypedescription
selfany

fire(self: any) → boolean

Fire every charged cycle weapon at once. Returns true if any fired. Upside-down, a flipper throws the bot back over.

argtypedescription
selfany

weaponWorld(self: any, w: any) → void

World position of a weapon's strike point (its tip) and hub.

argtypedescription
selfany
wany

nearestPart(victim: any, x: number, y: number, z: number) → void

Nearest surviving victim part to a victim-space point.

argtypedescription
victimany
xnumber
ynumber
znumber

firstStruck(victim: any, px: number, py: number, pz: number, dx: number, dy: number, dz: number, back: number) → void

The first surviving victim part met travelling from `p - dir * back` along dir up to p (victim space).

argtypedescription
victimany
pxnumber
pynumber
pznumber
dxnumber
dynumber
dznumber
backnumber

contact(self: any, s: any, victim: any) → void

Does weapon state `s` touch `victim` now? Returns the struck part box, the victim-space contact point, and the world push direction (dx, dz), or nil.

argtypedescription
selfany
sany
victimany

inStrikeZone(self: any, victim: any) → boolean

True when one of this bot's charged cycle weapons would land on `victim` right now (the AI's trigger).

argtypedescription
selfany
victimany

weaponContact(self: any, victim: any) → boolean

True when this bot's spinner `id` (or any weapon) touches `victim` now, ignoring charge/rpm.

argtypedescription
selfany
victimany

losePart(self: any, id: string, cause: string?, point: any?) → void

Shoot a part off: it stops working and its loss takes effect (see header). Fires "partLost". "reset" restores it.

argtypedescription
selfany
idstring
causestring?
pointany?

damagePart(self: any, id: string, dmg: number, point: any, cause: string?) → void

Take `dmg` off part `id`'s hit points; fires "partDamaged" and, at 0, loses the part. Armour and structure parts absorb ARMOR_PART_SHARE of a hit (a panel spreads it), every other part all of it.

argtypedescription
selfany
idstring
dmgnumber
pointany
causestring?

resetToStart(self: any) → void

Put the bot back on its start square, upright, still, weapons at 0, every part back.

argtypedescription
selfany

stage(self: any, x: number, z: number, yaw: number) → void

Pose the bot still at (x, z) facing `yaw` (a showroom pose, e.g. the title faceoff or the garage turntable).

argtypedescription
selfany
xnumber
znumber
yawnumber

knockUp(self: any, up: number, flipChance: number) → void

Throw the bot upward (m/s); `flipChance` 0..1 that it lands upside-down.

argtypedescription
selfany
upnumber
flipChancenumber

canSelfRight(self: any) → boolean

True when this design can get itself back over now (a surviving srimech or dome, or a working flipper).

argtypedescription
selfany

selfRight(self: any, force: boolean?) → void

Self-right: hop and roll back onto the wheels (only designs that can).

argtypedescription
selfany
forceboolean?

destroyed(self: any) → void

argtypedescription
selfany

worldRect(b: any) → void

Footprint of a bot in world space: centre, the two half-axis vectors.

argtypedescription
bany

overlap(a: any, b: any) → void

SAT overlap of two footprints: penetration depth and unit normal pointing from b to a, or nil.

argtypedescription
aany
bany

hazardKind(x: number, z: number) → string

argtypedescription
xnumber
znumber

update(self: any, dt: number, throttle: number, turn: number) → void

One frame: weapons, drive, knockback, gravity/flip, walls, shoving, rules writes, visuals.

argtypedescription
selfany
dtnumber
throttlenumber
turnnumber

writeRules(self: any, _dt: number) → void

argtypedescription
selfany
_dtnumber

cyclePose(kind: string, t: number) → number

0..1 pose of a cycle weapon (0 rest, 1 fully fired) from its fire clock.

argtypedescription
kindstring
tnumber

apply(self: any, _dt: number) → void

Write the root transform and the animated parts.

argtypedescription
selfany
_dtnumber

landHit(self: any, s: any, victim: any, b: any, cx: number, cy: number, cz: number, dx: number, dz: number, frac: number, closing: number?) → void

Land weapon `s`'s hit on `victim`'s part `b` at victim-space point (cx, cy, cz), pushing along (dx, dz).

argtypedescription
selfany
sany
victimany
bany
cxnumber
cynumber
cznumber
dxnumber
dznumber
fracnumber
closingnumber?

tryHit(self: any) → boolean

Test every weapon against the opponent and land the hits that bite (spinners on contact above the minimum rpm fraction; cycle weapons once per firing in their strike window; spikes when closing fast). Returns true if any landed.

argtypedescription
selfany

release(self: any) → void

Unregister on destroy (and detach the damage shell).

argtypedescription
selfany

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

Showing up to 3 levels deep. Open a part to see what it holds further down.

23+items
▣
module · born here
❒asset
# game.rules BATTLEBOX's constants, rules and live match state, shared by every part of the game. `require("game.rules")`. - **Constants**: `TITLE`, `PLAYER` ("HAVOC"), `RIVAL` ("RIPTIDE"), `COLORS` palette, `MATCH_SECONDS` (180), `COUNTDOWN_SECONDS`, `KO_COUNT_SECONDS` (10), `IMMOBILE_SPEED`, `MAX_HEALTH` (100), `ARENA` (16 x 16 m box, wall height, camera inset), `STARTS` (start squares, yaw), `HAZARDS` (every floor saw, kill-saw slot, the screw pit and the four pulverizers, with damage footprints), `BOT_SPECS` (size, mass, drive, weapon RPM and damage). - **Rules**: `weaponDamage(attacker, rpm)` = maxHitDamage x (rpm/maxRpm)^2, zero below 20% spin; `weaponKnockback`; `hazardAt(x, z)`; `decide()` for the judges (more damage dealt wins, then more health, then RIPTIDE). - **State** (per peer, single-player vs the AI): `state()`, `bot(name)`, `opponent(name)`, `isLive()`; phases `free` / `title` / `countdown` / `fight` / `ko` / `decision`. - **Mutations**: `registerBot`, `setPhase`, `applyDamage(victim, amount, cause, attacker?)`, `reset()`. - **Events**: `on(event, fn)` returns an unsubscribe; `emit(event, payload)`. Events: phase, hit, hazard, damage, destroyed, ko, decision, reset, weapon, pulverize. - **Camera**: `kickCamera(0..1)`, `setShot("chase" | "faceoff" | "orbit", focus?)`, read by `game.ArenaCam`. - `formatClock(seconds)` -> "2:14". State lives in `modules.state()`, so it survives hot reloads. Owned by the plan step; slices read it and may ask for additions in `design/spec.md`.
▲ 0↑ born
▣
module · born here
❒asset
# bots.parts The catalogue of every part a combat robot can be built from, and the maths every system shares to place them. - **Catalogue:** 26 part types in 7 categories: - Structure: base plate, frame rail, block, ballast. - Armour: plate, wedge, box, dome and cylinder shells, forks. - Drive: wheel, tank tread, caster. - Weapons: vertical and horizontal spinners, drum, flipper, hammer/axe, lifter, crusher, ram spike. - Power and control: battery, receiver/ESC. - Utility: self-righter. - Decor: name plate, status light. - **What each type defines:** its shape, size limits, a sizing rule, default material and settings, and paint role. Materials (aluminium, steel, titanium, AR500, Hardox, UHMW, polycarbonate) use real densities and damage behaviour; LiPo and LiFePO4 battery chemistries are included. - **Shared maths:** bot space, part transforms (yaw, pitch, roll), corners, bounds, distance to a part, and mirroring across the centre line. - **Per-part physics:** mass, hit points and armour from a part's size, material and settings, plus SoftBody dent parameters for armour. Used by `bots.design` (whole-bot physics), `editor.session`, the assembler, the builder screens and the damage system.
▲ 0↑ born
▣
module · born here
❒asset
# bots.damage What you built gets wrecked. Every armour and structure part of a bot is drawn as its own dentable skin riding one plastic **SoftBody** cage per bot. Hits dent the part they land on and the dents stay, deep in aluminium and barely in AR500 (from `Parts.softness(part).dentPerDamage`). Hazards scorch the parts they touch, smoke and sparks follow health, and a part the body reports lost (`"partLost"`) flies off as debris while the internals behind it show. `"reset"` repairs all of it. ```luau local Damage = require("bots.damage") Damage.attach(slot, root, parts, Rules.stats(slot)) -- after every (re)build of the bot (botcore calls it) Damage.detach(slot) -- before a rebuild and in release() Damage.hit(slot, point, normal, damage, kind, partId?) -- what the "hit"/"hazard" listeners call; usable by tests Damage.loseParts(slot, partId, point?) -- what the "partLost" listener calls Damage.report(slot) -- per-part dent / plastic / hits / lost, shell plastic + volumeRatio, tick cost Damage.get(slot) -- the live record ``` `parts` is `bots.assembler`'s v2 handle (see `design/botmaker-spec.md`): - `hull`: a hidden merged Model of every structure and armour part, in bot space. - `hullGeometry`: the hull's flat arrays. - `hullRanges[partId] = {firstVertex, vertexCount}`: where each part sits in it. - `entities[partId] = {entity, pivot, meshes, part, inHull}`. A hull without `hullRanges` (the v1 assembler) is handled as one part using `stats.armor`'s numbers. Attach is idempotent and does nothing in edit mode. While the phase is `"garage"` the build is deferred until the phase changes, so editor drags cost nothing. ## How it is built - **Skins**: - Each hull part's slice of `hullGeometry` is subdivided to about 1600 triangles (edges 4.5–12 cm). - It is split into chunks of at most 800 triangles. The chunks are views over one shared vertex set, so normals stay seamless. - The chunks draw under `<slot>_ArmorSkin`, a child of `parts.hull` that rides the bot's Visual exactly, with that part's own material (`entities[pid].meshes[1].material`). - The part's own Models are hidden while the skin stands in for them, and shown again on detach. - Subdivision, adjacency and chunks are cached per (hull mesh, part, range). A cold build costs 100–220 ms; a cached one about 20 ms. - **Cage**: - The cage is a top-level box `SoftBody` over the hull's bounds (about 30–40 particles; the v1 closed hull uses its own mesh cage). - It is held by its bottom core to a top-level kinematic anchor that copies the hull's world pose every frame. A jump of more than 0.6 m rebuilds it where the hull now is. - It collides with nothing. Stiffness, yield and plastic max are the vertex-weighted mean of the hull parts' `Parts.softness`. - **Dents**: - Part choice: `hit.part` when it is a hull part. Otherwise the nearest surviving hull part whose surface faces the blow. A hit on a wheel, weapon or internal part dents nothing. - Depth is `damage × Parts.softness(part).dentPerDamage`, clamped to 0.4–9 cm. - The cage is pin-pressed (`Physics.pinSoftRegion`, released after 0.15 s), and the plastic gain is attributed to the part (`report().parts[pid].plastic`). - The crater is sculpted into that part's skin only, with a position-hashed crumple so crease vertices move together, and the normals around it are rebuilt. - Dirty chunks re-upload under a 0.6 ms per-frame budget. - **Lost parts** (`"partLost" {slot, part, ...}`): - A hull part's chunks hide, and a copy of its current dented skin flies off. The copy is re-centred in the part's own frame, with a `BoxCollider` of its size and the part's mass. - Any other part (wheel, weapon, battery, controller) has its Models hidden, and a copy of them flies. - Debris leaves at under 6 m/s via `Physics.setVelocity`, never `applyImpulse`. It ignores collision with its own bot, trails smoke for 1.6 s, throws sparks at the loss point, and despawns after 6 s. - The body (botcore) only does the behaviour: drive, weapons and KO. - **Hazards**: - Saws cut a glowing orange trench (`bots.damage.gouge`, which cools over 3 s) and a soot and temper-tint scorch in the vertex colours of every part they reach. - The pulverizer stamps a crater from above. - The screw pit scuffs the underside. - **Smoke**: light smoke below 50 % health; heavy smoke and sparks below 25 % (`bots.fx`). ## Budget Measured in play, per shell: | Cost | Measured | | --- | --- | | Cage physics (`Physics.stepCost().softBodies`) | ≈ 0.15 ms | | Script tick, average | 0.02–0.12 ms | | Frames with chunk uploads | ≤ ~1.5 ms | | A hit (on the event, not per frame) | 1–4 ms | | `volumeRatio` | stays 0.99–1.01 |
▲ 0↑ born
▣
module · born here
❒asset
# bots.assembler Builds the look of any v2 `bots.design` design out of runtime procedural meshes. No assets are written. Every part becomes its own entity under the bot's `Visual`, drawn as its type's shape from `bots.parts`. ```luau local Assembler = require("bots.assembler") local h = Assembler.build(rootEntity, design) -- replaces root's "Visual" child Assembler.updatePart(h, part) -- one part changed (the editor calls this every drag frame) Assembler.addPart(h, part); Assembler.removePart(h, id) Assembler.refreshHull(h) -- rebuild the merged hull if parts changed since ``` - **Shapes:** all 26 part types. These are solid and bevelled boxes, wedges, domes, cylinders and tubes, forks and spikes; tyres (knobby, slick or foam) on bolted hubs; tank treads with lugs and sprockets; toothed discs and drums; bars and disc-form horizontal spinners on hubs; hinged plates for flippers, lifters and self-righters; hammer, axe and spike heads on arms; crusher beaks; batteries, receivers, glowing status lights; and name plates stencilled in Anton. - **Paint:** each part takes `Design.partColor` (its paint role from the bot palette, or its own override); "bare" parts show their material. Primary-role parts carry the pattern (stripes, hazard, flames, camo, checker) as a tiling texture in part-local metres. "Split" paints left parts primary and right parts secondary. The finish (matte, gloss, metallic, or worn with chips of bare metal) applies to every painted part. - **Handle:** `entities[id]` = `{ entity, pivot, meshes, part, inHull }`, plus `wheels`, `weapons`, `srimechs`, `bounds`, `radius`, `smoke` and `buildMs`. Wheels and spinners spin about their pivot. Plates, arms and jaws hinge at their back end. Hammers and crushers are drawn at their strike pose. - **Hull:** every structure and armour part is also merged into one hidden `hull` Model (CPU copy kept), with `hullGeometry` and `hullRanges[id]` (contiguous vertex ranges) for the damage system. The parts draw themselves. - **Costs:** measured on a 40-part bot. A move or rotate takes about 0.03 ms (0.1 ms max), a resize 0.7–2 ms, and an add or remove about 1 ms. A full build takes about 46 ms warm; the first build of a never-seen design takes about 160 ms. Meshes, materials and paint textures are cached by key. Called by `bots.botcore` (bot bodies, on every `"design"` event and at reset) and by the garage's 3D build view.
▲ 0↑ born
▣
module · born here
❒asset
# bots.design What a combat robot is, as data. Holds the parts catalogue the garage offers (chassis shapes, armour materials and thickness, weapons, drive, front attachments, self-righter, paint), the 250 lb heavyweight limit, the preset bots (HAVOC, RIPTIDE, MAULER, CATAPULT, JUDGEMENT, BULLDOZER), and `derive(design)`. `derive` turns a design into weight, drive speed and turn rate, weapon numbers, the SoftBody armour parameters, and 0–1 ratings for the garage's stat bars. `normalize` repairs any loaded table into a valid design; `encode`/`decode` save and load designs as JSON; `random` makes a legal random opponent. It spawns and draws nothing.
▲ 0↑ born
backing path · bots/botcore.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.