TGB/Tutorials/Fill Battle

From TDN

This page is a Work In Progress by William Lee Sims, dated 14 February 2011.

Contents

Bill & Pat's Excellent A.I. Adventure

About a year ago, Patrick was building a clone of Flood It!. After working through that, he described his idea of turning that into a two player game. We worked through TorqueScript, C++, and an A.I. algorithm. I documented the process and now we're cleaning it up and presenting it here!

Overview

GOAL: Prototype an existing game in TorqueScript. Expand that prototype into a board game with a trivial opponent. Expand that prototype to create a “smart” A.I. player in C++.

ASSUMPTIONS: I’m using Windows 7, TGB 1.7.5, and VisualStudio 2008. I personally use Torsion, but it is not a requirement for this tutorial. If you have questions about other products, feel free to ask them in the Forums.

TIP: If you've never scripted in TorqueScript or have never written C++ code, I highly recommend that you type in the code samples. You'll see patterns that you won't get by simply copying and pasting.

NEED HELP?: Head over to the TGB forums to ask.

Tutorial Steps

Create The Clone

Setting Up The Game Build your initial scene.
Adding Controls Create simple buttons and watch them work.
Creating The Game Finish out with the game logic to complete the clone.

Create The Board Game

The Engine That Could Setting Up Visual Studio 2008.
The Emperor's New Clothes Creating a C++ class that can be used in TorqueScript.
It's Alive Expanding the C++ class to represent our board game and A.I.
Un-Common Code Cleaning up the C++ class a little bit.
If It Beats Me One More Time... Play against the A.I.
Early Optimization is the Root of All Evil Optimizing the C++ for a better A.I. player.

Additional Topics (Coming Very Soon!)

Smart A.I. Through Better Rules We learn to fill territory that is surrounded by a single player.
The World Is What We Make Of It Learn how to create a fair board.
You, Smarter Learn how to win 60% of the time.
Weave the Thread Build an A.I. that doesn't halt the game while it thinks.