The profiler is your friend…just sayin’.
Anyhoo, there were a number of tweaks here and there and one of them was the use of surfaces in GML. These are nifty because they allow you to draw to a surface and then just display that already-drawn surface over and over until you no longer need it. It’s kind of like creating an on-the-fly sprite instead of redrawing each element every time the frame changes.
I used it on the overall map, drawing out everything the player couldn’t possibly reach from their current location, knowing those items could be used in any sort of interaction. So, instead of drawing a 20×20 (or whatever it is) array worth of circles and names and connecting lines every single frame, I just draw it out once at the opening of the map, and only have to do frame-by-frame drawing of the stuff close to the player’s position.
It speed up stuff a lot.
And, yes, campers, I remembered to free the surface when the map closes. 😉
Progress
- Did some profiling work.
- Forcing a “return” on functions whenever the game is “paused”.
- Removed a number of recreated variables that can be created only at the start of the call.
- Using surfaces where I can so I don’t redraw sections of the screen from scratch all the time.