Word Editor Creator
by Dane McGreevy · in Torque Game Engine · 04/04/2006 (2:27 am) · 6 replies
Hi All,
I am wondering what sort of function or functions in the engine codes have been triggered when we try to click on the World Editor Creator tree to add a new pre-defined object, say a tree or a house. My idea would be to use an external application to add new objects in the run time without having to re-load the whole mission file and the editing mode would be invisible to clients.
Any idea about it? Thank you very much for any suggestion!
I am wondering what sort of function or functions in the engine codes have been triggered when we try to click on the World Editor Creator tree to add a new pre-defined object, say a tree or a house. My idea would be to use an external application to add new objects in the run time without having to re-load the whole mission file and the editing mode would be invisible to clients.
Any idea about it? Thank you very much for any suggestion!
#2
For Example:
04/05/2006 (8:16 am)
Not exactly sure what you're asking, but you can easily create new objects in script.For Example:
new StaticObject()
{
position = "0 0 0";
datablock = MyStaticShapeData;
};
#3
04/05/2006 (8:17 am)
I'm not totally sure what you mean. Do you mean that the external application would add objects while your game is still running, and then be locked out when you sold the game to a customer?
#4
At the current stage, I have already built up a udp socket to implement the communication between the external application and Torque. All code changes would ideally be within the engine. When the client side sends messages (they may contain the position, scale and DTS file name of the object) to Torque to add a tree, Torque would respond immediately to the inbound messages and add the right object onto the right position in the game. Does it clarify my question?
Any help would be greatly appreciated!
04/05/2006 (5:58 pm)
Thank you, Owen, for your codes. Yes, I can actually add object from in scripting. But my idea is to add objects while the game is still running. So, Andy, you are all right on this point.At the current stage, I have already built up a udp socket to implement the communication between the external application and Torque. All code changes would ideally be within the engine. When the client side sends messages (they may contain the position, scale and DTS file name of the object) to Torque to add a tree, Torque would respond immediately to the inbound messages and add the right object onto the right position in the game. Does it clarify my question?
Any help would be greatly appreciated!
#5
That should get you going in the right direction.
04/05/2006 (7:09 pm)
You can take a look at how the world editor adds objects by looking in the ./creator/editor/EditorGui.cs file. Around line 1460 you'll find this:function TSStatic::create(%shapeName)
{
%obj = new TSStatic()
{
shapeName = %shapeName;
};
return(%obj);
}That should get you going in the right direction.
#6
I notice that when we add new objects from the World Editor Creator tree, the TSStatic::onAdd() method is acually triggered and run. I ever tried re-writing this method but wasn't able to get it work. :(
Well, if I have to do it by scripting, what is the engine method to execute a cs file?
Thank you!
04/06/2006 (12:46 am)
Thank you so much for your direction, Brandon. Yes, I've already gone through the EditorGui.cs file and I have no difficulty adding new objects by means of typing commands into the console and loading a certain cs file where new objects have already been written in beforehand while loading the game. What I have been wondering is whether we may just leave alone the scripting, instead, get the engine codes do the adding as I need the user to directly point on the external application and torque will acquire and respond the event message passed over from the external application and perform some certain engine methods to add the object. Just wondering its possibility! I notice that when we add new objects from the World Editor Creator tree, the TSStatic::onAdd() method is acually triggered and run. I ever tried re-writing this method but wasn't able to get it work. :(
Well, if I have to do it by scripting, what is the engine method to execute a cs file?
Thank you!
Torque Owner Dane McGreevy