December Man, on 14 May 2017 - 07:54 AM, said:
Ok, so which TEMP variables should I rename? A lot of them are attached to footstep sounds and HUD elements. What is the maximum number of TEMP variables a mod should have?
I'm not saying you should rename them unless they actually need to be per-actor. In almost every case they should be declared as global. Pretty much* the only time a var needs to be per-actor is when an actor uses the var again in a later tic and your code assumes that it still has the same value that it had the last time the actor accessed it. An example of this would be if you wanted to save the actor's angle from the previous tic, in order to prevent it from automatically facing the player when shot. On a modern PC, I don't imagine that it's a significant issue to have, say, 30 per-actor vars that could have been global. At about 50 kilobytes per var, that still only adds up to 1.5 MB of wasted memory.
*An exception to this arises if you have code in events such as EVENT_EGS which manipulates vars, since a global var could be changed when a sprite spawns.