Game Development Community

Unload Files

by Nathan Kent · in Torque Game Engine · 06/15/2008 (8:28 am) · 2 replies

Is it possible to unload TorqueScript files from memory? I know that I could use packages, but for what I want, that would be a little awkward. Let me explain:

I want to make an RPG with Torque, and what I would like to do is have a file hierarchy similar to this.
|Zone1->Scripts&Datablocks  <- Code specific for zone1
                             |Zone2->Scripts&Datablocks  <- Code specific for zone2
Root->Game->Server->Scripts->|Common->Scripts&Datablocks <- Code that all zones need (Player, spells, etc)
                             |Zone3->Scripts&Datablocks  <- Code for zone3
                             |Zone4->Scripts&Datablocks  <- Code for zone4

What I would like to do is "unload" the code and datablocks for the zones that aren't in use. If I did that, the game would have less overhead, and I could have a method for AIPlayer be different in each zone. I would like to be able to use it similar to
unloadFolder(%client.currentZone); //<- ??
loadFolder(%nextZone); //<-Could be just executing every script in folder
It would be similar to activating and deactivating packages, but I wouldn't want to use packages for every single script file I put in the folder. It would be ideal if I could just drop script files in the folder and not have to worry about making sure that I deactivate it's package when out of the zone, and reactivating it when going back in.

If anyone could tell me how to do this, or where to start, I'd appreciate it!

#1
06/16/2008 (9:32 am)
I've looked into the file deleting code, but unless I'm wrong, that only remove the file from the Hard Drive, but all the function/datablocks are still there. I haven't tested using that code, but glancing through it, that's what it looks like to me.
#2
08/12/2008 (6:03 pm)
Bump

Still have no clue, but still searching. I've been looking into reversing the exec function, but I'm not having any luck at understanding it.