Looks last Friday I posted the material for my Silvergames site on this site, oh well, what the heck.  Blogs aren’t perfect. 

Let’s get back programming a finite state machine example.  As we saw with the Small Basic and the use of “autonomous” resolution, the game is not only boring but it really didn’t help us to see how a Finite Machine would work, it did give us some insight into programming a finite game.  In the case of the finite machine that we built, it used random numbers and if statement.  To many of the CS professors and careful programmers this seems like a bad way to go.  I don’t care, if it gets the job done, fine, and if do my documentation so much the better.  As an engineer, game programmer and other real life people using code, elegance is nice, but meeting business goals is the most important priority.

Let’s revisit our finite state machine and simplify a little, when I complete it, I will have a few visio videos for you to take a look at, but for now let’s use Excel, we don’t define the appearance of health, power, level, or the items (which might be a diamond, special sword, and special shoes for example).

Item Health Power Level Item1 Item2 Item3
Avatar 10 10 1 0 0 0
Weak Opponent 1 2 0 0 0 1
Strong Opponent 5 5 0 1 1 1
Environment 0 10 0 3 3 3

Now for the exploration of the environment, the Avatar would move, think of this as a board game, and then within the point of view, which could be 1 or 2 units, in this case we are picking 1 unit in any direction. You set-up the game so that the Avatar would begin to move toward the items.  In each move the environment would randomly select if there is a monster in the square that the Avatar is moving to and the type of monster.  The Avatar would not be able to see the monster.  Once the monster is met, the Avatar (in our design, not normally) has to do battle.  The avatar then engages in a battle determined by a battle table.  See a pattern forming here: random number generates the battle, location of items in environments and then finally the assessment.  After the battle, the Avatar will gain or lose health/power, the level will increase if the Avatar gets an item that has been defined in the rules. 

To begin your code, you will need to create your characters, battle table, environmental table and resolution system.  Seems like we are spending a lot of time in design, and that is correct, design and thinking is more important than coding.

`