Scripting

advanced scripting

Voxel 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 layout

Reading 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:

MemberWhat it gives you
streetsStreet runs with centrelines; main marks the main road.
buildingsFootprint, floors, archetype, damage and collapsed flag per building.
cratersPosition, radius and intensity of each shell crater.
wallSegments / towers / gatesThe perimeter wall, its watchtowers and its gate openings.
poles / cableSpans / buildingCablesPower-line poles and cable runs.
propsPlanned modules, each tagged (for example checkpoint) with position and rotation.
oldTownCenter / oldTownRadius / seam / interiorThe 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?