Hi.
We recently pushed the 0.3 update for Tankenstein which included a big upgrade to the terrain generation and spawning system. Because of those changes and because we've had some comments about tank spawning, I decided to write up some detail about how the terrain streaming works, and how tanks are spawned as part of that system.
I've also included some information about points of interest (POIs), which govern how the AI navigates across the landscape after spawning.
In order to explain how tanks spawn it's necessary to know the basics of how the world streaming system works in general, because there isn't a separate spawn system for tanks.
Spawning
Tankenstein uses an in house tool called Panzer Terrain. This handles real-time, procedural generation of terrain and game object spawning. As the player traverses the world, the landscape is spawned in as ~1km2 tiles. The height map is generated on the GPU using compute shaders, then handed off to the CPU to generate collision data.
| GPU terrain generation based on camera position. |
Once the height map and collision data have been generated for a tile, it is handed off to the game object spawning system which creates all the objects that appear on that terrain tile. This system works by subdividing the tile into smaller and smaller cells and attempting to spawn an object in each cell. This structure is known as a quad-tree and by testing for collisions at each node of that tree we can efficiently ensure spawned objects don't collide with each other.
Objects are spawned in the following order. Large compounds -> small compounds -> tanks -> wrecks -> scattered cover -> decals. There's a few extra steps such as flattening the terrain around compounds and generating the navigation mesh, but that is the order for the spawning of objects. Some objects such as grass, stones, rocks and trees are dynamically streamed, so they only appear near the player. But anything gameplay related is handled by the spawning system.
| The spawning sequence slowed down to show each step. |
Functionally this means that well before a player gets to a terrain tile, all the objects that can spawn on that tile have already streamed in. This includes tanks, wrecks and any other objects that can be scanned by the radar.
For performance reasons tanks and compounds will remain inactive until a player gets within 1000m of them. Once the player enters that radius, they will wake up and start running their AI. This leads on to POIs, and how tanks use them to navigate the map.
POIs
![]() |
| A tank investigate a wreck. |


No comments:
Post a Comment