Adding a New Stage Configuration
Stage System Detailed Guide
The Stage System drives all enemy spawning in your game. It consists of two asset types—StageConfigSO (defining which groups spawn) and SpawnSet (defining how and when each group spawns)—plus the StageManager component that runs it at runtime.
1. Spawn Patterns (SpawnPatternType
)
SpawnPatternType
)Spawn behavior is controlled by this enum in code:
Use these patterns to vary your encounters.
2. Defining a SpawnSet
A SpawnSet asset describes one group of enemies and its spawn logic.
a. Create or Locate a SpawnSet
In the Project window go to:
To create a new one: Right-click → Create → RGame → RoguelikeKit → Stage → Spawn Set
Name the asset (e.g.,
SpawnSet_GoblinRing
).
b. Configure SpawnSet Properties
Open your SpawnSet in the Inspector and set these fields:
PoolKey: string matching your object-pool key (e.g., "Goblin").
Weight: relative chance when picking randomly.
Pattern (
SpawnPatternType
): choose Random, Circle, or Dense.BaseRatePerSecond (Random only): enemies spawned per second (before scaling).
Count (Circle/Dense only): how many enemies spawn each tick.
CircleRadius (Circle only): distance from player for the ring.
StartTime & EndTime: when (in seconds) this set becomes active.
IntensityCurve: AnimationCurve (0–1) that multiplies BaseRatePerSecond over the segment.
3. Assembling a StageConfigSO
A StageConfigSO asset groups multiple SpawnSets into a timeline.
a. Locate or Create
Navigate to:
To create new: Right-click → Create → RGame → RoguelikeKit → Stage → StageConfigSO
Name it (e.g.,
StageConfig_ForestLevel
).
b. Add SpawnSets
In the Inspector’s SpawnSets list:
Click +.
Drag each SpawnSet asset into its slot.
The StageManager will sort them by StartTime at runtime.
4. StageManager Component
Assign references:
PoolRuntimeSO: your pooling asset
GlobalConfigSO & CommonStatRuntimeSO: for curse scaling
EnemySystem: handles enemy registration
PlayerSpawnChannelSO, StartStageEventChannelSO, VoidEventChannelSO: hook up spawn and win events
minSpawnRadius / maxSpawnRadius: for Random pattern distances
At gameplay start, fire the StartStageEvent with your StageConfigSO during initialization.
The StageManager will:
Sort SpawnSets by
StartTime
.For each set when time ≥
StartTime
, spawn according to itsPattern
:Random: continuous spawning using
BaseRatePerSecond × IntensityCurve × Curse
.Circle: one-off ring of
Count
enemies atCircleRadius
.Dense: one-off cluster of
Count
enemies around a random point.
Stop after all sets finish and no enemies remain, then emit the gameWin event.
5. Tips & Best Practices
Tuning Difficulty: Adjust
IntensityCurve
shape to ramp up or ease difficulty.Pattern Mix: Combine
Random
for filler,Circle
for surround challenges,Dense
for targeted ambushes.Reusability: Duplicate
SpawnSet
assets to quickly create new stages.Timing: Overlap
StartTime
/EndTime
to layer multiple sets in parallel.
With these steps, even beginners can set up rich, varied stages fully through the Inspector—no coding required!
Last updated