I'm willing to develop a soccer game for Android.
Because the complexity of the AI, i really think i need to design it using a FSM (Finite State Machine) and not with a monster switch.
Googling around i found some FSM written in Java, but nothing explicitly compatible with Android: I wonder if there is someone here that used a FSM before for that platform.
I was looking for a FSM for Android a few months ago but couldn't find anything suitable, so had to create my own.
I used it in a few projects by now and quite happy. It makes code much cleaner and is easy to use. If anyone's still looking for a state machine for java, check EasyFlow out.
You can contribute to the project as well.
Android has an internal Hierarchical State Machine (HSM), which integrates with the Android message Queue.
It is internal, so you're not able to access it explicitly from the SDK.
However, if you follow the terms of the Apache 2.0 licence you can make your own version.
https://android.googlesource.com/platform/frameworks/base/+/gingerbread-release/core/java/com/android/internal/util/HierarchicalStateMachine.java
Edit:
This class is now called StateMachine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With