Game Development Community

How do I add c++ code into the engine?

by Carlos Morales · in Torque Game Engine · 11/18/2004 (2:35 pm) · 5 replies

I am working on the pathfinding AI for a FPS game. I developed this completely seperate from Torque and now I want to bring it into the engine. I have 3 files:

NavGraph.cc - Used for finding the shorest path between 2 points. Needs to be accessible by the scripting language and needs to be able to access the Point3F class.

NavGraph.h - Header file for NavGraph.cc. Needs to access the Point3F class.

PFNode.h - Class that contains the information for each navPoint in the graph. Does not need to be accessibly to the scripting language and does not need to access any engine classes.

I also use the Vector class (the array kind not physics kind) quite heavily, so I need to have access to that aswell.

So my question is what do I need to add to my code and where to do I insert my files so that I can compile them into the engine?

I know for NavGraph.cc, I need to do ConsoleMethod() for each function I want to be accessible by the scripting language. I also know I need to do DECLARE_CONOBJECT() and IMPLEMENT_CO_NETOBJECT_V1() somewhere in there, but not exactly sure where.

I having a lot of trouble and would appreciate help. Ive looked at the official docs, searched the forums, tried to copy what I have seen in the engine. Im just missing something. I can post/send some code if it will help.

About the author

Recent Threads

  • Is there sound?

  • #1
    11/18/2004 (3:15 pm)
    I guess I'm confused by your question. You would add your files to the torque sdk project like you would any other source file. To use the Point3F class you would include its header file.
    #2
    11/18/2004 (4:04 pm)
    Ill try to clarify. Basically I want to know what header files I need to add so that I can access some of the NavGraph functions from TorqueScript. And what other code I need to add like ConsoleMethod() to achieve this end? And in what directory do I place my files? Let me know if you need more clarification or code snippets would help.
    #3
    11/18/2004 (4:54 pm)
    The Torque documentation contains the answers to these questions. :) Specifically, check out:

    The console reference, and in that the section on creating scriptable objects in particular.

    In addition, there is an excellent detailed overview of TorqueScript, and in that an easy to understand section on interfacing with the engine in TorqueScript, including how to create new objects in C++ and expose them in script.
    #4
    11/19/2004 (6:02 pm)
    With the exception of the console reference, Ive seen all that before. Not sure how I missed it since it has a whole page dedicated to it, but that helped a lot. That was what I was looking for. Thanks.
    #5
    11/19/2004 (8:13 pm)
    No prob, glad you got what you needed. Please spread the word next time you see someone ask something similar. :)