symplehfsm - hierarchical finite state machine framework

Hi I have been working on symplehfsm and I would like to test it in the upcoming pyweek. As the rules states, release it well before the competition (at least 4 weeks), so other can familiarize with it. Here it is:

https://bitbucket.org/dr0id/symplehfsm

I hope it will make it easier to implement state machine driven logic. Any feedback is welcome.

(log in to comment)

Comments

This is great, you really sold me on state machines when we worked together on Pyweek 12. They make entities with complicated behaviors much more comprehensible. I'm interested in your framework, but you don't seem to have any documentation or API reference. For me a demo's really not enough to understand a framework, no matter how well it's coded. And I've already used state machines a couple of times. I imagine it's much worse for people who haven't.

Any chance you'll put together some documentation?
Well, on the pygame mailing list there was a similar request: http://groups.google.com/group/pygame-mirror-on-google-groups/t/f5a88bb3ba894b75

Documentation is present either as html files in the download section or as normal doc strings (I made sure, that all methods are documented). If you find that some methods are not described in a comprehensible manner, then I would appreciate any collaboration to improve the doc strings. I'm willing to write more/better introductory tutorial, but I'm not sure how since I won't go through all the theory of basic state machines (there are many sites on the internet that do that better than I would...). The frame work works roughly like this:
input (events) -> state machine -> actions (output)
The only odd thing you may notice is that all actions of all states are in the same action class instance (therefore use good names for the methods).
I hope that helps.
Ah cool, I didn't think to check the downloads section for the documentation. Any chance you could make it browsable online?

I've looked through most of the documentation now, and it seems really abstract. I could give specific suggestions for the documentation, but I think that what would really help the pygame community adopt this stuff is a link to a tutorial that explains these concepts specifically in terms of a game. Do you know of any good ones?
Sure, I made the docs available here (this was quite easy, didn't know that bitbucket had this option):
<br>
<br>
 <a href="http://dr0id.bitbucket.org/symplehfsm/">symplehfsm docs</a>
<br>
<br>
It is more work to maintain the docs online too, because now I have to keep them up to date in another repository too...). Also, I'm not entirely happy with the auto generated format of the docs. If you know better I would appreciate any help to get them in a better format (generating a make file for the sphinx project should be fairly easy). I'm open for any suggestions to improve the documentation.
<br>
<br>
About your question for a good tutorial explaining the usage of a state machine in a game context I don't know any. I think the mousefollower (uses <a href="http://www.pygame.org">pygame</a>) example is a very simple game entity model using a state machine (just two states). I could write yet another example, but I fear it would get probably too overwhelming. If you have a good idea for a tutorial for in game usage, let me know. You know how you can contact me (mail, irc, etc.).
<br>
<br>
hmm, comments do not accept html code as the original entry...  sorry
There is a link about HFSM in a game: http://www.gamasutra.com/view/feature/130279/creating_all_humans_a_datadriven_.php
new version 2.0.2.0 released: http://dr0id.bitbucket.org/symplehfsm/index.html