Gotta love scripts...
by Scott Coursey · 12/17/2006 (9:00 am) · 8 comments
I'm working on the AI components of my game right now. It's in the early phases, so there's plenty of work to be done. I've made a few false starts on it and decided to take a step back and model the AI's behavior so I could visualize it better.
Since I'm a Mac user, the most logical choice (for me) was to use OmniGraffle. I already had the tool and was familiar with it. So, off I went to design the thought process.
The diagram soon became quite large and the idea of turning it back into code was daunting, to say the least. I looked at the data file from Graffle and saw that it was XML. Cool.
So, after a while of putting some script together, I was able to translate this:

into skeletal TorqueScript. Very cool indeed. It not only writes the main if/then/else blocks, but includes the function stubs so I can fill those out later. Like I said, there's LOTS to do, but this is a great start.
Now, if I just change a part of the model, I can re-extract the code from it and have the TScript re-written.
Since I'm a Mac user, the most logical choice (for me) was to use OmniGraffle. I already had the tool and was familiar with it. So, off I went to design the thought process.
The diagram soon became quite large and the idea of turning it back into code was daunting, to say the least. I looked at the data file from Graffle and saw that it was XML. Cool.
So, after a while of putting some script together, I was able to translate this:

into skeletal TorqueScript. Very cool indeed. It not only writes the main if/then/else blocks, but includes the function stubs so I can fill those out later. Like I said, there's LOTS to do, but this is a great start.
Now, if I just change a part of the model, I can re-extract the code from it and have the TScript re-written.
About the author
#2
12/17/2006 (9:40 am)
That's pretty cool! Sounds like a fun path from design to implementation.
#3
Everything I have is extremely fast, so there's tons of features I can add. And, I have yet to move away from Torque Script. So far, everything runs with the stock TGB binaries with no problems at all.
12/17/2006 (9:47 am)
The AI will be turn-based strategy. I already have some group checking (assigning various units depending on distance from each other into groups) and plan on monitoring and remembering the players' actions and preferences.Everything I have is extremely fast, so there's tons of features I can add. And, I have yet to move away from Torque Script. So far, everything runs with the stock TGB binaries with no problems at all.
#4
12/17/2006 (10:14 am)
I love it when there turns out to be nice path between applications - and this sounds really cool!
#5
So far, the script (written in TCL) is 337 lines, and there's several more features I need to add.
12/17/2006 (11:57 am)
If anyone would like my script, I'd be more than happy to email it. It only works with OmniGraffle (Mac), so I don't know if anyone else would be interested in it.So far, the script (written in TCL) is 337 lines, and there's several more features I need to add.
#6
My email address is in my profile page.
12/17/2006 (10:39 pm)
Hey Scott, I'd love to check out your script.My email address is in my profile page.
#7
12/18/2006 (8:25 am)
ya know, i would really like to help you re skin your game =)
#8
12/18/2006 (8:53 am)
@Allyn: Which part are you referring to? Do you mean in-game (units, environment) or out-of-game (GUI elements)? I know my units and environment need some work, but most of the game meets my goals perfectly. The version I have in-house (newer than the previous demo) has some significant changes on the appearance of the in-game GUI elements.
Torque Owner Richard_H