Veduta

Prefab — assets/prefabs/<name>.vprefab

A prefab is a group of entities placed as one structure in a world (world topic): a tree, a house, a whole village. A world places prefabs, never single entities, so a city is one placement with one footprint and the generator keeps footprints apart. Since v1.2.0.

File and name

Fields

FieldTypeDefaultMeaning
vedutastringrequiredMust be exactly "prefab/1".
footprint[width, depth]requiredThe ground the prefab occupies, in meters along +X (width) and +Z (depth), each in (0, 1024]. The world rounds it up to whole cells.
tagsarray of strings[]Tags of the structure as a whole, matched by other prefabs' min_distance rules. Valid names, no duplicates.
rulesobjectnonePlacement rules; see below.
entitiesarray of objects[]The entities, exactly as in a scene (scene topic: name, kind, model, material, position, rotation_deg, scale, tags, parent, visible, hitbox, layer), except that kind cannot be camera or light. Names are unique within the prefab; parent names another entity of the prefab.

Rules

FieldTypeDefaultMeaning
biomesarray of stringsanyBiomes of the world the prefab may stand in.
min_distanceobject { tag: meters }{}Free ground the prefab needs between its footprint and any structure carrying tag (a site tag or a prefab tag), in meters, 0 to 4096, rounded up to whole cells. The rule is checked both ways: a house asking for 6 m from city is also kept 6 m from cities placed later.

Coordinates

The prefab's origin is the min corner of its footprint on the ground: the footprint spans x in [0, width], z in [0, depth], y = 0 is the ground. Entity positions are meters from that corner, so a 3×2 house has its walls around [1.5, 0, 1]. When the world places the prefab at cell [cx, cz] with rotation r (0, 90, 180 or 270 degrees about +Y), the entities are turned by r about the centre of the footprint, which for 90 and 270 becomes [depth, width], and then moved to the cell; the origin is the min corner of the rotated footprint.

Inspection

inspect prefab <name> reports:

Sheets: summary (iso and top views).

Example

{
  "veduta": "prefab/1",
  "footprint": [3, 2],
  "tags": ["house", "building"],
  "rules": { "biomes": ["plain", "forest"], "min_distance": { "house": 1, "city": 6 } },
  "entities": [
    { "name": "walls", "kind": "static", "model": "house", "material": "wood", "position": [1.5, 0, 1] },
    { "name": "roof", "kind": "static", "model": "roof", "material": "tile", "parent": "walls", "position": [0, 2, 0] },
    { "name": "door", "kind": "static", "position": [1.5, 0, 2], "hitbox": [[-0.5, 0, -0.1], [0.5, 2, 0.1]], "tags": ["door"] }
  ]
}

A one-cell prefab for scatter (a tree on a 1 m cell):

{
  "veduta": "prefab/1",
  "footprint": [1, 1],
  "tags": ["tree"],
  "rules": { "biomes": ["forest"] },
  "entities": [ { "name": "trunk", "kind": "static", "model": "tree", "material": "bark", "position": [0.5, 0, 0.5], "tags": ["obstacle"] } ]
}