Jump to content


Photo

Media Resource Management in GM:Studio


  • Please log in to reply
3 replies to this topic

#1 Greg Squire

Greg Squire

    GMC Member

  • GMC Member
  • 33 posts
  • Version:GM:Studio

Posted 01 August 2012 - 04:58 PM

I'm trying to get my head around the best way to handle large media resources in my game, such as background music or large background images. Typically in games these are loaded into memory only when they are needed, to conserve memory usage. However I'm not sure the best way to do this in GM:Studio. I found some older GML code that did some dynamic loading of music, but when I tried to do that in GM:Studio I couldn't get it to work. The only way I could get it to work was by adding each music track as a sound resource and then reference the appropriate sound for each level.

So my question is, Does GM:Studio take care of this loading and unloading of resources in the background? or does it just load all resources into memory (which seems wasteful)? or do we need to handle that ourselves in the game? If so, how do you do dynamic loading of media in GM:Studio, both sound and images?

Edited by Greg Squire, 01 August 2012 - 05:00 PM.

  • 0

#2 Greg Squire

Greg Squire

    GMC Member

  • GMC Member
  • 33 posts
  • Version:GM:Studio

Posted 16 August 2012 - 03:17 PM

Does anyone know the answer to this? What's the recommended way to handle large resources in your game? Load and Unload them yourself? or Add them as regular resources in your project (under sounds and backgrounds) and let GM:Studio handle them underneath?
  • 0

#3 Mr.Chubigans

Mr.Chubigans

    Hot, Sexy Gila Mobster

  • GMC Member
  • 491 posts

Posted 18 August 2012 - 04:55 PM

I'm trying to get my head around the best way to handle large media resources in my game, such as background music or large background images. Typically in games these are loaded into memory only when they are needed, to conserve memory usage. However I'm not sure the best way to do this in GM:Studio. I found some older GML code that did some dynamic loading of music, but when I tried to do that in GM:Studio I couldn't get it to work. The only way I could get it to work was by adding each music track as a sound resource and then reference the appropriate sound for each level.

So my question is, Does GM:Studio take care of this loading and unloading of resources in the background? or does it just load all resources into memory (which seems wasteful)? or do we need to handle that ourselves in the game? If so, how do you do dynamic loading of media in GM:Studio, both sound and images?

Thats a really good question actually. I'd like to know this as well.
  • 0

#4 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 1489 posts
  • Version:GM:Studio

Posted 18 August 2012 - 05:52 PM

mp3s are always streamed, so are never "all" in memory.

Using background_add() or background_replace() lets you add backgrounds dynamically, as does sprite_add() and sprite_replace(). These are standard GameMaker functions and have been there for sometime. HOWEVER.... using them will slow down rendering as you increase texture swapping - use with care.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users