Switch Folders
by DarkProfit · in Torque Game Engine · 06/27/2007 (3:24 pm) · 11 replies
Anyone know if this is possible
2 Games
1: starter.racing
2: starter.fps
1 Console window that can switch between the 2 folders and reload without shutting
down the window and reloading another exe.
2 Games
1: starter.racing
2: starter.fps
1 Console window that can switch between the 2 folders and reload without shutting
down the window and reloading another exe.
About the author
#2
06/27/2007 (3:53 pm)
What I was kind of thinking was turning the engine into a dll file, then swaping out the dll files, what do you think about that (pros/cons) etc.
#3
06/27/2007 (4:26 pm)
Unless I'm completely missing something.....this can be done completely from script in 1 carefully written function. Packing up the engine into a dll sounds like way more work than necessary for what you might be describing.
#4
06/27/2007 (4:29 pm)
Unless i am missing something and there is away to unload "everything" then switch to a different main.cs i am thinking easier to load/unload dll's
#5
Let's use your example:
We have 2 sample games: example\starter.fps and example\starter.racing:
In Main.cs we have this:
This will cause the first game to start to be the starter.fps. Everyone is already aware of that basic concept. So, let's take it further now:
That's just a real rough starter function, but you get the idea. Using the console, GUI Button, or hotkey, you can send in a different mod to switch to and perform everything without dlls. If you already know the folder paths of your game mods, you can make it super clean and clever, and may be able to avoid exec() on main.cs all together.
06/28/2007 (5:06 am)
You are right DarkProfit. There is a way to unload everything, but once that action is performed, you can simply load up a different mod.Let's use your example:
We have 2 sample games: example\starter.fps and example\starter.racing:
In Main.cs we have this:
$defaultGame = "starter.fps";
This will cause the first game to start to be the starter.fps. Everyone is already aware of that basic concept. So, let's take it further now:
function switchGames(%gameName)
{
disconnect(); // Disconnect the game and all assets if a server is running
purgeAll(); // Made up function which will do full clean up of mod
$defaultGame = %gameName;
exec("main.cs"); // Restart to new mod
}That's just a real rough starter function, but you get the idea. Using the console, GUI Button, or hotkey, you can send in a different mod to switch to and perform everything without dlls. If you already know the folder paths of your game mods, you can make it super clean and clever, and may be able to avoid exec() on main.cs all together.
#6
But the million dollar question is what are the functions / commands that "unload" files and assests.
ie:
06/28/2007 (5:49 am)
Michael,But the million dollar question is what are the functions / commands that "unload" files and assests.
ie:
function purgeAll(){
//unload everything
unload("./playgui.gui")
unload("./playgui.cs")
unload(etc....)
}
#7
deleteDataBlocks()
06/28/2007 (6:20 am)
Would this help?deleteDataBlocks()
Quote:
Use the deleteDataBlocks function to cause a server to delete all datablocks that have thus far been loaded and defined.
#8
06/28/2007 (6:25 am)
Beat me to it, yup, that's definitely the route to go
#9
@Michael hehehe thanks for all your help and advise :)
06/28/2007 (6:32 am)
@mb yeah that seems like it will work gonna build a test and check it out... Thanks@Michael hehehe thanks for all your help and advise :)
#10
Let us know if it works, as this could make an excellent resource.
06/28/2007 (6:35 am)
No problem.Let us know if it works, as this could make an excellent resource.
#11
06/28/2007 (6:36 am)
Will do, my plan is to hook it up to a trigger and go from fps to racing so crossing fingers it works :)
Torque Owner Andy Rollins
ZDay Game