• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Sound_delete causing game to crash?

L

LV154

Guest
Dear all,

My project is a top down shooter that involves loading and unloading external sounds whilst driving a car. Sometimes, but not always, the game freezes and crashes without a fatal error when I exit a vehicle. Usually, the looping song stops, but I would occasionally notice that the sound carries on playing after I exit a vehicle, then a fraction of a second later the entire game freezes and crashes with no message.

When the player exits a vehicle, an alarm is initiated to the car parent object which involves the following:

.....code to create the player if place is free etc.....
if sound_exists(radio){
sound_stop(radio){
sound_delete(radio){radio=0}}}

I've put in sound_stop before sound delete thinking this would solve the problem but it still persists.

I'm not sure whether this is an issue with memory, as the last time this has happened the memory wasn't exactly full. Perhaps I'm missing something out here, or looking in the wrong place altogether? Am I asking the computer to do way too many things too quickly?

I really appreciate any input, perhaps some of you know more about game processes more than I do.

Thanks
 
What version of Game Maker are you using? It doesn't seem to be part of GMS 2, and in the GMS 1.4 docs it says:
NOTE: This is a permanent removal that lasts as long as the game is running, meaning that if the deleted sound is an included game asset, even restarting the game with game_restart will not restore the sound. For that the game must be exited and re-loaded again.
sound_delete() removes the sound from your game memory and resources totally until you restart the game completely.

Is that your intention with this code?
 
L

LV154

Guest
What version of Game Maker are you using? It doesn't seem to be part of GMS 2, and in the GMS 1.4 docs it says:


sound_delete() removes the sound from your game memory and resources totally until you restart the game completely.

Is that your intention with this code?
Thanks for the reply. Yeah, as the radio wouldn't be needed if the player is on foot. It's an external sound that is loaded into memory every time the player enters a vehicle or changes the radio station.
 
L

LV154

Guest
How many MB is the file?
The exe itself is approximately 15mb. the largest sound file is 1.6mb, while the average is 500kb

I think it's worth noting that, according to task manager, the game takes up 450mb of memory. This is quite high, but the game is more or less complete and involves a lot of external resources.
 
Top