Unit schema
One unit per TOML file under a content pack's content/units/. What the
loader does with it, and what it does not: ../README.md.
The FBI field named in each table is the TA field the value corresponds to.
Fields
| Field | Type | Rule | FBI |
|---|---|---|---|
id |
string | Required, Identifier Rules. | UnitName |
name |
string | Required, non-empty. | Name |
description |
string | Description |
|
side |
string | Free label. | Side |
category |
string | Free label. | Category |
max_health |
integer | Non-negative. | MaxDamage |
sight_distance |
number | Non-negative, world units. | SightDistance |
weapons |
array of string | Positional fully qualified weapon ids (<mod-id>.<weapon-id>), each a weapon in this pack. No fixed weapon-count ceiling; the first three retain TA slot meanings. |
WeaponN |
cloak_cost |
integer | Non-negative. Energy drain while cloaked and still; above 0 makes the unit able to cloak. | CloakCost |
cloak_cost_moving |
integer | Non-negative. Energy drain while cloaked and moving. | CloakCostMoving |
min_cloak_distance |
number | Non-negative. An enemy this close decloaks the unit. | MinCloakDistance |
Put weapons and every other top-level field above the first [section]
header: TOML places a key written after [cost] inside cost, and the
loader reports a weapons or production key found inside [footprint],
[cost], [capabilities] or [movement].
[footprint]
| Field | Type | Rule | FBI |
|---|---|---|---|
x |
integer | Positive, cells. | FootprintX |
z |
integer | Positive, cells. | FootprintZ |
[cost]
| Field | Type | Rule | FBI |
|---|---|---|---|
metal |
integer | Non-negative. | BuildCostMetal |
energy |
integer | Non-negative. | BuildCostEnergy |
build_time |
integer | Non-negative. | BuildTime |
[capabilities]
Booleans, false when absent; a value that is not a boolean is ignored.
| Field | FBI |
|---|---|
can_attack |
CanAttack |
can_move |
CanMove |
is_builder |
Builder |
[movement]
| Field | Type | Rule | FBI |
|---|---|---|---|
type |
string | One of ground, air, hover, naval, static. |
MovementClass (air also CanFly) |
speed |
number | Non-negative. | MaxVelocity |
turn_rate |
number | Non-negative. | TurnRate |
Native runtime asset bindings
Standalone native units declare their imported model and original compiled script using relative paths within the game root:
is_commander = true # top-level; only the starting producer needs this
[assets]
model = "models/forge.gltf"
script = "scripts/forge.cob"
build_picture = "unitpics/forge.png" # optional authored build-menu image
world_units_per_metre = 16.0
build_picture optionally names a PNG using a safe project-relative path.
Omitting the field or setting it to an empty string clears the authored picture. Its
exact bytes supply the Studio build menu and runtime HUD image, including alpha.
An explicit binding must exist and decode successfully; missing or malformed
images are runtime validation errors. PNG images are limited to 1024 pixels per axis
and 16 MiB encoded. Without a binding, Studio generates a textured model picture.
The image is included in unit package dependencies and provenance checks.
Native units may add independent transparent PNG markings to their build buttons.
Each entry in [[assets.build_picture_markings]] names an image and its placement.
Entries draw in order, with later entries on top. Each PNG uses the same path and
image limits as the portrait and travels with the packaged game.
[[assets.build_picture_markings]]
image = "unitpics/markings/support.png"
x = 1.0
y = 0.0
width = 0.25
This puts the mark in the upper-right corner. The image fits proportionally within one quarter of the portrait’s width and height. Both position values specify a fraction of the remaining space after fitting. Zero aligns to the left or top, 0.5 centers, and 1 aligns to the right or bottom. The defaults are 0 for each position and 0.25 for size. Size must be positive and at most 1.
world_units_per_metre is explicitly positive. Model validation and the supported
glTF subset are owned by native model import.
The script uses the existing COB VM and must reference pieces present in the
imported rigid hierarchy. These bindings do not require writing FBI or 3DO files.
is_commander is an optional boolean top-level capability used by the existing
commander game-end rules.
Additional [movement] numbers are acceleration, brake_rate, max_slope
and max_water_depth: finite nonnegative values mapped to the corresponding
normalized movement inputs. speed and turn_rate retain the units of the
existing schema above; import scale changes model dimensions, not gameplay
speeds or footprints. The first standalone runtime supports ground and
static and rejects the other movement domains until their native paths are
integrated.
[economy]
Optional finite nonnegative numbers metal_make, energy_make,
metal_storage and energy_storage configure unconditional per-second income
and unit storage capacities through the engine's existing economy normalizer.
extracts_metal configures extraction per density unit per second through the
existing resource-economy normalizer. Effective yield uses the sum of density
plus the runtime cell bonus across the extractor footprint. Activation and
resource gating follow the normal simulation rules; other resource extraction
and conversion fields are not exposed here.
[production]
What a builder builds: PRODUCTION_SCHEMA.md.
Errors
[projectile],[effects],[targeting]or[special_behavior]in a unit file (they belong to weapons).- A cloak state field:
cloak_enabled,is_cloaked,post_fire_decloak_sec(or their camelCase forms). Whether a unit is cloaked is game state, not unit data.
Example
unit-pack/content/units/greeter.toml:
id = "greeter"
name = "Greeter"
description = "A minimal example unit used by the unit-pack example."
side = "example"
category = "kbot"
max_health = 100
sight_distance = 200.0
weapons = ["unit-pack.light-laser"]
[footprint]
x = 2
z = 2
[cost]
metal = 50
energy = 100
build_time = 3000
[capabilities]
can_attack = true
can_move = true
is_builder = false
A [movement] section, from unit-pack/content/units/skirmisher.toml:
[movement]
type = "ground"
speed = 100.0
turn_rate = 180.0