I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: merkflank on September 17, 2014, 05:51:47 AM

Title: Loading external bgm before game starts
Post by: merkflank on September 17, 2014, 05:51:47 AM
Can anyone teach me how to preload external music into my game? I wan't it to be like Kill the Maker and Kill the Kamilia 3 where it has a screen to load the music before the game actually starts. I really don't want the game to be frozen for like 2-5 seconds everytime the game loads some new external music file so any help is appreciated.  :atkCry:
Title: Re: Loading external bgm before game starts
Post by: Starz0r on September 17, 2014, 08:37:23 AM
The game will be frozen either way. The way that Kill The Maker does it and Kamilia 3 just loads it slower, nothing you can really do about it because its just how SuperSound works. :/
Title: Re: Loading external bgm before game starts
Post by: klazen108 on September 17, 2014, 10:35:41 AM
Yep, the best you can do is to load one song file every step event - that should avoid the game giving the appearance of "locking up". This has the added benefit of allowing you to increment a progress bar during the step event for an accurate representation of loading. I've done this before, it works pretty well.

Unfortunately, there's no way to have parallel processes in GM, so you can't have the main game thread executing and then spawn off a separate process to load the music (at least as far as I know, you might be able to hack this functionality in with an external library, but I haven't seen it yet!). You've gotta break the task down into chunks that the game can run in its loop to give the appearance of multitasking.
Title: Re: Loading external bgm before game starts
Post by: merkflank on September 17, 2014, 03:38:30 PM
Alright, well thanks for telling me! I'll just test out some stuff then  :atkHappy:
Title: Re: Loading external bgm before game starts
Post by: pieceofcheese87 on September 18, 2014, 10:58:57 AM
Yeah, when the game is loading the music, it runs at about 0.5fps so you can't have a loading animation or anything like that.