How to add DIF files
by Robert S. · in Torque Game Engine · 03/31/2005 (2:20 am) · 6 replies
Hi, I want to build in TGE a dynamic road network. For this I have the road elements as dif files and I want place them on the map.
My problem is that I don't know how to add the dif files to the missions scripts and how to place them to certain coordinates.
Please guide me.
Thanks.
My problem is that I don't know how to add the dif files to the missions scripts and how to place them to certain coordinates.
Please guide me.
Thanks.
About the author
Creator of VisitorVille.com
#2
start the starter.fps. Start the mission. Press F11 then F4 to bring up the ADD to WORLD feature(im just naming them, not really sure exactly). Click the plus sign besides the interior from the list
keep on clicking then click your dif file. You'll see your dif, colored black. Thats because Light are not yet updated. To update it, press ALT-L.
03/31/2005 (3:48 am)
Just place them in the data/interiors folder. Actually, any folder will do, TGE scans the subdirectory and when it finds a dif it adds to the interior list.start the starter.fps. Start the mission. Press F11 then F4 to bring up the ADD to WORLD feature(im just naming them, not really sure exactly). Click the plus sign besides the interior from the list
keep on clicking then click your dif file. You'll see your dif, colored black. Thats because Light are not yet updated. To update it, press ALT-L.
#3
I want to add them procedurally, with scripts, because the number of road elements and their location is not fixed and can be changed during the execution of the program. Please provide some code samples, if possible, which solve the problem.
Thanks.
03/31/2005 (5:50 am)
Thanks for the answers, but my problem still exists because I can't add those difs with the mission editor.I want to add them procedurally, with scripts, because the number of road elements and their location is not fixed and can be changed during the execution of the program. Please provide some code samples, if possible, which solve the problem.
Thanks.
#4
03/31/2005 (6:32 am)
You can write c++ class that will generate your *.mis file before actualy loadin a mission. I think it even possible to create such mission file using only script.
#5
I understand what you're trying to do. What Mat was suggesting is to look at the mission file. It's basically a script that adds mission objects to a screen. It provides the example for which you're looking.
It's not that you want to create a dynamic mission file, you want to create your streets and roads on the fly in real time if I understand.
One problem you will find is that when interior objects are instantiated they are black until the scene is re-lit. Which means after you add the objects you will have to re-light the scene to see the textures and such. I don't know enough about Torque to get around this but one possible way, but again i don't know if you can do this, is to create your basic blocks for streets and store them in memory. Then when it's time to add one you clone the object and place it on the scene. Upon mission start you will have to add the objects to the scene, re-light the scene, then remove the objects and store them in memory.
Not sure if this helps but it's an idea. :)
joe
03/31/2005 (6:35 am)
Robert,I understand what you're trying to do. What Mat was suggesting is to look at the mission file. It's basically a script that adds mission objects to a screen. It provides the example for which you're looking.
It's not that you want to create a dynamic mission file, you want to create your streets and roads on the fly in real time if I understand.
One problem you will find is that when interior objects are instantiated they are black until the scene is re-lit. Which means after you add the objects you will have to re-light the scene to see the textures and such. I don't know enough about Torque to get around this but one possible way, but again i don't know if you can do this, is to create your basic blocks for streets and store them in memory. Then when it's time to add one you clone the object and place it on the scene. Upon mission start you will have to add the objects to the scene, re-light the scene, then remove the objects and store them in memory.
Not sure if this helps but it's an idea. :)
joe
#6
03/31/2005 (6:42 am)
Somewhere on forum was topic about moving interriors (for vehicles or boats they used dif), and thay solved probem of re-lighting such objects. Try to search if you need this.
Associate Matt Fairfax
PopCap
If you want to place them procedurally you can generate a mission file with some code or an external tool (if you open one of them up in a text editor you will see that they are just text files instantiating objects).