Fangames > Programming Questions
Out of Memory Error
Derf:
That is far far far too big for a game maker file. No game, even 100% complete should be that big. That is most likely the source of your crashes.
First of all, there's no need to use music files as big as I presume you are using, most people won't be able to tell the difference in bitrate between some of those and compressed mp3s/oggs, let alone in game while concentrating on gameplay. You should compress those files down, no one's going to download a fangame that's 4GB big just because of music.
Secondly, you need to load them externally so the game make file doesn't hold all of the music files. This thread explains how in quite some depth.
Following these steps will most likely fix your issues.
klazen108:
208MB? Oh yeah, that's absolutely your issue then. Since you're using the yosniper engine, the quick fix is to just convert those WAV files to mp3, and then put them back in your game. It'll work exactly the same, provided your game doesn't try to play two mp3s at once (gm8/8.1 can't do that). You only need to do this for the music, the sfx can and should stay as wav files.
After you've done that, if you still need to save memory, external loading of music is where you go to next. It would be easier if you were using, say, the Seph engine, since it comes with the FMOD sound engine and external music loading built right in, but setting up the yosniper engine to externally load music might be a little tricky (not to mention the potential source of some more memory leaks!) I wouldn't recommend it unless you feel comfortable modifying the engine like that.
Katz:
--- Quote from: klazen108 on August 18, 2015, 01:36:47 PM ---208MB? Oh yeah, that's absolutely your issue then. Since you're using the yosniper engine, the quick fix is to just convert those WAV files to mp3, and then put them back in your game. It'll work exactly the same, provided your game doesn't try to play two mp3s at once (gm8/8.1 can't do that). You only need to do this for the music, the sfx can and should stay as wav files.
After you've done that, if you still need to save memory, external loading of music is where you go to next. It would be easier if you were using, say, the Seph engine, since it comes with the FMOD sound engine and external music loading built right in, but setting up the yosniper engine to externally load music might be a little tricky (not to mention the potential source of some more memory leaks!) I wouldn't recommend it unless you feel comfortable modifying the engine like that.
--- End quote ---
nvm
Derf:
No that would cause memory leaks.
What you need to do is run a script at start up that does something like:
--- Code: ---global.song1 = sound_add(working_directory+"\BGM\song1.mp3",3,1);
global.song2 = sound_add(working_directory+"\BGM\song2.mp3",3,1);
global.song3 = sound_add(working_directory+"\BGM\song3.mp3",3,1);
global.song4 = sound_add(working_directory+"\BGM\song4.mp3",3,1);
etc
etc
--- End code ---
Listing all your songs, and then just call the global variables every time you wanted to change music later on. Instead of adding duplicate sound files to the memory unnecessarily.
If you want to attempt it Tamatou it really isn't too difficult and it's all laid out here + in the link.
Tamatou:
Thank you so much guys :atkHappy:
I haven't gotten a chance to try that yet since I'm on a vacation. But as soon as I return I'll try following your instructions and let you know if it worked
Navigation
[0] Message Index
[*] Previous page
Go to full version