Performance: stuck for a solution

Alas, I seem to have hit a performance pitfall, and find myself a little lost as to the way out.

Having made some progress on the generation of my levels, and having a frame rate that I was happy with, I recently began placing enemies, replacing the old single, hard-coded enemy that I had had in place previously.

This, it seems, is where the problem came in: it seems that with my current numbers of enemies (not uncommonly between 30 and 70, I think), my frame rate takes what seems to me to be a fairly large drop, all to often drawing closer than I’d like to or falling below 60.

Runs with PStats have yielded some results: it appears that collision accounts for at least some of the problem, and indeed, removing the lines that add each enemy’s object-collider (as opposed to the collider used to detect weapon impacts) to cTrav and to my CollisionHandlerPusher seems to improve matters - but not by terribly much, it seems to me.

Beyond this I find myself a little more lost: PStats also mentions some time spent in App->Show Code->update, but I don’t know to what this refers, and there seem to be tall, very brief spikes in at least a few different categories.

I’ve also tried experimentation, removing various elements and changing the ways in which I’ve been doing certain things (including reducing my environment’s geom count thanks to the readout provided by render.analyze()), but thus far I seem to have seen little improvement.

As to the enemies, each is an animated model (non-instanced, I’m afraid, as they could easily each be playing different animations at different points, it seems to me; I suppose that I could use a limited number of “prototypes” from which to instance, but would rather not unless I am confident that doing so will significantly reduce my problem), each with one CollisionSphere, one CollisionTube and one CollisionRay, as well as a traverser for the ray, as I recall.

Perhaps significantly, a noticeable drop appears to occur when a number of enemies are on the screen - something that might perhaps not be surprising, save for that the number of enemies seen at once seems to me to be lower than I would expect to be so great a problem.

The shader generator is on, I believe, but switching it off doesn’t seem to produce much benefit.

Does anyone have any suggestions, and if so, what are they, please?

My thanks for any help given. :slight_smile:

“App->Show Code->update” means a Task called “update”, or some variant such as “update-123123123”. Perhaps this is one of your tasks?

How is your animation time looking? This appears under the toplevel “*” category, for no real excellent reason. We just had a discussion in another thread about techniques for improving animation time.


Thank you very much for the response. :slight_smile:

Ahh, of course - that would presumably be my main update task (and since that calls the other updates tasks I can see it getting a little heavy - I should look over it again, I think…).

*->Animation, I presume?

Hmm… That does look as though it might be something to look at (and I intend to look though that thread - thank you ^_^); while not astronomical, it does look as though it might be improved, albeit intermittently, as it seems to run in spikes.

By the way, I found something odd:
If I go to App, I see contributions from a few places (update appearing to be one of them). When I click through to render_frame, however, I suddenly see tall spikes, not uncommonly up to the top of the graph - which weren’t apparent at the level of App; render_frame does seem to show there, but not at that height. o_0

I believe this is a minor bug in PStats caused by the render_frame task straddling frames (it begins in frame N, and finishes in frame N + 1, by its nature). I haven’t had a chance to look deeper into it, but it’s on my list of nuisances to address one day.


Aah, fair enough - not something that I should panic about, then. :wink:

I’ve started experimenting with the information that you gave to me, as well as one or two other tests. I daresay that I’ll do more in the new day, especially in looking up the proper usage of egg-optchar, but it also looks rather as though I’m going to end up making changes to my enemy AI, as cutting out pretty much then entire AI code seems to provide a noticeable boost. The first thing is probably the ray test (which, admittedly, is perhaps a bit extravagant to keep in each enemy, checked each update… ah well, my enemies are undead, so supernatural player-detecting abilities aren’t too off-putting… :wink:).

I would also guess that animation level-of-detail might help, although less so, I daresay, in cases in which the player manages to draw a number of enemies through the level, picking up new pursuers along the way - an unusual case, perhaps, but one that I want to keep in mind, I think.

Finally, if it comes down to it, I might look into changing the enemies a little to work better in lower numbers, although that will likely call for better AI, I imagine.

Thank you again for your help - I may be back for more once I’ve worked on it some more, but for now I think that it’s getting towards time that I got some sleep. :slight_smile: