Skip to main content

GenerationStarter

A class in Root.Township, the global namespace.

Network entity that spawns a GenerationCore and runs procedural generation from a saved seed. The server generates and sends the seed so clients generate the same result.

Constructors​

MemberWhat it is
GenerationStarter()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private GeneratedBiome biomeBiome being generated.
private GenerationCore coreThe spawned generation core.
private bool isFirstThisRuntimeFalse when loaded from a save made in this same run.
private GenerationCore prefabGeneration core prefab to spawn.
private BiomePreset presetOptional biome preset that sets the biome.
private int seedRandom seed for generation.
private MethodSync syncMethod sync (SpawnSeed).
private uint terrainModificationIdID from TerrainModificationRegister that marks whether terrain changes need to be made.

Methods​

MemberWhat it is
override void Initialize()Sets up the seed sync and creates the generation core as a child.
override void InitializeAsServer(SpawnData spawnData)Server: picks a seed when first generating, then generates with it.
override void OnConnected(Player player)Sends the seed and settings to a joining player.
1 private and internal method
MemberWhat it is
private void SyncSpawn(IPlayer player, Stream stream)Sync handler: sends the terrain ID, preset, seed and biome; clients generate the same result.