OK, I haven't looked at the code in question (and C++ confuses me), but back in my youth when I wrote ecological sims in Smalltalk we would cache all but the random variations on affects upon agents in a Dictionary, which is a lot like a STL map. This could save thousands of calculations. Could this be done, using a key like npc_type*100 + level, so for each level 25 kobold you only need to calculate a random(-5,5) or equivalent for each mob, rather than the whole sum for each mob and each iteration?
|