Implementing NextRound cheat


Blog Entry Part 1: The Problem

This week, I needed to implement a developer cheat command that would allow instant progression to the next round in our enemy wave-based system. This cheat, SpawnEnemy would be critical for testing late-round balance, AI behavior, and wave scaling without needing to manually play through each wave.

Initially, the issue seemed simple: just destroy all enemies and trigger the next wave. But the underlying complexity of our spawning system made things more complicated. Enemies were not all spawned immediately — instead, they trickled out over time via spawner timers. This meant triggering the next wave too early could break the system, especially if timers were still running or if spawn quotas weren't properly reset.

 Blog Entry Part 2: The Solution

To solve this, we developed a custom cheat inside MyCheatManager::NextRound() . The function performs several critical steps to ensure the wave ends cleanly and spawners are fully reset:

  1. Iterates over all active enemies using TActorIterator and destroys them.

  2. Forces the wave to complete by setting TotalEnemiesKilled = TotalCanSpawn.

  3. Accesses all active spawners, clears their spawn timers, and manually resets their state to be ready for the next wave.

  4. Only triggers GameMode->NextWave() if it hasn't already been triggered by natural enemy death count logic, avoiding double advancement.

The Picture attached shows the logic I used to solve the problem

So basically by  updating our ABaseSpawner class to expose its internal timer and resetting logic through a new ResetSpawner() function, we gained full control over its behavior — without having to rewrite its internal spawn system.

Get Project Meltdown

Leave a comment

Log in with itch.io to leave a comment.