Stoneshard Wiki

Encounter generation

Encounter generation creates target requests for camps, monster sites and hunting grounds, filters candidate tiles and writes map markers during world generation. When candidates are scarce, the generator relaxes some conditions in stages; template selection and map discovery follow separately. This article separates what the generator tries from what a save actually receives.

Contents

What this generation article covers

World generation first makes a target request for a class of location, then chooses positions from eligible tiles and writes map markers. Once a scene is entered, room templates, initial objects, dynamic summons and loot are handled by their own rules; this page covers the placement and discovery chain.

“Request 3” is the target the generator tries to satisfy. It does not guarantee three sites in every save or a fixed enemy count when a site is entered. Use the relevant event article for creatures, resources and respawn.

Requested targets and actual results

The same-release world initialization requests camps, monster sites and hunting grounds separately. Camps use a total target, while monsters and hunting grounds request each concept separately; empty candidates, failed creation or a room restart can change the final result.

Requested targets and actual results
CategoryGenerator targetHow to read it
Camps35 requested positionsPoint of Interest; template and variant are selected separately
Monster sites3 requested for each of 6 conceptsThe target is not a guaranteed created count; candidates can run short
Hunting grounds3 requested for each of 7 conceptsMap-event concepts share the placement flow with monster sites

How candidate tiles are filtered

Initial filtering checks biome, forest weight, Wilderness, distance from existing encounters and whether a tile is usable. Some locations pass a starting-zone argument, but the current candidate-array function copies the global encounter-zone list; that argument must not be read as an active regional lock.

How candidate tiles are filtered
StageSource behaviourHow to read it
Initial candidatesFilter by biome, forest weight, Wilderness, encounter safe zone and occupancyA tile enters the pool only after these checks
Relaxation stage 1Wilderness > 40, with the main other restrictions retainedA lower threshold does not ignore terrain
Relaxation stage 2Wilderness > 30This is still candidate selection, not a forced coordinate
Relaxation stage 3Stop comparing Wilderness while retaining the encounter safe zoneThe pool grows but can still be empty
Relaxation stage 4Retain biome, allow same-class reuse in a zone and adjust the forest constraintThe final fallback can still fail to reach the target

How candidate pools are consumed

The generator takes a position from the candidate tiles and continues with the next request. If no position can be selected, remaining requests stop; when a source kind creates nothing, the room restarts. Once at least one has been created, the target can still remain short.

Template pools have a separate without-replacement rule: a selected template is removed from the current pool and the pool is refilled only after it is empty. Pool size describes available layouts, not enemy counts, loot counts or an encounter rate for each run.

How candidate pools are consumed
Camp variantTemplate poolReuse
Common bandit camp15 templatesDraw without replacement, then refill when empty
River and steppe bandit camp4 templatesReuse by river frame or without replacement
Crawler-overrun camp3 templatesDraw without replacement
Deathstinger-overrun camp3 templatesDraw without replacement

Monster-site template coverage

The table lists monster-site concepts whose room templates are verified in the same release. It shows how many scene layouts the generator can choose from; the event articles explain pre-placed creatures, resources, loot and respawn after entry.

Monster-site template coverage
Site conceptPlacement targetTemplate pool
Crawler Burrow3 requested per concept3 scene templates
Deathstinger Hive3 requested per concept6 scene templates
Ghoul Den3 requested per concept3 scene templates
Gulon Den3 requested per concept1 scene templates
Harpies Nest3 requested per concept3 scene templates
Troll Domain3 requested per concept3 scene templates

When the player sees a marker

A world-map fog update calls the point-of-interest marker flow. It checks a one-tile neighborhood around the current position for undiscovered Point of Interest, Dungeon and Random Encounter tiles, then writes a discoverable point-of-interest rumor. This is the discovery radius, not a fixed spawn coordinate.

What these rules do not establish

Coordinates in the example map, displayed marker counts and template-pool sizes are not fixed results for every save. Failed creation, scarce candidates and relaxation stages can change the result; placement rules alone cannot predict an enemy's next move, loot or quest reward after entering a marker.

References

Game version 0.9.4.25

  1. 0.9.4.25 world initialization and encounter placement source
  2. 0.9.4.25 candidate-tile filters and relaxation source
  3. 0.9.4.25 map discovery and template-pool source
Back to top