Okay, update:
First of all, I think that I’ve made some improvements!
- The repeated traversals previously seen have been to a large degree combined into a single, larger traversal
- I’ve removed most usages of my custom Actor-class
- I’ve left in the potential for its use by limited objects, especially larger ones that might benefit more saliently from animation-blending
- I’ve replaced the logic that was using “NodePath.find”
- It now involves a class-level “registry” of relevant objects that can be checked instead
The result is that the frame-time remains noticeably lower when several enemies are active at once!
Conversely, I’m afraid, the frame-time is actually a bit higher when no enemies are near. I do think that I know the cause of this, however, and have a potential fix in mind…
I have yet to implement any changes related to sounds or effect-copying…
Next, I think that I’ve identified more transform-states. The list that I have at the moment looks as follows:
- Environmental collision objects
- Lots of these
- Generally take the form of CollisionCapsules
- Visible geometry for the environment
- Again, lots!
- Visible “content” geometry (decor, etc.)
- Quite a few of these, I think
- Breakable objects
- Not as many of these, but…
- Each is associated with a collision-object and two visible-geometry objects, one of the latter of which is generally hidden; all of these seem to have transform states
- “Floor” geometry
- Often just one per room, I think.
- Essentially defines both the geometry underfoot and the collider that’s used for room detection
- The latter of those is held in a separate mini-scene-graph for purposes of room-detection
- “Door” geometry
- Not all that many of these
- But each door may have more than one part, at least one of which will have a transform-state
- “Blockage” geometry
- Essentially the same as “door” geometry
- (It’s even handled similarly in code)
- Essentially the same as “door” geometry
Now, I’m guessing that I can ignore doors and blockages–I doubt that they’re common-enough right now that they’re causing much trouble.
“Floors” I might want to flatten, perhaps.
Breakables are a bit awkward, as the colliders aren’t actually attached to the visible geometry; they’re just at the same location. We’ll see…
As for the first three, together they seem to account for nearly 5000 states, if I’m interpreting the data correctly.
[edit]
A short update: I’ve now addressed both of the above–the higher frame-time without enemies and the time used in copying (visual) effects; I decided to eschew addressing the copying of sound-effects.
And both of these have been a big help, dropping my frame-times quite pleasingly, I feel!
Now, neither of these helps with the transform-state issue, so there is still more work to be done–but still, these changes have been worthwhile, I feel.