I was planning on part 6 adding to the pet game having them loop back to the individual pet in determining the interest, and part 7 adding inventory items, a plot, and otherwise finishing off the dungeon explorer.
Then I realized --- it doesn't add anything new to the series. They are just new machines that replicate the behaviors already taught.
What Have We Learned
We learned that state machines are the "least powerful" of the automata in Computer Science. We also learned that they can do incredible things for games.
We can use state machines to run different code based on state.
We can use state machines to represent arbitrary meshes. These meshes can include things like maps and connectivity grids.
We don't need to hard code state machines. In fact, when you load them from data you can get substantially more power from them. Designers and artists and modelers and animators and producers can all modify the game without touching the code.
We can build complex systems, such as AI behavioral trees, out of a nested tree of very simple state machines.
How Can I Apply This
Most games apply these concepts all over the place.
One of the most common jobs in the industry is "Gameplay Engineer", or GPE. All they do is create the exact types of items we have made in this series of tutorials.
For example, in Littlest PetShop I spent months adding new behaviors and actions. They ranged from 'in the world' behaviors like I implemented in part 5, to minigames such as hide and seek where pets would run behind bushes to hide, then run up to the camera and celebrate with the player when they were found.
In The Sims every one of the tens of thousands of objects in the game required scripting. You need a pile of clothes, then you need some of these scripts: Behaviors and interactions to create the piles of clothes; interactions to drop the piles of clothes and pick them up again; interactions for a washing machine; interactions for a dryer; interactions for the maid to come clean up; and on and on and on.
Or if you are into faced paced games, you need behaviors and actions for your main characters to know to attack or run away, or decide if they should attack towers or players or minions. You need to create objects to pick up, weapons, inventories, and more. All of these behave the same way that we implemented in parts 3-5.
These little activities and behaviors grow into complex ecosystems powering most games.
I still want to add those abilities to the code, and my kids want to help me expand on the pet simulation. So I'm sure I'll be adding to this article with an addendum or two. But for now, it has been a good week. I got to spend about 6 hours writing two proof-of-concepts games, and I got to write a bunch of journal entries, and finally I was invited to turn these into an article.
So expect more on this to come. But for now, if you want more you'll need to use your own creativity and post what you did with the knowledge you have gained.
Thanks for reading.