GML Visual Some questions which I need an answer...

Hello everyone!
Mind if I ask to the community some explanations?

1- What are all the things that occupy memory inside in Game Maker? (ex: sprites and objects)
2- There is a way I can keep the same origin spot as before after using the NO CROPPING tool?
3- Have you got any tips on how to occupy less memory as possible?

Thanks again for all of your actual and previews support! :D
 
D

dannyjenn

Guest
1. Everything occupies memory. Sprites and objects occupy memory (sprites--especially big sprites--generally occupy more memory than objects). All the built-in variables (health, score, etc.) also occupy memory (not much memory... just 8 bytes per numerical variable... but it is memory and it can add up). Sounds also occupy memory. Literally everything occupies memory. (I believe that even the compiled code/EXE file needs to be copied into RAM in order for the game to run...though I could be wrong about that... I don't know much about how computers work on the engineering side of things.)
2. I don't know, sorry.
3. The stuff that uses up the most memory is the graphics and the sounds, and perhaps any (very) large strings or data structures you might have. Definitely crop your sprites (and sounds), and use lower-resolution when possible. I don't think compression does much good (as far as I know, the graphics and sounds in RAM are uncompressed). Apart from that, I'm really not sure what you can do. But if you're ever using surfaces or data structures, be sure to destroy them when you're done. (GameMaker doesn't destroy them automatically, so if you forget to do it then you'll end up with a memory leak.)
What I would not do is obsessively "micro-optimize". There's no point in going out of your way, writing confusing and unconventional code, just so that you can save a few bytes here and there. Focus on the things like sprites and sounds which use up the most memory.
 
Last edited by a moderator:
1. Everything occupies memory. Sprites and objects occupy memory (sprites--especially big sprites--generally occupy more memory than objects). All the built-in variables (health, score, etc.) also occupy memory (not much memory... just 8 bytes per numerical variable... but it is memory and it can add up). Sounds also occupy memory. Literally everything occupies memory. (I believe that even the compiled code/EXE file needs to be copied into RAM in order for the game to run...though I could be wrong about that... I don't know much about how computers work on the engineering side of things.)
2. I don't know, sorry.
3. The stuff that uses up the most memory is the graphics and the sounds, and perhaps any (very) large strings or data structures you might have. Definitely crop your sprites (and sounds), and use lower-resolution when possible. I don't think compression does much good (as far as I know, the graphics and sounds in RAM are uncompressed). Apart from that, I'm really not sure what you can do. But if you're ever using surfaces or data structures, be sure to destroy them when you're done. (GameMaker doesn't destroy them automatically, so if you forget to do it then you'll end up with a memory leak.)
What I would not do is obsessively "micro-optimize". There's no point in going out of your way, writing confusing and unconventional code, just so that you can save a few bytes here and there. Focus on the things like sprites and sounds which use up the most memory.
I have calculated all bytes that sprites occupy, and the memory occupation by the sprite, doesn't go more than 10 MB.
Some people told me that the Game Maker maximum capacity for a game is 1.5 GB.

But, exactly, how much an object occupes? Because I have many of them.
 
D

dannyjenn

Guest
I've never heard of the 1.5GB limit before, though I suppose it could be true.

The size of an object (not an instance) will vary depending upon how much compiled code is in it. A completely empty object takes up little space, though I assume it still takes up some space.

The size of an instance depends upon how many variables are in it and what kind of variables they are. Every instance has a number of built-in variables (e.g. x, y, direction, speed, sprite_index, image_angle, etc.) so that much space is used regardless. (You could probably calculate it if you had a list of all the built-in variables, but I have no such list.) Each instance has its own copy of all these built-in variables. So, if you had an empty object, then two instances of it would take up twice as much space in the RAM as a single instance of it. Then in addition to the built-in variables, the instances will most likely have their own non-built-in variables. And if those variables are large strings/arrays/data structures, then the instances can become quite large. But generally speaking, instances are probably not your biggest concern.
 
Top