Hello guys, I wanted to share with you what I know about state machines, how to write them in C# and how they are helpful to develop games. Do you use them in your games? if no, you better start now. Let me know if the article was helpful. Inside you can find also a git repo with a simple state machine ready to use. Thanks Here the full guide.
A good introduction to state machines. Yes, I have used them frequently. It is a very useful design pattern in game development. Not just for AI behaviour. It is also useful for game logic and user interfaces and character controls. The basic enum state machine that you describe I have found to be particularly useful for defining the behaviour of many small components. When it comes to AI decision making, you mention behaviour trees as the alternative. There are many other alternatives too, eg. decision trees, fuzzy logic, utility theory, neural networks and algorithms for very specific purposes.
Neural Networks are very complicated. You will probably need a university course on the topic in order to fully understand and use them effectively. The best explanation of fuzzy logic and a fuzzy controller is the one on Wikipedia. The biggest advantage of fuzzy logic is that it allows a non-technical designer to write a series of statements that are very easy to understand and work with. Such as: "when distance_to_corner is far and speed is low then acceleration is high". Utility theory, in spite of its simplicity and usefulness, is not so well documented. But I found a good explanation here In its most simple form, you just assign a value to each possible choice from 0 to 1 based on whatever factors seem appropriate and the AI chooses the option with the highest value.
Looks superuseful as well,Here are few links , http://www-cs-students.stanford.edu/~amitp/gameprog.html http://theory.stanford.edu/~amitp/GameProgramming/AITechniques.html http://news.stanford.edu/pr/2005/pr-games-071305.html Thanks for sharing in
You only mention them briefly at the end of your article, but i think behavior trees are also very powerful (and used in several high end games). A great article on behavior trees is written by Chris Simpson (of Zomboid fame) at Gamasutra. Make sure you also read the comments, especially the part about parallel sequence nodes.