Greetings, glorious adventurers! If you're joining in our Alpha One spot testing, please follow the steps here to see all the latest test info on our forums and Discord!

Possible "ghost AI" memory leak cause from someone who dealt with the same kind of issue before

DreohDreoh Member
edited June 2021 in General Discussion
I don't know where else I would post this since creating a whole post for this feels a bit excessive, but in the off chance it helps I wanted to post it somewhere it would be seen.

Among other things, I've done modding in Dota2, creating a custom game that required ample game objects to exist at a time. There were plenty of enemies and units on the map at any time, and my co-creator and I were using invisible dummy units (essentially an equivalent of AoC's behavioral trees) to anchor particle effects and other things on in the map.

We encountered a bug where sometimes after a game was open for a long time the particle effects and dummy units wouldn't be deleted when they should be and we couldn't figure out why since we were removing them correctly in code.

It turned out that Dota2 only indexes so many units, and after there are too many units on the map, the references to dummy units and other units could be lost, making them unable to be deleted anymore. Also, sometimes deleting the unit wouldn't completely release the unit from memory, so to get around that particular issue we created a dummy unit recycle system instead of deleting them where we just reset them to the base behavior and added the custom unit values instead of deleting/creating them. We unfortunately didn't have the ability to modify the engine to fix such things.
So I'm curious if Unreal Engine might be giving the same kind of issue to the AoC team.

As the IS team is far more experienced than me, It's very likely they have already considered this or even made such a thing impossible, but as someone who writes code I know that sometimes there are things that no one on a team considers so on the very small chance this information helps I figured I'd give it. If anyone knows where else I should post this instead I'll do so and request this thread closed/deleted.


  • So replace/swap them with a zero resource non-entity, rather than junkbin them.
    As the junkbin wasnt working properly.

    Problem is, if the identity/index is truly being lost (as in your case), how does the algorithm actually replace them, without knowing what to replace?
  • Perhaps every instance could have a global 'actor-exists' flag/status table that its class will lookup.
    That way you wont have to kill the object via mutiple convoluted logic streams for object meshes and or their collision meshes.
    They will simpy kill themself, if the status flag says its dead.
    Why manage actors that can manage themself just as well ?

    But that also enables attacking the problem from another direction for the default.
    Each actors assumes 'death by default' (rather than exists by default), unless told otherwise.
    There can be no ghosts then, although objects may fail to appear.
    But failing to appear is instantly observable and easy to debug.
  • DreohDreoh Member
    edited June 2021
    Well in our case it was that we were limited to what the API the Dota2 team gave us could do, and since we couldn't edit the API we just had to work around it.
    If Intrepid is by chance using some default Unreal Engine API somewhere that doesn't handle behavior tree removal completely it'd be similar, but they've said they've been able to and have been modifying the engine to suit their own capabilities so it's something they should be able to fix. If it is the same kind of situation that is.
    It's the drawback of using someone else's (even as amazing as it is) engine.

    Again, they are capable and likely have better theories, this post is really just kind of an intended helpful shot in the dark. Maybe it'll even help trigger some kind of revelation as sometimes happens when debugging lol.
  • NoaaniNoaani Member, Intrepid Pack
    Dreoh wrote: »
    If Intrepid is by chance using some default Unreal Engine API somewhere
    Intrepid aren't even using the default Unreal Engine.

    They have modified it quite substantially.
  • DreohDreoh Member
    edited June 2021
    Noaani wrote: »
    Dreoh wrote: »
    If Intrepid is by chance using some default Unreal Engine API somewhere
    Intrepid aren't even using the default Unreal Engine.

    They have modified it quite substantially.

    I am aware, hence why I said "by chance". It's also impossible for them to not use some of the UE API, otherwise they'd just have built their own engine.
Sign In or Register to comment.