TrueState is a robust finite state machine to help you organize and control even the most complex of objects.  From something as simple as a door that can be open and closed, to the most complex action platforming hero, anything is possible with TrueState!

Features

  • 16 Scripts for creating, switching, and queuing states
  •  Single script to control both step and draw events
  •  Run specific code on the first and last step of a state
  •  Know how long you've been in a state
  •  Easily switch to the previous state
  •  State History (useful for debugging)
  •  Setup attack combos and special abilities easier than ever
  •  Pure GML implementation ensures compatibility on all platforms!
  • Included comprehensive manual and quick start guide!  (Download below for free)
  • Plus all the benefits of using a Finite State Machine in the first place, like more organized code and easier debugging

Demo Project Features

The demo includes two small projects: a simple top down action RPG and a complex action platformer.  A comprehensive manual, including a quickstart guide is also available to get you up and running as fast as possible.

Top Down Example
2 Characters, 1 gate, 1 chest.
11 different states
Art created by @GrogDev you are free to use in your own game!  

Action Platformer Example
1 Character, 15 states
States include: running, jumping, 3 hit ground combo, 3 hit air combo, wall slide and kick
Character art created by Rvos - https://rvros.itch.io/

Purchase

Buy Now$4.99 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $4.99 USD. You will get access to the following files:

TrueState Plus Beta Project Source 607 kB
TrueState 2.3 Project Source 761 kB
TrueState 2.0 Project Source 779 kB
TrueState 2.0 Scripts.yymp 13 kB

Download demo

Download
TrueState Manual 2.0.0.pdf 305 kB

Development log

Comments

Log in with itch.io to leave a comment.

Wonderful. I'm buying, it will be very useful for me. How much license can I use in commercial products?

(+1)

You are free to use it in any commercial project!  Only limitation is reselling the system to other developers as your own work, which I feel should go without saying :D

I bought this asset over at yoyo marketplace, the version there is still in 2.0.0 will we get an update there? do I need to buy the asset here on itch to get access to the update? is there a way to link my purchase to itch?

I bought this today and I missed a detail from the manual, so I contacted @Pixelated Pope via discord. He replied very fast, he was kind and helpful! As soon as he clarified a crucial detail to me I realized how powerful this tool is. 

Thank you @Pixelated Pope for this powerful tool!

It's good Pope. It's GOOD.

Hello, Your Spriteness.

Do you plan to write an alternative version for GMS 2.3 users to adress all the changes of the engine ?

That's the plan, but I don't know exactly when I'm going to get around to it.  Fortunately, the system still works really well in 2.3 as it is (I'm currently using it in a 2.3 project without any modifications)

The biggest thing I'm taking advantage of right now is that all of my state scripts for a single object are in a single script resource, which is super awesome.  So my resource tree doesn't get nearly as bloated as it would have before.  If I wasn't lazy, I could combine all of the truestate system scripts into a single script resource as well, but I've got them all in a folder that I never open, so it's not that big of a deal.

Good to hear.

I was afraid that some of them would become those unreadable "compatibility script" GMS generate when you import stuff being obsolete.

Thanks.

Mmmh.

Just looking for an advice.

Is it better to: 

a. keep one state script by script ressource.
b. make state as function and group them in one script ressources by character
?

I have one script resource per character with a function for each state in said script resource.
There is also another script resource with shared common state functions that all state code can access.

(+1)

Hey Pope, 

I just purchased the package and ran the demo. For the platformer, I noticed that you can move right but you can't move left. Also if you are against the wall you can't move at all... I haven't touched or manipulated any code so I thought I'd just pass this along. Cheers.

Oh, sorry for the late reply, I don't know how I missed this comment. 

I just downloaded the latest yyz and tried it out and both demos seem to be working fine.  If you are still experiencing issues, hit me up on discord and we'll take a look.

I am having this same issue. No manipulation either. This and the slope collisions don't work in the demo.

Are you on a mac?  This seems to be related to keyboard input on Macs for some reason, and as I don't have a mac, there is no way for me to debug it.  And slope collision was never a promised feature of TrueState.

Ah. Sorry about slope confusion. I just saw the red slope objects in the resources.

I am on a Mac. I also can't figure out what is going. 

read_controls looks solid, state_ap_player_stand and state_ap_player_run and ap_move_player as well.

The weird thing is it is only run left and standard jump left. But the character will turn and move left if the down arrow/jump dash is used.

(1 edit)

I love this state machine! I did find two issues once I deleted the Top Down scripts and objects on the platformer.

"ai_vars=[0,AiState.stand,1,no_direction];" had to changed to "ai_vars=[0,AI.idle,1,no_direction];"

"ai_var[0] = 0;" had to be changed to "ai_vars[0] = 0;" for the AI to load. The AI character also cant turn left.

When I enabled "draw_text(x,y,string(dpad_dir));" on the Draw event for the Player the correct numbers appear for the directions (180, 0, 270, etc), but after moving or jumping it sets to -1. If I press left and down before jumping the character turn left before jumping but the number displayed when standing is also -1. Is the number being displayed the face_direction? If so that might be the problem.

The character will also move left after jumping (but not face left) if the left and down button are both pressed.

So -1 is the value of "no_direction".  So any held direction should be between 0-360, and if there is no held direction, I use -1.  If there are issues related to hitting multiple keys on the keyboard, make sure it isn't a keyboard ghosting issue (which is extremely common).  Any time 3+ keys are hit at the same time, there's a good chance only 2 of them are actually registering.  

Big time follower, first time purchaser

I was going to fumble through making may spaceship dodge and shoot, but everywhere I looke, peeps talking about FSM and that you were the Pope in charge of such things. Looking forward to learning this and finding ways to make it work in other projects. Thanks, and also thanks for keeping the pricing low and assets great, it helps peeps like me that have pinched pennies in half.

Deleted 236 days ago

Hmm, that's unusual.  Are you using the standard state_switch() or are you trying to use the queue system?  To be honest, the queue system hasn't been super well tested (not many people use it) so there may be some bugs with it.  If you'd like to reach out to me on Discord, I'd be happy to help.

Ayy, I'm an idiot. I did not see there was a "draw_gui_end" truestate call that moved the stack forward.


System works great! Sorry for not cleaning this comment up :P

Additionally, and not to be a bother- is there a way to contact you for questions with using true state? I have some questions regarding changing states in response to colliding events and stuff

Absolutely!  You are always welcome to ask me questions on Discord (that's just the easiest for me).  I also recommend joining the GM discord server if you aren't already a member.  It's a great place to get help with just about anything GM related!
https://discord.gg/By6u9pC

(-3)

When it jumps and attacks it stays in the air?

(+2)

Yes?

(+2)

Downloaded and implemented in no time. Extremely well organized and very effective state system! I will be using for all my upcoming projects. Thanks so much Pixelated Pope!