Quest for a leak that was not there

I spent most of today code-time hunting a curious leak.

Not memory leak, mind you – memory consumption was perfectly normal. I tested my AI with 300 agents, and it worked smooth. At first. After few minutes, game begun slowing down. Suspecting a leak I dug into the code, only to find nothing.

Because there was no leak.

Yesterday I have made an optimization, and I was hitting a edge case of it. It all was caused by individual factions.

You see – every character I’m playing with has a own faction alignment. That was made enable individualized decisions – characters can have families and property they will defend, in addition to being a member of a guild and a town. But that cut out some caching.

With those individual factions I can have 200 characters on map. With generic factions a lot more, but I think I’ll stick to individual factions – they will bring much more live to the game, especially out of combat.

Leave a Reply