Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Dead Body Cleanup

After spawning a room full of enemies, you're faced with the problem of ticks being used when not necessary, such as after death of an enemy. This can drain on performance, even if those ticks are not exactly doing a lot. However just deleting the actor on death is very dry and does not leave the user with a satisfying experience.


One solution we came up with, which works well for our purposes, is to have the AI "sink into the ground" after being dead for 3 seconds, then delete the actor after a further 1 second. This is a clean and relatively elegant solution to the problem, but how do you even go about it? The answer is also quite simple: Timeline.

The Timeline node allows you to trigger an update on each tick for a specified duration, then when complete call further functionality.


Using this approach with some variables set into our base AI class, allows us to customize the duration, rate and starting times for how this effect occurs on a per enemy type basis.

Often times all it takes is a simple solution to solve a simple problem.

author: Clinton Butler
Posted on 6/9/2023

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.