11 votes

Game Programming Patterns - State

3 comments

  1. parsley
    Link
    I have used FSM for a couple of use cases (not game development) and my biggest issue with them is that they (like most GoF patterns) take a lot of code to express so they are very easy to mess up...

    I have used FSM for a couple of use cases (not game development) and my biggest issue with them is that they (like most GoF patterns) take a lot of code to express so they are very easy to mess up and need external documentation to be easily seen and reasoned about. They are also very hairy to modify (like adding a box in the diagram, or shuffling some arrows around), especially since one can very easily end up with dozens of states and transitions.

    It is a pity because I think it is a very versatile pattern and it is very easy to wrap your head around (in diagram form). It really needs first class language / framework support.

    2 votes
  2. JesusShuttlesworth
    Link
    State machines are a very cool concept and relevant for both game development and agentic A.I.!

    State machines are a very cool concept and relevant for both game development and agentic A.I.!

    1 vote
  3. JRandomHacker
    Link
    Nystrom's books (both Game Programming Patterns and Crafting Interpreters) are fantastic. "State" is probably one of the more widely-applicable patterns outside of gamedev, but if you're coming...

    Nystrom's books (both Game Programming Patterns and Crafting Interpreters) are fantastic.

    "State" is probably one of the more widely-applicable patterns outside of gamedev, but if you're coming from completely outside the world of gamedev, I recommend checking out "Component" and "Data Locality"

    1 vote