So I was reading an article here on scirra about too much memory usage, and how to avoid it.
Firstly, I want to thank you for how specifically and throughly you worded it, without using tons of terms that can go over people's heads. I can offer the same praise to the C2 manual, if I haven't yet done so.
So, I decided that my game's memory usage was slightly too big, but not too terribly (141 MB, and you said to keep in less than 100). However, although I managed to reduce the "estimated memory" by about 11MB, I couldn't find too many more images that were extremely big, or too many junk ones that I was willing to remove.
So this prompted me to write a message there. After I posted it, I suddenly decided it was better off posted here to allow the possibility of more in depth discussion. So here is my message, take it as if I am saying it here and now as opposed to past tense.
-----------------------
May I ask how big of a difference it is to avoid redundant events, conditions, actions, etc and stuff?
For example, having a variable with 20 possibities, and then putting 20 "if" type events instead of simplifying it into one event that checked it.
Like for example, 30+ playable characters, the events for changing their animations, and a variable that corresponds to the index of the character being played as (each character has both a numerical value and an "internal name" string). It now sets animation by name to things like currentplayername&"stand" currentplayername&"walk" etc instead of having a large list of events for every possible character. But as some characters are also animated differently, there are actually about 5 or 6 of these "large lists" as different possibilities. There is one variable that gets checked to determine which one is used, rather than having a bunch of "or" conditions for all the characters. However, said "or" events still happen at the start of layout just to set this value. It's just not checking all these conditions every tick anymore.
I also have some uneccessary things, like, weapons that use no energy, still have energy variables, and also check to make sure they never go above the maximum energy or below zero. And also these weapons to still have energy bars that are animated accordingly. This type of thing is used for consistency, and just in case to allow for future possibilities. But, is the difference in memory usage worth being inconsistent if leaving this type of stuff out makes it lag less?
Also, every possible enemy (currently 8 boss objects and 6 normal enemy objects) has a collision event with every possible bullet object (currently about 30+), due to the weakness/resistence stuff. I want it to be flexible, and allow infinite possibilities, so there is no rulebound "elements" that these weapons are tied to. Almost every single one of these events also has two sub events, to check whether or not the enemy was killed or not from the hit it just received. I am uncertain whether or not coming up with some kind of system for using families to lessen the number of events would be essential or not. I don't mind making all these events, especially with the inclusion of "replace object" after duplicating and highlighting lots of stuff. Only if it has a large effect on memory usage or lag, do I wish to try to change this.
I would like to know if this kinda thing is even worth doing, and if so, by how much?
And given that I have already simplified lots of this type of stuff, am I making it sound like my changes were good enough? Perhaps I didn't even need to do them to begin with? Sorry if this is too vague. I don't expect you to see into my mind completely, just get a feel for the type of thing I have described, if you possibly can.
---------------