Upcoming 2.3 Changes


Hey Gamemakers,

With the release of 2.3, pretty much every asset creator in the world is scrambling to get their packages up to snuff.  I've began to retool TrueState.   While the current version works perfectly well in 2.3, there are some cool things we can do with the new GML features.  The most simple change is to group all those truestate functions and helper functions into a single script resource.  

An additional change I'm considering is actually providing two versions of TrueState.  TrueState and TrueState+.  These would still be grouped together, so if you already own TrueState, TrueState+ would just be an optional, more advanced package you could use instead.

So what would TrueState+ do for you?  TrueState+ would use structs to enable the ability to have multiple states on a single object.  "Why on Earth would I want that?"  Good question, and I'm sure there are many valid answers.  For me, the most obvious answer is AI.  Even in my own projects I end up hard coding "TrueState" into my TrueState objects specifically to handle AI.  With TrueState+ this shouldn't be a problem.  I still am in the "design and test" phase of TrueState+, but I'm hoping it's not "too" far in the future.

After that is ready for release, I'd like to create a "Getting Started with TrueState" video to supplement the -admittedly pretty poor- documentation.  It would cover setting up your first stated object, suggest parenting scheme, and of course how to take advantage of TrueState+'s parallel states.

I don't have a solid timeline for these changes, but they are on the horizon.  If you have any feature suggestions, now would be a good time, and the comments below would be a good place!

Thanks for reading!

Get TrueState - Finite State Machine for GMS2

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

The current version causes some issues in 2.3, at least for me. The HTML5 build crashes when it reaches "script_get_name" and later when the state script is getting called.

TrueState+ sounds like a great idea!

Thanks for the hard work you put into this, it is a great asset!

Good catch!  Seems like there are some issues with getting function names and even references in 2.3 HTML5 right now.  I've got confirmation that these are "known issues" and that a fix is coming both for script_get_name and... well, referencing global functions, which would be the next issue you ran into if your replaced script_get_name in treustate_create_state() with an empty string or whatever to bypass the error.

Oh that's great news! Until then, is there a work around? I played around a little but I couldn't figure it out. I'd really love to get a web build out for my game next week because I am joining a bundle. If not I'll just offer the downloadable version only until the patch lands.

So, if you define your state scripts in the object itself rather than in a global state, it will work.  If you are feeling crazy you could even write the state script right there were you create the state.  Like this:
truestate_state_create(STATE_STAND, function(_event) {
   switch(_event){
   case TRUESTATE_NEW: break;
   case TRUESTATE_STEP: break;
   case TRUESTATE_DRAW: break;
  }
}

etc.  But all that really matters is that the function you reference isn't a "global" function.

Oh sweet thank you very much!