Closed cxong closed 5 years ago
FPS on GCW-Zero is about 8
Update AI every 4 frames; this reduced the cost of UpdateAllActors, so approximately 3% speedup. More can be done; on this mission there are about 114 enemies. Updating a fixed number of AIs per frame (say 10) should make the AI a fixed cost. This can be improved so that enemies closer to the players are prioritised.
Next most expensive function:
New profiling:
Areas to improve:
Optimised DrawFloor by drawing as textures - percent of time dropped to 1.22%. Strangely now the whole game takes 75% CPU instead of 99% before.
One side effect is that the blob shadows need to be redone otherwise they don't show up properly over the floor.
Some of the optimisations have to do with rendering textures instead of to a pixel array. However we still need to render to a single "surface", for the game background and for the editor. But in this case, we should be using SDL_SetRenderTarget
, so that the drawing code doesn't change. Replace the renderToTex
parameters added recently.
Converted more blitting functions to use texture rendering. This has dropped DrawWallsAndThings
from 8% down to 4%, although strangely total CPU has dropped to 50% and DrawDebris
has gone up from 2% to 4%. Maybe there's some extra graphics latency here?
This has also introduced some graphics glitches. Map objects like barrels appear behind walls - perhaps walls are still being blitted. "Background" tinted objects like gas clouds no longer look right, will need to redo them.
Profiling results after character blitting converted to texture renders. Curiously the overall draw time hasn't reduced by much, although DrawFloor has shot up.
Need to benchmark under GCW-Zero; perhaps there is too much slowdown caused by rendering many small textures. Switching to texture atlases may be necessary.
Unfortunately performance on GCW-Zero has become worse, at about 6fps.
Abandoning this for now; will possibly revisit once we look into a handheld platform again
Profiling from visual studio on doom mission 3 shows update and draw both taking about 40% CPU. Expensive operations include:
Two obvious optimisations: HUD is unexpectedly expensive, even more expensive than drawing the game, and also the map has lots of actors so lots of the update expense is on basic updating and collision detection.