Game Development Community

Per-mission assets?

by James Spellman · in Torque Game Engine · 11/21/2005 (8:52 am) · 5 replies

This is one of those things where either I failed to grasp fully how the engine works, or I'm about to offend the Gods for even mentioning it. I've modded the engine so severly that I'm always afraid I yanked out something I didn't know I needed.

I've got about 40 character models that exist in my game. However, only about a quarter of them exist in any one mission. I'm trying to organize my assets so that only the datablocks I need are loaded for each mission. I've been able to load new characters as needed, but I can't seem to convince them to get out of RAM when they're no longer required.

Any suggestions?

#1
11/21/2005 (9:27 am)
Doing

datablockID.delete(); doesn't free them from memory?
#2
11/21/2005 (9:29 am)
I don't know if you've looked into this before, but you could see if Packages fit what you need to do.. more for a way to use the same code signatures to do different things though.
www.garagegames.com/docs/tge/general/ch05s02.php

If not, perhaps each level needs to be a seperate mod. This is also possible, alhtough I'm not sure what impact that would have on any possible multiplayer aspects.

Are you getting performance problems with all of the datablocks you've included slowing things down and eating memory or is this more of a worry at the moment.
#3
11/21/2005 (10:20 am)
@Ramen

I delete the server object and the client object gets deleted automatically. I delete the datablock. As far as I can tell, the textures are still in memory and still claim to have references.

@Jason

Yes. Tried packages. Great for code, but our code doesn't change. Doesn't appear to handle datablocks other than being able to having packaged routines make the appropriate create/destroy calls.
#4
11/21/2005 (11:37 am)
I forgot to mention that we load about 400MB of assets and the client wants the product to run on a 128MB machine, hence the need for heavy optimization.

I also discovered that I had forgotten to delete the actual shape datablock, so now when I run, dumpresourcestats reports that my objects have indeed been discarded. However dumptexturestats tells me that the textures are in memory with 0 references but the holding flag is still set.

So now I have to decided how to handle the flag. Flush? Manual texture unload? New flagbits for the shape objects to handle this situation? Or am I still not doing something properly?
#5
11/21/2005 (2:56 pm)
I just found ClearTextureHolds will do what I want, except for a wee little bug in the routine. I think for my purposes, I could also just set the ENABLE_HOLDING define in gTexManager.cc to zero. Without the call to ClearTextureHolds, however, I'm not sure when the textures would unload themselves.