Global arrays increasing file size

Started by Monsieur OUXX, Mon 02/07/2007 00:59:01

Previous topic - Next topic

Monsieur OUXX

Quote from: Pumaman on Mon 06/06/2005 18:50:56
There is no fixed limit on the size of global arrays, but as scotch says they use up memory

I noticed that global arrays (declared in the body of a module) increase the size of the compiled game on the hard drive.
=> An array of 100,000,000 ints will cause the game to use 100,000,000*32 bits = 400 MB on the HD...

I can't understand why "volatile" variables (like arrays) should be stored on the hard drive, not just created in the RAM when the game starts???
 

GarageGothic

#1
Yeah, that has puzzled me too - I have multiple databases in my game and just declaring the structs bloated the file size by several megs. Fortunately they compress very well, so it's not a problem when distributing the game.

Scorpiorus

I guess it may be the initial values of an array that take up space in the exe module; all are zeros, however.

Monsieur OUXX

Quote from: Scorpiorus on Tue 03/07/2007 14:09:02
I guess it may be the initial values of an array that take up space


You must be right
 

Gilbert

I'm not quite sure, but if that's the case the variable initialisation value data in an AGS game can be compressed VERY well in general even if they are just RLE-encoded.

So, I think it is a reasonable enough suggestion to provide an option to compress script data via RLE (like with the sprites) if it's possible.

Pumaman

That would be possible, but I would advise against creating 400 MB worth of script arrays; remember that it has to fit into memory at run time, so you'd be giving your game a minimum system requirement of 400 MB RAM plus the normal game requirements.

What are you trying to accomplish? Perhaps there's a better way.

Monsieur OUXX

Quote from: Pumaman on Tue 03/07/2007 20:45:39
I would advise against creating 400 MB worth of script arrays; What are you trying to accomplish?

Don't worry, it's not my goal. I was just frustrated to see that a technical choice I made (storing some data into arrays) had a totally unexpected side-effect (increasing the game's size).

But, to answer Gilbot, this extra-volume has excellent compression-rates since there are only zeros. So even without a native script-compression, compressing the game into a RAR or a ZIP* is perfect.


* or an ARJ -- BAM BAM! I'll teach you to say stupid things.  ;)
 

SMF spam blocked by CleanTalk