Table of Contents

Class WildlifePlanner

Namespace
FishMMO.Server.Implementation.World.SceneServer.Spawner
Assembly
FishMMO.Server.dll

Plans a world scene's wildlife spawners when it is cut: big overlapping areas over the open country, each with the species its biomes support, plus a group at each den point of interest and some cave mouths. The cut writes the plan into the scene as ObjectSpawners (WildlifeSpawnerCut), which the spawn-table bake carries to the server like any other. At spawn time the runtime keeps each species on its own ground and its herd together (SpawnerRuntime).

public static class WildlifePlanner
Inheritance
WildlifePlanner
Inherited Members

Remarks

Never in a settlement (by habitat or by a settlement point of interest), at sea, or inside a keep-out.

Methods

InsideKeepOut(IReadOnlyList<Vector3>, Vector3)

True when point is inside any of the circles (x, radius, z) on the ground plane.

public static bool InsideKeepOut(IReadOnlyList<Vector3> circles, Vector3 point)

Parameters

circles IReadOnlyList<Vector3>
point Vector3

Returns

bool

KeepOutsFor(IReadOnlyList<Vector3>, Vector3, Vector3)

The settlement circles (x, radius, z) that reach into a box centred on center.

public static List<Vector3> KeepOutsFor(IReadOnlyList<Vector3> circles, Vector3 center, Vector3 size)

Parameters

circles IReadOnlyList<Vector3>
center Vector3
size Vector3

Returns

List<Vector3>

Lives(WildlifeTemplate, BiomeHabitat)

Whether a species lives on ground of habitat: one of its habitats, and never a settlement or the sea.

public static bool Lives(WildlifeTemplate t, BiomeHabitat habitat)

Parameters

t WildlifeTemplate
habitat BiomeHabitat

Returns

bool

PackSettings(bool)

A wildlife spawner's pack: on, so a herd flees together and a pack hunts together.

public static NPCPackSettings PackSettings(bool hunts)

Parameters

hunts bool

Returns

NPCPackSettings

Plan(string, Rect, GroundSampler, IReadOnlyList<PointOfInterestRecord>, Func<float, float, bool>, IReadOnlyList<SceneCaveLifeSpot>, IReadOnlyList<Species>, WildlifeCatalogue)

The plan for one scene: big overlapping areas over the open country, each holding the species whose ground covers enough of it (weighted by how much, and by their density), then small single-species areas at dens and cave mouths. Dens come first so the cap never starves them. Pure and deterministic (seeded by the scene's name), so it is tested on its own; the cut writes it into the scene as ObjectSpawners.

public static List<WildlifeArea> Plan(string sceneName, Rect area, WildlifePlanner.GroundSampler ground, IReadOnlyList<PointOfInterestRecord> pois, Func<float, float, bool> keptOut, IReadOnlyList<SceneCaveLifeSpot> caves, IReadOnlyList<WildlifePlanner.Species> species, WildlifeCatalogue limits)

Parameters

sceneName string
area Rect
ground WildlifePlanner.GroundSampler
pois IReadOnlyList<PointOfInterestRecord>
keptOut Func<float, float, bool>
caves IReadOnlyList<SceneCaveLifeSpot>
species IReadOnlyList<WildlifePlanner.Species>
limits WildlifeCatalogue

Returns

List<WildlifeArea>

Spawnables(WildlifeArea)

The spawner's entries for an area: one per species, its chance the species' weight.

public static List<SpawnableSettings> Spawnables(WildlifeArea area)

Parameters

area WildlifeArea

Returns

List<SpawnableSettings>

StableHash(string)

FNV-1a of the scene name: the same placement every load, on every machine.

public static int StableHash(string text)

Parameters

text string

Returns

int

Suitable(WildlifeTemplate, float, float, GroundSampler, Func<float, float, bool>, List<Vector3>, out float)

Whether a point is ground the species lives on, away from towns, the sea and keep-outs.

public static bool Suitable(WildlifeTemplate t, float x, float z, WildlifePlanner.GroundSampler ground, Func<float, float, bool> keptOut, List<Vector3> settlements, out float altitude)

Parameters

t WildlifeTemplate
x float
z float
ground WildlifePlanner.GroundSampler
keptOut Func<float, float, bool>
settlements List<Vector3>
altitude float

Returns

bool

ToDefinition(WildlifeArea)

Turns an area into a spawner definition (the baked shape the runtime reads): its species as weighted entries, a pack per species (the runtime keys wildlife packs by species), respawn times from each species.

public static SpawnerDefinition ToDefinition(WildlifeArea area)

Parameters

area WildlifeArea

Returns

SpawnerDefinition