Game Development Community

Please move sg scripts to common folder

by Jerald Reichstein · in Torque Game Engine · 06/21/2005 (3:11 pm) · 10 replies

I think it would be a good idea to move all of your sg scripts and icons and stuff into the common folder, start them from there

that way every game project you have in your example folder will have access to all of the sg stuff

without people having to figure out exactly what specific items they need to copy over when they start a new project (the light icon, and predefined light datablocks)

i copied it all over on mine cause at one point we had like 5-6 games going and it was a pain to manage the sg stuff for every one everytime we changed or made a new light for example

but the problem now is whenever theyre are new versions its a tremendous headache to figure out what new files i have to copy into common again. especially since so much has changed since the last version

also i liked it before when you did have the migration guide/patches and just the changed/new files instead of the entire thing

cause now i gotta diff thru hundreds of files which i have changed and figure out which are my changes, and which are yours

migration is a huge headache and the download is bigger

#1
06/21/2005 (3:36 pm)
Yea this is a nightmare..
i dont even know for sure if its possible


most of your script side stuff is in starter.fps, the part of it is in common but makes hard references to the starter.fps stuff

and i dont know what an .sgo file is but it isnt ascii and i cant change it.. i dont know if there are more hardcoded references in there

is that some kind of precompiled script? why isnt it open source like everything else

i cant name my project folder starter.fps thats just retarded..
and id rather keep everything in common like i had before.. but the editor has no lights available
#2
06/21/2005 (6:52 pm)
Hi Jerald,

The Migration Guide contains a list of the changed files, so you can skip over the files you've changed while merging. The changed file list also contains the changed TGE script files, so you can easily compare the files in 'starter.fps' with your mod.

Check out this Script Patch, it removes all hard references in the sgo's. The Lighting Pack script source files were pulled from the pack because they were being distributed with demos and games (against the license).

All Lighting Pack files are already in the common directory (script files, icons, ...). The Lighting Pack datablocks can be moved by tweaking the file 'common\synapseGaming\contentPacks\lightingPack\sgDeployConfig.cs'.

-John
#3
06/23/2005 (8:23 am)
I can verify this works flawlessly, Initially, it kinda threw us, but you can actually merge the common files anywhere you want, and all works as it should
#4
06/23/2005 (9:18 am)
What about the changes to game.cs and init.cs in the starter.fps?

this is in initClient init.cs

//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------
exec("common/synapseGaming/contentPacks/lightingPack/sgDeployClient.cs");
//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------

this is in onServerCreated game.cs
//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------
exec("common/synapseGaming/contentPacks/lightingPack/sgDeployServer.cs");
exec("./sgExamples.cs");
//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------

i made an onCommonServerCreated() in the common folder to run the onServerCreated stuff (minus the examples cause i dont need that)
but im not sure where a good place is to move the client init stuff in the common folder
#5
06/24/2005 (3:18 am)
You can try using 'initBaseClient' and 'initBaseServer' in 'common/main.cs', these might work (though I've never tried using them).

Let me know if those work and I'll look into moving the calls there permanently.
#6
06/26/2005 (2:39 am)
I have a similar issue with the reference to the starter.fps directory in the light editor's .sgo

I don't use starter.fps as my base game folder and it can be rather irritating to have to move the
new light scripts into the correct folder every time I use the light editor.

I know this is pretty trivial but is there some easy way for me to change the save/load paths
for the light editor?
#7
06/26/2005 (5:23 am)
The script file 'common/synapseGaming/contentPacks/lightingPack/sgDeployConfig.cs' contains all of the Lighting Pack path variables (you'll need the script library patch mentioned above) - you can change these to whatever you like, but make sure the variables target an active mod directory (Torque only loads files from the active mods).
#8
06/28/2005 (10:49 am)
I can also verify that this is all possible. We currently do not have a common or a starter.fps directory. We were able to modify all the lighting paths to use just our games directory with no problems. It might take some script hunting but its all possible.
#9
06/28/2005 (3:33 pm)
Ok i put
//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------
exec("common/synapseGaming/contentPacks/lightingPack/sgDeployServer.cs");
//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------
in common/server/server.cs right after onServerCreated(); (about line 48)

and i put

//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------
exec("common/synapseGaming/contentPacks/lightingPack/sgDeployClient.cs");
//-----------------------------------------------
// Lighting Pack code block
//-----------------------------------------------

in common/client/canvas.cs right before OpenALInit(); (about line 49)

i tried what you originally suggested, and the client side stuff crashed because there was no GuiModelessDialog stuff yet
also the server stuff did extremely bizzare stuff if you call it where you suggested
#10
06/28/2005 (6:17 pm)
Ok, it sounds like that won't work - I was hoping those functions would provide alternative locations for the code.

Basically the problem is that the majority of the init functions defined in common are overridden by starter.fps. In order to avoid this you would need to add code to each mod to call into new methods in common, but that's no different than just using the Lighting Pack code.

Are you using a generic mod template to create all new mods? If the Lighting Pack code was added to the template all of the mods that copy the template would have the code. The common/.../deploy directory was specifically designed to minimize Lighting Pack code in the mod directories, so new code will likely end up in the deploy directory and not in the mods.