Game Development Community

How can i make may own template

by M. Stolley · in Torque Game Builder · 06/28/2006 (2:00 am) · 1 replies

Hi,

i just thought it would be good to make some things faster, things that will come each time again in my different games. So i will make a Template in wich i have i.e. 2 splash screen and a main menu in wich i have an exit button and so on.

What i do not know is how can i save this project as a template so that i can use it for my new games.
It would be nice to use my own templates to start my games so that i do not make i.e. the splash screens again for each game.

Mathias

#1
06/29/2006 (2:05 am)
I was kind of curious about this since you asked, so I went ahead and figured it out. For your purposes (where you are using different templates on the same computer) I think this will do just fine, however I would reccommed using Resources instead, since resources you can change later and the changes will affect all projects that use that Resource. Templates basically just copy a folder, so if you change the template, you would have to create a new project to make use of those changes. Also, resources can easily be distributed, whereas adding a template requires you to edit script which can become very messy if you have multiple developers on the same project. Generally it's a bad idea in almost all cases to use a template - use resources instead. Anyway, just for S+G here's how to make a template:

1. Create your template just like any other project. Get all the functionality you need into the template.

2. Copy the project folder into "...\games\tools\projectWizard\templates\"

3. Edit "games\tools\projectWizard\main.cs" to add the following two parts:

A) At the top:
$templatesDirectory = "tools/projectWizard/templates";
$newProjectTemplate["Empty Game"] = $templatesDirectory @ "/base";
$newProjectTemplate["Empty Game - No LevelBuilder"] = $templatesDirectory @ "/notools";
$newProjectTemplate["Fish"] = $templatesDirectory @ "/Fish";

// create your template like this:
$newProjectTemplate["MyTemplate"] = $templatesDirectory @ "/myTemplateProjectFolder";

B) A little lower...
function newProject()
{
   Canvas.pushDialog(NewProjectDlg);
   
   templateListBox.clear();
   templateListBox.add("Empty Game", 0);
   templateListBox.add("Empty Game - No LevelBuilder", 1);
   templateListBox.add("Fish", 2);

   // add your template to the listbox here... must be a 
   // unique number for the second argument
   templateListBox.add("MyTemplate", 3);

   templateListBox.setSelected( 0 );
}

Again, I *strongly suggest against* using templates for the reasons I stated above. I believe there is a tutorial on how to create resources included with TGB.