Author Topic: Loading external bgm before game starts  (Read 1909 times)

merkflank

  • Trial Wannabe
  • Posts: 5
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 37.0.2062.120 Chrome 37.0.2062.120
    • View Profile
  • Playstyle: Keyboard
Loading external bgm before game starts
« 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:

Starz0r

  • Owner
  • The Kid
  • Administrator
  • Posts: 343
  • Hall Of Fame
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 31.0.1650.63 Chrome 31.0.1650.63
    • View Profile
  • Playstyle: Keyboard
Re: Loading external bgm before game starts
« Reply #1 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. :/

klazen108

  • Administrator
  • The Kid
  • Posts: 286
  • your a kid now your a squid now
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Firefox 32.0 Firefox 32.0
    • View Profile
    • Delicious-Fruit
  • Playstyle: Keyboard
Re: Loading external bgm before game starts
« Reply #2 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.

merkflank

  • Trial Wannabe
  • Posts: 5
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 37.0.2062.120 Chrome 37.0.2062.120
    • View Profile
  • Playstyle: Keyboard
Re: Loading external bgm before game starts
« Reply #3 on: September 17, 2014, 03:38:30 PM »
Alright, well thanks for telling me! I'll just test out some stuff then  :atkHappy:

pieceofcheese87

  • Global Moderator
  • The Kid
  • Posts: 346
  • Personal Text
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 37.0.2062.120 Chrome 37.0.2062.120
    • View Profile
    • Twitch Tv Channel
  • Playstyle: Keyboard
Re: Loading external bgm before game starts
« Reply #4 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.
Signature