February 21st, 2003. 7:30pm.
By: V2C, aka Seed
Email me at firstname.lastname@example.org
Tactics Core was written entirely in Flash 6 Actionscript 1.0. To learn Actionscript, Flashkit is a great resource, and there are many experts in their Forums who answer questions very quickly.
Since Tactics Core is an engine meant for developing games, I wrote it to load almost everything dynamically using object oriented programming methods. Because of this, in the Demo game I had a huge library of movie clips, and a lot of them were linked for Actionscript, and set to export in the first frame. It takes a long time to load everything before even the first frame can be displayed, that's why a separate loading swf is used.
The grid is set with a two-dimensional array which determines whether each space is empty, occupied, blocked, a hole.. etc. This makes it VERY easy to program different stages within minutes! (Excluding the time to make the graphics =P )
Objects are loaded from the library using attachMovie(...), and unloaded using unloadMovie(...) after they are done (like battle effects). I found this to be the most efficient method.
Page 6/7 [Prev] [Next]
Maintaining the depth layering as objects move around and overlap each other is easily achieved with the swapDepths(...) function. Just assign each grid space it's own depth, and whenever an object moves onto that space, use swapDepths(...) to move that object front/back to the space's assigned depth level. I used a simple algorithm based on the Row and Column in the grid to assign depths. Just remember that you can't have more than one object occupying the same depth level! (The offset in my code below allows me to have two objects in one space.)
The A.I. is built using a recursive function that calculates every possible action a unit can take during its turn, and picks the one that is immediately most beneficial. This A.I. algorithm is general to all units; no matter what kind of stats you give to any unit it will function accordingly ^_^v
HOWEVER, this A.I. only thinks for the immediate turn. As a result you may notice that there isn't much teamwork. If I add in multiple levels of recursion to think ahead a few turns, then the computer will learn to work as a team. Currently that kind of algorithm is too slow to run in Flash, so I decided against it ^^"