Game Development Community

Adding C code to TGB

by John Lewis · in Torque Game Builder · 08/03/2007 (10:36 pm) · 3 replies

If I wanted to add C code to TGB that made sounds, how would I go about doing that? I want to have the C code read aloud a written script, so it would generate (I guess) wav files that would get played a specific times. I want the script to be dynamic, so I need to code to create the sound files on demand.

Any help appreciated.
John

#1
08/04/2007 (8:45 am)
1. You will have to have the pro edition (so that you have access to the C++ source).
2. You will have to hook the required library that you are using into Torque. Do not use GPL'd projects.
3. You will then have to expose it to the scripting engine, as it will make your testing/debugging life much easier.
4. Test. Test. Test.
#2
08/04/2007 (4:24 pm)
Granted I might be off, but I'd like to add my $0.02 onto the above advice...
If you don't know C++ already, pick up a book and at least skim through the lessons. Torque is written in and based on C++, not C.
Since C and C++ are very similar, you should have much trouble picking up on how things work. That said, from everything I've read and many people I've spoken to, I get the impression that someone who starts by knowing C, then tries to program in C++, is then going to need to unlearn a lot of habits formed by C.

Now, if you meant to say C++ code from the get go in your original post, then ignore the crazy fox in the corner and have fun!
#3
08/06/2007 (1:47 pm)
Poop! I was hoping to have some level of interactivity that I obviously wont be able to have. Looks like canned scripts.