playMaker

Author Topic: Organizing FSM's in the Editor  (Read 5046 times)

redikann

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Organizing FSM's in the Editor
« on: August 20, 2013, 01:29:22 PM »
Hello everyone 8). I wanted to post a tip I've have recently discovered and have not seen in a video or found from a search on this site.

It involves naming FSM's and organizing them in the dropdown at the top of the 'Playmaker Editor' window.
As you know it is a good practice to keep your State machines sweet and to the point. It helps keep  true to the 'Component' model Unity thrives on.
But what happens when a Game Object like a player gets really deep into State Machines. Organizing smartly will make your life easier.

Let's say you will have 3 jump interactions for the player.
Standing Jump
Walking Jump
Running Jump
And each action will have it's very own FSM to keep the code from getting complicated.
When you name your FSM (which you should be doing) try this :
Jump/Standing Jump
Jump/Walking Jump
you will now see in the editor FSM dropdown Playmaker has now nested these FSM's inside of Jump.

escpodgames

  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Assets
Re: Organizing FSM's in the Editor
« Reply #1 on: August 20, 2013, 01:41:24 PM »
It's very useful when working with big projects and it makes you stay mega clean. Also very handy for global variables as that list sure can get large fast!

I also use all caps for Global events and slap the variable, type of the end of variables eg.

Float = variable_f
String = variable_s
Vector3 = variable_v3
Color = variable_c
GameObject = variable_go
etc

This really helps if you want to convert a float to string variable you can have the same variable name just change the end, also helpful to go down the list of variables and check if you have set the correct types
« Last Edit: August 20, 2013, 01:52:13 PM by LampRabbit »

redikann

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: Organizing FSM's in the Editor
« Reply #2 on: August 20, 2013, 01:52:01 PM »
Absolutely. I am no coder but I've learned about variable naming conventions. Everyone can have their own style as long as it makes sense and you stick to it.
I have started using 'GetFSMVar' a lot and have started naming my reference variables like this '_varname' just so it stays true to the original var buts lets me know of my intentions.

escpodgames

  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Assets
Re: Organizing FSM's in the Editor
« Reply #3 on: August 20, 2013, 01:58:37 PM »
Ah! that is smart! I'm going to do this next game, i actually try to avoid sending variables around just so my artistic thinking brain doesn't get confused but I'm going to actually plan out my next game in small systems that are mega clean and thought out rather than creating it all as I go.

I've also started to use the comment action to split up actions within a state so its easy to see whys happening.

redikann

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: Organizing FSM's in the Editor
« Reply #4 on: August 20, 2013, 02:13:21 PM »
Just like you I am always thinking of new ways to use Playmaker to make me more efficient. 1 thing I will try to start doing is using Playmaker Editor as my design document / progress graph.  Think about it, you could map out your entire game with states and comments  and then update the comments as you complete things or they need improvement. Day by day it would be easier to keep track of yourself and it exist right inside of Unity.

escpodgames

  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Assets
Re: Organizing FSM's in the Editor
« Reply #5 on: August 20, 2013, 02:29:56 PM »
You mean like a task manager!? Whaahh that is going extreme, but not a bad idea. I tend to use the good old indie sheet of paper.

I guess it could be interesting to have an FSM that is like a mini map of all your fsms so you can see what your game is doing from an overview pov, even if very broad.

It's funny though ... one thing I REALLY want in playmaker is ...... more colors :P Stupid right :D being able to add custom colors from the color picker would be awesome! Atm I try to use the colors for different types of states (Setting something is blue, comparing is orange, error or end is red, user input is purple etc) but there just aren't enough colors :( :( :(

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3207
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Organizing FSM's in the Editor
« Reply #6 on: August 20, 2013, 03:17:39 PM »
These are really great tips!

Quote
you could map out your entire game with states and comments  and then update the comments as you complete things or they need improvement.

Using Playmaker as a living design document was an early design goal, and definitely something I want to make work really well.

I love the idea of an interactive design document that you can "play" at any stage in development. A playable design document that eventually becomes the game as you drill down and implement pieces of it.

Instead of spending months on a paper design doc, you literally start with an FSM: Main Menu -> Play Game -> You Win, each state just showing a fullscreen graphic. It sounds silly, but as you drill down into these states you design/make the game!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Organizing FSM's in the Editor
« Reply #7 on: August 20, 2013, 03:40:41 PM »
The design document/task manager idea gets all kinds of gears turning for me.. Really interesting.

I generally didn't like using the / in FSM naming, the less I have to click the better so I just abbreviate it with Control_Pitch or something so it all stays on the same page and if I want to pull variables from that FSM I just think of the first way I would have named it and it helps me keep the whole thing kind of loaded in my head so I don't have to check the names often or waste time hunting down info.

I've certainly changed a lot of the way I do things over the last year and I'm going to pursue the integrated design document idea for sure.

escpodgames

  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Assets
Re: Organizing FSM's in the Editor
« Reply #8 on: August 20, 2013, 03:58:12 PM »
Random design doc idea-
I was actually thinking of a 'task' action, much like my hacky comment with error it would show up as a second type of error (orange "!"). At the top of the action is a task title input field, then a tick for if it's completed and a comment section for notes. Until its ticked it would show up as a form of error but more of a reminder flag than an error. This way you could look down and see the remaining tasks. Also great if working in a team "hey bro! I just added a new task" OR great for designing - create a task for proposed functionality "AI - Attack player" "Inputs - swipe" "Add points"
« Last Edit: August 20, 2013, 04:25:53 PM by LampRabbit »

redikann

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: Organizing FSM's in the Editor
« Reply #9 on: August 20, 2013, 04:33:05 PM »
Wow.. nice to hear the gears are turning, and I like the Idea of it reminding you of task awaiting action, especially something that kicks off when opening the Editor would be neat.  I think this kind of interaction ( being kinda of brute force implemented with a state flow chart) or actually functionally built into Playmaker is a great idea and fits nicely into a Playmaker state of mind.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3207
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Organizing FSM's in the Editor
« Reply #10 on: August 20, 2013, 08:41:00 PM »
Yeah, the task idea is really nice. I like it!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Organizing FSM's in the Editor
« Reply #11 on: September 09, 2013, 11:01:30 PM »
Hi,

I would love a task system in Playmaker!

tintasmen

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Organizing FSM's in the Editor
« Reply #12 on: April 05, 2014, 03:12:21 AM »
Yes a task system would be great!

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • View Profile
    • My Blog
Re: Organizing FSM's in the Editor
« Reply #13 on: April 11, 2014, 02:38:10 PM »
Thanks so much for the tip on organizing 'sub-fsms' that arent actually subfsm.

Was this tip documented somewhere? I feel like I've been using PlayMaker long enough to know it all, and then you tell me this tip!  :o