Nothing was broken, everything was just on

by | Oct 28, 2026 | Unreal Engine

Part two of two. Part one was about a weapon glow whose particles never died. This one is about Unreal Engine culling, and four things that cost us frames while working exactly as designed.

With the runaway bug gone, the frame time stopped climbing. It was still higher than it should have been, though. So we asked the obvious next question: what does the game cost when there’s simply a lot of it?

Then we stopped being reasonable about the test. A card on every single cell of the run grid. That’s 441 tiles and about 74,000 actors. Then 4,350 energy orbs, spawned ten at a time, while the test opens and shuts the map editor.

128 ms per frame with the board full. 221 ms by the end. Nobody will ever build a board like that. The grid is there so players can lay out a route, not tile the entire plane. But a stupid test has one great property: everything expensive gets big enough to see.

The good news was that nothing ran away any more. Growth was steady, about 0.2 ms per cycle. The bad news was a list of things costing us real money for no benefit. None of them were bugs. Every one was a system working exactly as designed, in a situation nobody had thought about.

Hidden is not off

Every tile has an enemy spawn controller. Each controller has six Niagara effects on the combat area walls, the glowing barrier that comes up when a fight starts. Outside a fight, the controller hid the walls.

Hiding a Niagara component stops it drawing. It does not stop it simulating.

So on a full board, 2,610 particle systems were quietly simulating behind an invisible wall. That cost roughly 500 ms of worker thread time per frame. In an ordinary run with 30 tiles it was 26 ms. Less dramatic, but still 26 ms of nothing.

The fix is small. Don’t auto-activate them, and switch them on and off along with the walls, rather than just hiding them. Worth saying out loud, though, because the mistake is easy to make and invisible in the viewport. The effect is hidden, you’ve done your job, and the profiler is in another window. SetVisibility(false) is not SetActive(false).

One surprise: killing those 500 ms only gave back about 7 ms of actual frame time. They were worker time, running in parallel, and the game thread was busy with something else entirely.

The navmesh that never stopped rebuilding

That something else took two attempts, and I got it wrong the first time.

The wrong answer

Our traces showed the navmesh being rebuilt constantly, around 45 of its tiles every frame. On top of that came roughly 49 ms a frame of navmesh debug drawing, because the editor redraws it whenever it changes.

We suspected the spinning card containers. So we ran a control test, saw no difference, and wrote it off in the doc as unexplained. That control test was too small. It ran on the handful of start tiles, not a full board. A full board is exactly what made the problem visible in the first place.

The right one

Our navmesh runtime generation is set to Dynamic. Under Dynamic, anything that affects navigation and moves gets pulled out of the engine’s navigation data and put back on every update. Each of those marks the ground underneath it dirty, and the navmesh there gets rebuilt. A mesh on a rotating movement component does that every frame, forever, for as long as the level is loaded.

Unreal will tell you exactly who is doing it, if you ask:

log LogNavigationDirtyArea VeryVerbose

Leave it on for about three seconds, then put it back. On a full board it writes thousands of lines a second. It names the component and the actor behind every dirty patch.

The answers were all decorative. Archway gears in three of the forest tiles, 344 dirty patches a frame between them. The hexagon shells of the card and battery containers, 116. Some rotating side pipes, 26. Not one of them was anything the AI needed to walk around.

So we turned off Can Ever Affect Navigation on the spinning parts. On the components, not on the mesh assets: the same gear mesh might be solid ground somewhere else, and we didn’t want to make that call for every future use of it.

Full board went from 122 ms to 61. The GPU went from 35 ms to 19 at the same time, because the debug drawing went with it. A rotating mesh’s navmesh was wrong for most of its rotation anyway.

Unreal Engine culling: things nobody is looking at

The last day was four variations on one theme: Unreal Engine culling, and the things we had never switched it on for.

Effect types

Effect types are shared assets holding the scalability rules for a Niagara system. Stop simulating when off screen. Stop beyond a certain distance. Cap how many copies run at once. Decide what happens to a copy that gets switched off.

Several of our systems had no effect type at all. No effect type means no culling. That means every copy on the board simulates all of the time, wherever the camera happens to be pointing.

Our VFX team already had a type for pickups, so we based two new ones on it.

The first is for the energy orbs. It switches an orb’s effect off after two seconds out of shot, or beyond 6,000 units from the camera. That distance drops to 4,000 and 2,500 at lower quality settings. The cull reaction matters more than it sounds. Set to resume immediately, a switched-off orb starts again the moment it comes back into view, so orbs returning to the screen glow again rather than staying dead.

We deliberately dropped one thing from the original: the instance cap. The pickup type keeps only the few dozen most important copies alive. That’s a good rule when you have a few dozen pickups. Shared with thousands of orbs, it breaks. The orbs would push the card containers’ effects out of their own budget, and a field of orbs in front of the player could lose some. Distance and visibility already cut the count hard enough.

The second type is the same thing with distance culling switched off, for hazards. An electric wall has to be visible however far back the camera is pulled. It isn’t decoration, it’s the thing that kills you.

What it got us

  • Energy orbs. 4,340 of them, each simulating regardless. With culling, frame time stopped growing with the orb count: 51 ms to 53 ms across the whole run, against 61 to 108 before.
  • Electric walls. 3,600 copies simulating, down to 25. Full board 54 ms to 42, GPU 18 to 14.
  • Slow puddles. About 200 copies, 25 ms of worker CPU every frame. We missed these at first because the game thread barely waited on them. They ran in parallel, and this machine has enough cores to absorb it. On a machine with fewer cores that cost comes straight back as game thread time. 42 ms to 36.5.
  • Spinning parts. These aren’t Niagara, but they have the same shape of problem. Around 440 rotating movement components ticking every frame, seen or not. Half the cost was overlap checks, because the containers rotate the whole actor, collision included. Unreal has a flag for this: update only if rendered. The engine then skips the update unless the thing was on screen in roughly the last half second. An unseen container stops, and picks up again at the same angle. 3.68 ms down to 0.71.

Checking before cutting

Before culling any of it, we checked that nothing in the gameplay reads back from these effects. The electric wall damages you through its collision box. A slow puddle slows you through an overlap and a gameplay effect. In both cases the particles are decoration, sitting on top of collision that does the real work. Had they been load-bearing, this would have been a very different week.

One of the four fixes was for a problem we haven’t had yet. The heal orb has the same uncapped, never-culled glow as the energy orb. Nothing in the game references it: no Blueprint, no level, no tile, no code. So it has cost us nothing so far. It’s culled now, before anyone starts dropping them by the hundred.

Where it ended up

Same test, same command, comparable boards. Start of the week to end of it:

First full testAfter everything
Full board, no test orbs128 ms (7.8 fps)36 ms (27.6 fps)
End of run, 4,340 orbs221 ms (4.5 fps)38 ms (26 fps)
GPU, full board → end35 → 66 ms12.7 → 13.3 ms
Board load time10.4 min6.5 min

Those numbers come from the editor, so roughly 17 ms of each frame is editor overhead. In the packaged game that full board would land somewhere around 20 ms.

The shape matters more than the totals. At the start of the week the line went up and kept going up. Now it’s flat. A long run costs about what a short run costs, which is what the original report was about.

Things I’d rather not find out twice

Hiding something doesn’t stop it. Visibility is a drawing flag. CPU work, movement components and overlap checks all carry on behind it.

A moving mesh that affects navigation is expensive in a way that doesn’t look like navigation. In our traces it showed up as debug drawing and navmesh rebuilds. Nothing pointed at the decorative gears behind it. The dirty-area log is the shortcut.

Check total CPU, not just the thread you’re blocked on. The slow puddles hid for a day, because this machine had enough cores to make them look free.

Write the test as commands, not as a one-off script. Our first measurement day used throwaway commands typed into the console. A day later we couldn’t reproduce the run at all. The second day’s versions got committed, along with the script that drives them. Everything that varies is an argument to it, so every measurement here is the same test run again with a different label. That’s most of why we got through six fixes in a week.

Be suspicious of a control test that disagrees with a trace. Ours did. We believed the control test, and lost two days to it.

None of this is clever. Unreal Engine culling is a checkbox and a shared asset, not a new system or a rewrite. Four checkboxes, a Blueprint change and a couple of asset references. We found them by measuring properly, then reading traces until they made sense. Most of the optimisation work I’ve done has looked like this.

The Drifting Crown is in development at Sponge Hammer.

Related posts

The particles that never died

The particles that never died

Part one of two on a week of Niagara particle performance work. Part two is about the things that were never broken in the first place. A few weeks ago someone on the team mentioned that The Drifting Crown gets slower the longer you play. Not a crash, not a...