Game Development Community

C++ Examples

by Chris Eisnaugle · in Torque Game Engine · 03/25/2004 (8:41 am) · 9 replies

I've been looking over Torque and the engine seems to provide a lot of the features I need for an upcoming project. We were looking at Irrlicht and Ogre, but Ogre is a beast to deal with and Irrlicht is far to immature.

Are there any tutorials, example applications using C++ with Torque? All the examples I see in the download seemed to be script files and no real C++ based examples.

Im looking for information like, how to Initialize the engine, how to get a video Mode list, how to initialize and setup the screengraph and anything else assocaited with developing with Torque and C++.

Any help would be greatly appreciated.

Thanks,

Chris Eisnaugle

About the author

Recent Threads

  • Compiling 1.1.2

  • #1
    03/25/2004 (8:56 am)
    Sure. It come with an entire example game. Link in the source under the game/ directory
    #2
    03/25/2004 (9:04 am)
    Thanks for that information, will take a look at it.

    Is there anything simpler though such as a framework or template with just the basics for startup, etc., and not all the extraneous application specific code?

    Thanks again,

    Chris Eisnaugle
    #3
    03/25/2004 (9:11 am)
    In short, Torque is not considered an API. At least not externally. As such it typically isn't used in the traditional API sense like you speak. Can it? yes, but it will be a bumpy road because there isn't really any setup for that.

    Essentially what you want to do is re-invent the wheel that is TorqueDemo. There is nothing stopping you, and the code is pretty well documented, but it just isn't the way its traditionaly done. Typically you write your game by small code changes to TorqueDemo here and there where you need them, and by game specific code done in scripts.

    I know this seems odd at first. It was to me. I came into Torque with the same general conception as yourself, and at first was damn upset to realize how it worked. I felt all I was really doign was "modding" the example game.

    Then as I learned more and more about the scripting side, as well as the code side, I started to realize that it wasn't like it looks.
    #4
    03/25/2004 (9:24 am)
    I always worry when I get into situations where it feels as you said like im modding the engine.

    The project my company is about to begin developing is a new take on the MMO genre with what we call pocket adventures. People have a central gathering place in towns, or other areas in a semi large world and from there can hook up and get a quest, adventure, raid, etc from NPC's. These basically are completely self contained adventures, raids, etc that are rich and complex in effect mini words where you have predefined tasks, quests to complete (Think of old AD&D modules, playing them out).

    Im worry about a purely scripting solution since it is inherently slower and most systems cannot handle that level of data and complexity. (I may be showing my ignorance of Torque here as I dont completely understand it yet).

    So that is the current situation I am assessing.

    Chris Eisnaugle
    #5
    03/25/2004 (9:31 am)
    Well like I said its a combination of scripting and code.

    Basicly you use the TorqueDemo as a base and build on it. It is extremely simple to do without going all the way back to the ground floor. You would end up duplicating probably more than 50% of whats already there.

    Take some time to get familiar with how the engine works, scripting and C++ side -- but start from the Script side because you will find it easier to get a grasp on how the engine works.

    Once you've started to get a feel for how it all works, you will see how it is easy to expand and do what you need. For example, you can easily write some C++ routines for what you need, then access them via script.
    #6
    03/25/2004 (9:42 am)
    The script does get compiled, so it's not as bad as you think. And if it's still a problem, you can still write it in C++. Simplest way is to add new script methods. Check this link:

    http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5103

    I've done that with a Checkers game I wrote. I just added a single script method called "StartCheckersGame". From then on, the entire game runs in C++.
    #7
    03/25/2004 (10:10 am)
    Yeah - I second all that has been said. Start with the scripting part. Soon you will understand how everything works, and then you start expanding the engine sources

    Its a time saver, and performance is quite good. Remember Tribes2 was made with this engine (in an older form) in mostly script, and that is still considered excellent in terms of network performance - even by todays standards.
    #8
    03/25/2004 (10:24 am)
    In a nutshell i'd say that the best way to use Torque to build a game is to use TorqueDemo as a core upon which you build the game. Use the existing framework to call all your little pieces of game specific code without having to worry about much of the low level.

    Glen is the source to your checkers game available by chance? Seems like it would be an excellent reference.
    #9
    03/25/2004 (11:03 am)
    John - I've thought about it, and I might do that eventually. Currently it's tied up with a bunch of other stuff. Largely my custom GUI control for displaying the board (which was written with future games in mind, and so is much more complicated then you need for Checkers), plus my own connection code for the network stuff. Right now it's probably more confusing then useful ... but I'll see about tidying/simplifying it a bit.