Game Development Community

Creating SimObjects via C

by Jason Swearingen · in Torque Game Builder · 07/08/2005 (3:17 pm) · 2 replies

I am looking at how TorqueScript creates objects such as ActionMaps and Datablocks.

What is the best (or most supported) way of creating these via C++?

I know for regular simObjects, you can do what main.cc does, ex:
ActionMap* globalMap = new ActionMap;
   globalMap->registerObject("GlobalActionMap");

But I'm not sure if you can do something that nice for DataBlocks, and maybe the code snippet isnt the best way ???

Hence my question.. if you happen to know a good/best way of declaring objects via C++, please post!

Thanks much

-Jason

#1
07/09/2005 (12:44 am)
@Jason: The method you describe is correct for all objects to at least get them into the simulation although you don't need to name then as per your example in which case you omit the string in the registerObject call. Also, you should always call "unregisterObject()" when finished with the object.

If you look at "registerObject()" as well as "unregisterObject()" you can see the actual processes involved as these two calls are really just helpers and therefore consist of a set of more important calls.

- Melv.
#2
07/09/2005 (1:12 am)
Thanks Melv. I would have missed the unregisterObject call!

This engine is one piece of work, I am impressed at how spiffy it is.. and to think i was considering writing my own engine from scratch!