Do you use state machines? Here a tutorial that shows how to use them in your games plus a git repo.

Discussion in 'Game Development (Technical)' started by MaxMarco, Aug 2, 2016.

  1. MaxMarco

    MaxMarco New Member

    Joined:
    Jul 19, 2016
    Messages:
    4
    Likes Received:
    3
    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.
     
    Scoper likes this.
  2. Scoper

    Indie Author

    Joined:
    Nov 5, 2015
    Messages:
    91
    Likes Received:
    21
    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.
     
  3. idurvesh

    idurvesh New Member

    Joined:
    Mar 26, 2016
    Messages:
    106
    Likes Received:
    19
    any tutorials over neural,utility or fuzzy logic which you will recommend?
     
  4. Scoper

    Indie Author

    Joined:
    Nov 5, 2015
    Messages:
    91
    Likes Received:
    21
    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.
     
    idurvesh likes this.
  5. idurvesh

    idurvesh New Member

    Joined:
    Mar 26, 2016
    Messages:
    106
    Likes Received:
    19
    I will go through them....Thanks for recommendation...
     
  6. MaxMarco

    MaxMarco New Member

    Joined:
    Jul 19, 2016
    Messages:
    4
    Likes Received:
    3
    On the stanford website you can find some cool courses about this topic.
     
    idurvesh likes this.
  7. idurvesh

    idurvesh New Member

    Joined:
    Mar 26, 2016
    Messages:
    106
    Likes Received:
    19
  8. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    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.
     
    idurvesh likes this.
  9. idurvesh

    idurvesh New Member

    Joined:
    Mar 26, 2016
    Messages:
    106
    Likes Received:
    19
    WOw amazing
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer