Game Development Community

Sharing Templates Across Multiple Levels

by Alex Chouls · in Torque X 2D · 01/01/2007 (11:11 pm) · 9 replies

Is there a way to share templates across multiple levels?

If not, is there a strategy for building multiple levels? E.g. you have many levels that all use the same resources (with settings, components etc.) and you want to use the level editor to place them in each level...

Thanks,
Alex

#1
01/01/2007 (11:54 pm)
Build and load your templates from a separate xml file. Then you can unload the level file without unloading your templates. You could also build the templates purely in code. I think there's something about persistent objects too though I haven't played with it at all.
#2
01/02/2007 (11:31 am)
Is there a way to load a seperate template xml file in the tool?
#3
01/02/2007 (3:01 pm)
Do you mean TGBX? No, I don't believe there is, but explore the persistence options.
#4
01/03/2007 (9:38 am)
Thanks, I'll look into persistent objects.

Presumably this is more of a code side thing - I'm still really curious about how people handle this in TGBX? Do you have to have a copy of all your game entity templates in every level? That doesn't seem very practical...?
#5
01/03/2007 (11:43 am)
I'm pretty sure there's a checkbox somewhere in TGBX that is marked "persistent" or something like that.
#6
01/08/2007 (8:03 pm)
The "persistent" flag will keep the object around after a call to SceneLoader.Unload (in code), although as far as TGBX, we have been talking internally about the notion of a "global objects" file to be inherited/depended-upon from within a .txscene file.

This would allow you to create a set of global templates up, and reference them from multiple levels.

As to whether these will make 1.0, I'm not positive, but it's definitely an internal request as well.
#7
01/12/2007 (9:26 pm)
Thanks Trevor,

I hope this feature makes it into 1.0! Working on anything more complex than a single demo level isn't much fun without it... although, all in all, I'm still having a lot of fun with TorqueX!
#8
01/16/2007 (5:04 am)
I agree. I'm not sure on the final functionality, but from what I understand it's intended to work something like this: It basically hides the template/spawner paradigm from you. Whenever you create a unique object, a template will be created and added to your project's "library" of objects with the option to name. You will then be able to add it to any level within that project. Behind the scenes it will save off that library as an xml file, just like the levels, and write out templates for everything in the library and all the placed objects in the levels will be written out as references to the project library templates. At least that's my understanding of the basic idea.

There's no telling if this will be in by 1.0, though, so don't be dissapointed if it doesn't make it.
#9
05/22/2007 (4:18 pm)
Now that 1.0 is finished and waiting to be shipped - did this make it in?