Scripting
advanced scriptingVoxel Combat Zone · Scripting
Everything the generator plans is available to your own scripts, so you can build gameplay on top of a generated city instead of just walking through it.
Accessing the generator
Get the generator from the Voxel Play world once it exists:
var gen = env.world.GetGenerator<CombatZoneGenerator>();Regenerating
Rebuild the world with a new seed at runtime:
gen.Regenerate(newSeed); // reloads the world with the new layoutReading the plan
After the world is generated, gen.CurrentPlan exposes the full WorldPlan as data you can query to place spawns, cover, patrols, objectives or loot:
| Member | What it gives you |
|---|---|
| streets | Street runs with centrelines; main marks the main road. |
| buildings | Footprint, floors, archetype, damage and collapsed flag per building. |
| craters | Position, radius and intensity of each shell crater. |
| wallSegments / towers / gates | The perimeter wall, its watchtowers and its gate openings. |
| poles / cableSpans / buildingCables | Power-line poles and cable runs. |
| props | Planned modules, each tagged (for example checkpoint) with position and rotation. |
| oldTownCenter / oldTownRadius / seam / interior | The old-town disc, the frontline seam and the walkable interior rect. |
Fast lookups are provided as helpers:
plan.IsStreet(x, z); // is this world column a street?
plan.IsBuilding(x, z); // is it inside a building footprint?
plan.InInterior(x, z); // is it inside the perimeter wall?The plan is pure data and deterministic, so reading it on the server or for a minimap gives the same result as the generated geometry. A ready-made
Combat Zone Demo component shows how to display the seed and rebind the regenerate key. Was this page helpful?
Suggest an improvement
Help us improve this documentation page.