Game Development Community

World Editor with Custon SceneObject / RenderDelegate

by Edward Rotberg · in Torque 3D Professional · 12/11/2009 (5:59 pm) · 4 replies

Hi,

I've got a custom SceneObject / RenderDelegate that is now nicely rending within Torque3D thanks to the HUGE help from this forum. That help was given on a very lengthy thread and I suspect that this one will be much shorter - at least I hope so.

The problem I'm having is this: I can move/rotate/scale my object after adding it in the World Editor just fine, and it moves around rotates, etc. just as it should. However when I save the level, and reload it, it just returns to an identity matrix position/orientation/scale.

I've modeled much of the structure, if not the content, of mycode after the RenderObjectExample, and with reference to this issue, I'm doing the following to be able to have the object move around/rotate etc. under World Editor control with the following code in my RenderDelegate snarfed directly from RenderObjectExample:

MatrixF objectToWorld = getRenderTransform();
objectToWorld.scale( getScale() );

As a test, I added a RenderObjectExample object to my level and moved it around, saved the level off and then ran the editor from the debugger. I put a breakpoint in the above portion of code in the RenderObjectExample's RenderDelegate, as well as in my own RenderDelegate at the same point. The RenderobjectExample gets a transform back that reflects what was saved. My object only ever gets an identity matrix back.

Does anyone have any ideas on this?

Thanks in advance,

= Ed =

#1
12/11/2009 (7:33 pm)
An 3D object in T3D generally exists twice : once on the server side, once on the client side.

Even if you run T3D in single player on a single not network connected computer, T3D will internally launch a T3D server and a T3D client that will connect to the T3D server.

Your object gets two transform methods : set/getTransform() and set/getRenderTransform().

To make it simply, Transform is for the server-side object (the simulation reference) and RenderTransform is for the rendered scene on the client (the server doesn't do any render).

Your object is created (from the mission file) on the server, and then transmitted to the client (aka 'ghosted').

The server must transmit the object properties to the client's ghost via packUpdate()/unpackUpdate methods.

That's how it works (I hope because that is what I understood).

And be aware that when you are in the editor, it is the only moment that you are visually working on the server side, not on the client side.

So, check the transform values of your object in your mission file (simple text file), and if these values are correct, there is a glitch somewhere in the transmission of these values from the server (via packUpdate) to the client (via unpackUpdate).

Hope this can help you.

Nicolas Buquet
www.buquet-net.com/cv/
#2
12/11/2009 (7:50 pm)
Thanks Nicolas,

Another misunderstanding on my part. I did not realize that the server client issue was still in effect for single player games. I think I can fix this quickly.

= Ed =
#3
12/12/2009 (7:22 am)
Yes Ed, the big problem of Torque products is the lack of clear and complete docs about its structure and the capabilities of its components.

Having access to source code is a very big plus, but doesn't compensate completely the weakness of the docs.

Better docs are coming, made by Michael Perry.

So, the second very big plus is these forums ! :-)

I cruse more than one hour every day reading posts here.

About the client-server architecture, I think the programmers are working on an update where client and server will be merged in single player application.

Here is a small tutorial (made by a great community member Orion Elenzil), quite complete in functionality, that covers basic ghosting :
www.torquepowered.com/community/resources/view/15072

Nicolas Buquet
www.buquet-net.com/cv/
#4
12/12/2009 (4:48 pm)
Thanks for the link Nicolas. I've bookmarked it and will review it when I get some spare cycles.

= Ed =