Game Development Community

Creating an object without a mission

by Derk Adams · in Torque Game Engine · 02/24/2005 (1:47 pm) · 7 replies

Greetings,

I am trying to create a terrain object before loading a mission so I can modify the file before it is loaded. I have a button in the mainMenuGui that does:
function makeTerrain()
{

   new TerrainBlock(terrain) {
      rotation = "1 0 0 0";
      scale = "1 1 1";
      detailTexture = "~/data/terrains/details/detail1";
      terrainFile = "./mission.ter";
      squareSize = "8";
      bumpScale = "1";
      bumpOffset = "0.01";
      zeroBumpScale = "8";
         locked = "true";
         position = "-1024 -1024 0";
   };
   delete(terrain);
}
But I get the following error when clicked:
Register object failed for object Terrain of class TerrainBlock.
How do I make the TerrainBlock class available without loading a mission?

Thanks.

#1
02/24/2005 (1:57 pm)
At this point in time, I do not believe that Terrain files can be modified like this. Your best bet is to create a bunch of static terrain file then load one as needed in your mission (change the terrain file to load to a variable and load your mission inside a script that defines said variable).

Anyone know any other ways?
#2
02/24/2005 (2:34 pm)
Dave,

I thought of going that route, but it won't work for my game.

Does anyone know how the Show Mod manages to load an object without a mission? I haven't been able to figure it out yet.

Thanks.
#3
02/24/2005 (3:43 pm)
I can't find it currently, but awhile ago (2 years ago or so), someone had a Code Snipit that allowed you to load a terrain file into the HUD without loading the mission so it could be previwed in a canvas object.

I'll keep looking and see if I can find it, unless anyone can beat me to it!
#4
02/24/2005 (5:10 pm)
Dave,

I found:

http://www.garagegames.com/mg/forums/result.thread.php?qt=25595

I have emailed Edward for a little more explanation, but I'll take a solution from anyone.

Thanks.
#5
02/24/2005 (7:20 pm)
I just realized my mistake.

I am trying to do an activity on the client that needs to be done on the server. I will look to insert it into the point where the terrain is loaded on the server, make my changes, save them, and then send the new files to the client.

Thanks.

P.S. If you happen to know exactly where the terrain is loaded on the server, it would save me the time to find it.
#6
02/25/2005 (9:04 am)
Well,

Looking at the way the mission file is loaded and transmitted, it doesn't look like I will be able to interject in the middle.

Therefore, I'm back to making a change that will only work in Single Player (since a network game requires the terrain file on the client machine).

I have two choices and will take help on either one.

1. As stated before, I need to load a terrain object in a gui without loading a mission and make my modifications and save.

2. Try to figure out how to update the makeTestTerrain function to create a terrain file with my modifications (my preference).

Thanks.
#7
02/28/2005 (12:51 pm)
Well,

I finally went through the code and generated a function that does exactly what I want. You can find it at Torque Terrain Generator.