4 ms·
Building a game is a probably the best way to learn and apply state machines since a lot of it is all about how to manage state effectively since there are so m
by mephitix 9y ago
Building a game is a probably the best way to learn and apply state machines since a lot of it is all about how to manage state effectively since there are so many pieces of state and interactions between them.
Also, since Bob is too humble to say it - http://gameprogrammingpatterns.com http://gameprogrammingpatterns.com is an amazing architecture resource for programmers in all disciplines, not just gamedevs.
He's got another book called http://craftinginterpreters.com/ http://craftinginterpreters.com/ that I've been eager to check out.
- turboladen 9y agoCrafting interpreters is great!
- munificent 9y ago\o/
- WillReplyfFood 9y agoBuilding a game also takes you straigth to the limits of state machines. They sprawl and get unwieldy pretty quick. The best thing about state machines - is that they thus basically force you to fall back and apply simple concepts.
- w0utert 9y agoGame programming is probably the best way to learn to program many, many kinds of things ;-) On the topic of state machines, I totally agree with the observation that games are a prime example of their usefulness. I've been working on and off on a relatively simple game that uses a Lua scripting backend to implement the game logic, and over time I've been refactoring this particular part many times, slowly converging to a solution resembling an event driven state machine implemented using reactive programming techniques. It's very interesting to see how even a very simple game already forces you to either apply concepts like state machines, events, etc, or end up with horrible crappy code that is hard to debug and not fun to work on.