# Wave Based FPS Game lags heavily after Wave 6/7. No Event Tick used, Frames go from 120fps to 50fps from wave 1 to wave 10. What can I do to improve performance?

**URL:** <https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** performance-issues, Optimization, GPU-Profiling, unreal-engine, Performance-Profiling, Blueprint, question\
**Created:** [December 9, 2023, 2:14pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493 "2023-12-09T14:14:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 2:14pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/1 "2023-12-09T14:14:07Z")

</div>

Hello! I have a Wave Based Horde Style Boomer Shooter FPS game. I’m currently trying to optimize it for a steam demo build i’m releasing soon. I get some serious lag around wave 6/7 and it just keeps getting worse. I was told to do a dump hitch test so here are my results of it: [DUMPHITCH Test - Pastebin.com](https://pastebin.com/ujGq6K7E) . I noted that I went from 120fps constant to 50 fps constant after 10 waves of enemies (220 enemies spawned over the 10 waves). I used 5 different weapons while doing my test. My frame/game/gpu draw went from an average of 8ms on begin play to around 20ms and i was well over my 70% UNIT graph. Obviously the game runs better out of editor in packaged builds, but I still see the frame drops heavily after the 6/7th Wave. I have no Event Tick nodes in any of my AI and use alot of BB and BT instead of BP for the AI. My weapons are mostly hitscan and use minimal projectiles (the smgs use the most but even without the smgs the performance seems to be just as bad).

What would y’all recommend doing? I would really enjoy players being able to get to Wave 50 and not have massive performance drops…Thanks!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 9, 2023, 4:10pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/2 "2023-12-09T16:10:03Z")

</div>

I would just play it in editor and watch the actor number to see if it just keeps going up ( which I suspect ). After it has risen for a while, F8 and take a look at the actor list in the outliner. I think something is not being destroyed correctly.

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 4:43pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/3 "2023-12-09T16:43:25Z")

</div>

So i just did another 10 wave test like this, and these are the results:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/1/ce1ff72f7b55e15e6f5c2bf34a1528bd5c735f37.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/b/6cb618346cf58a926c98a78e89a71419bd9b4add.jpeg)

my actors did go up, that is due to the suicide bot explosion bp not deleting, but fixing that didnt improve the performance of the game. it still goes up even if the suicide bots dont explode.

edit:

did another test run with the suicide bot explosion actor actually destroying itself and the performance did not increase…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/c/18c7de73c11b3bc8fb9f30cf0a2213733ae5cf93.jpeg)

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [December 9, 2023, 6:07pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/4 "2023-12-09T18:07:05Z")

</div>

Well, the only thing you can do, is keeping profiling.  
What’s taking the CPU? It’s gotta be something! (Or something’s taking the GPU, and the CPU ends up waiting on the GPU.)  
Use all the different profiles, and look for bottlenecks.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 9, 2023, 6:19pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/5 "2023-12-09T18:19:40Z")

</div>

Well, it was a good theory 😃

Another easy thing is cutting chunks of the functionality out ( disable auto-save ). Just keep chopping large chunks until you find a pattern. Then focus it down…

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 9, 2023, 6:52pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/6 "2023-12-09T18:52:58Z")

</div>

Seeing the game logic taking up most of the time woulnd indicate that some functions are eating cpu cycles.

Do you have some looped timer driven events or recursive functions that could be stacking reducing performance?

The profiler could show which function 8s the cause of the slowdown. Maybe some nested loops?

A get all actor of class would also slowdown more each wave gathering more instances.

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 8:10pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/7 "2023-12-09T20:10:17Z")

</div>

there is no auto save.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 9, 2023, 8:25pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/8 "2023-12-09T20:25:13Z")

</div>

Auto-save in editor …

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 8:41pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/9 "2023-12-09T20:41:19Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/b/66b02ee035d8cb18863bda036e9e73250a78c669.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/5/f/45f8d5a753557ae5a73af4f3936d5e560009646d.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/5/3c52680555b6a35a29ef020c7737f150b761b09d.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/7/8a75098f3edbdbe759610804c7318770b137b47d.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/0/c9060b4581c78b8627e816a4f8adc60c7724a0b9.png)

heres some more profiling. it doesnt mean much to me tbh…im really new to this side of unreal. does anyone of this help? what profiling commands can i use to help find this one leak specifically?

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 8:41pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/10 "2023-12-09T20:41:56Z")

</div>

turned off already

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 9, 2023, 8:43pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/11 "2023-12-09T20:43:28Z")

</div>

I’m not saying that’s causing the problem. I’m saying take a level and hack out huge chunks of functionality until it works ok. Then go back and only hack out half, then repeat. Like that… 🙂

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 9, 2023, 8:45pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/12 "2023-12-09T20:45:37Z")

</div>

I was referring more towards unreal’s insights

> **[Unreal Insights](https://docs.unrealengine.com/5.3/en-US/unreal-insights-in-unreal-engine/)**
>
> Profile your project with Unreal Insights

It has a more granular approach. Though you have to record your play session through a command and then load it up in the insights (really wish they would put this in the UI finally)

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 8:58pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/13 "2023-12-09T20:58:09Z")

</div>

i did insights earlier, but to be honest, i didnt get anything out of it. i mightve done it wrong haha.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/a/90abd7ae32fe99f5716e5973c9b5177362f8747f.png)

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 9:00pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/14 "2023-12-09T21:00:24Z")

</div>

**UPDATE:**

I spawned the 220 enemies via the editor and killed them all. I had about 30 fps when they were all spawned in, but the more i killed, the better my performance. When I got to 0 enemies left, my performance was perfect. This leads me to believe its probably the Wave Based Spawner BP causing the problem. I don’t know why though. Can I post the BP in here via BlueprintUE (pastebin for blueprint)?

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 9, 2023, 9:02pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/15 "2023-12-09T21:02:40Z")

</div>

Sure post it. It might shed some light on where the problem is.

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 9:09pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/16 "2023-12-09T21:09:51Z")

</div>

Main Event Graph:

> **[Main Event Graph for Wave Based Spawner BP posted by anonymous | blueprintUE...](https://blueprintue.com/blueprint/1rbfq-cl/)**
>
> No description provided

Get Wave Variation Function: [Get Wave Variation Function posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/r_cjzon2/)  
Initialize Function: [Initialize Function posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/rywhqgdc/)  
Get Random Spawn Point Function: [Get Random Spawn Point Function posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/pgr4iwe_/)  
Check If Enemies Are Defeated Function: [Check If Enemies Are Defeated Function posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/7fbfkso3/)

Theres all the wave based spawner bp

I didn’t code this thing, an old dev who is no longer apart of the project did. I didn’t question it because it seemed to work, but the performance is definitely not acceptable.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 9, 2023, 9:23pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/17 "2023-12-09T21:23:26Z")

</div>

Ok so looking at the spawn mechanic I see you are using spawn Actor in a loop. Perhaps you could use an enemy object pooler. You will get a huge impact on gameplay spawning so many actors.

Take into account that the engine is probably still cleaning up a 100 or so enemies from the previous wave (the don’t get cleaned up as the die but get garbage collected at intervals)

During this time you are asking the engine to spawn in another 100 or so actors.

I’m guessing the construction phase of all of them is probably tanking your performance.

Instead of destroying an active deactivate it and put it back into the pool (an array), and when you need it again then just grab it from the pool, reset it’s health, set it to alive etc and put it on the battlefield.

Spawning many actors at once and keeping them in memory is cheaper then constant spawning and destroying.

OFC internal logic of enemies can also impact performance. Do you have central logic that dictates their actions as a swarm or does each have it’s own ai controller?

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 9:37pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/18 "2023-12-09T21:37:16Z")

</div>

sweet, its good to know where the source of the bad performance is coming from for sure! thank you!  
do you have any good tutorials you could recommend for an enemy object pooler? i’ve never made one so i dont even know where to start.

Currently the game only spawns 4 AIS in via the Wave Based Spawner, but I have more AIs. One is a test dummy bean AI that just used BP chase player and does nothing else, it wont be in the final game, and won’t be in the project any longer as of today. The other three AI the Spawner spawns use the same AI Controller. I have another AI Controller for another enemy, but he doesn’t spawn in with those enemies yet. Should I make them all have the same AI controller?

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 9, 2023, 9:50pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/19 "2023-12-09T21:50:36Z")

</div>

There are many object pooling examples on youtube

[https://www.youtube.com/results?search\_query=unreal+engine+object+pooling+](https://www.youtube.com/results?search_query=unreal+engine+object+pooling+)

A pool at begin play spawns a set of actors (example 150).  
All start as deactivated, all are added to the available pool array (a variable in the pooler actor)

A pooled object should have 2 functions

- an form of activation (resets life, set visibility to true, sets transform, enables collisions), removes itself form the available pool array in the pooler actor (or you can have an internal bool flag that “available” set to false )

- a form deactivation (sets visibility to false, sets collision enabled to false, adds to array that holds available actors or sets its “available” flag to true)

The available flag can help to not cause memory fragmentation from constantly shuffling the pooler array elements.

You also need a function in the pooler to fetch an ready element. If you go with the available bool method then you need to traverse the array looking if an entry with available = true, then you grab it’s reference set the available to false and call it’s activation function

---

<div class="post-metadata">

**Author:** ![abstreebee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abstreebee/32/574406_2.png) [@abstreebee](https://forums.unrealengine.com/u/abstreebee)\
**Post date:** [December 9, 2023, 9:59pm UTC](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493/20 "2023-12-09T21:59:41Z")

</div>

awesome, thank you for sharing that link and your knowledge! I really appreciate it! Hopefully I’ll be able to figure out pools. It seems like it’ll be one of the more complicated things, but we all need to push ourselves and grow eventually. Now seems like a good time for me.

Thank you once again for all your help!

[Next page](https://forums.unrealengine.com/t/wave-based-fps-game-lags-heavily-after-wave-6-7-no-event-tick-used-frames-go-from-120fps-to-50fps-from-wave-1-to-wave-10-what-can-i-do-to-improve-performance/1510493.md?page=2)
