Loader image
Loader image
Back to Top

Dave's Dev: Using PlayMaker

In this blog I am going to write about the Unity plugin PlayMaker, how we have been using it in FTK and recommend some best practices. I will write at an introductory indie developer/designer level. If you are a seasoned programmer you might find some useful information about PlayMaker here. This is not meant to be an tutorial on PlayMaker. Rather it is more about how to use it more effectively. I haven’t looked into other graphical programming plugins for Unity so I can’t give any comparison.
So you have decided to use PlayMaker to make the next Minecraft. You learned all the tutorials, and perhaps wrote some small games. But your idea is a bigger, more complex game. Are you ready?
If you are new to programming chance are you are using PlayMaker to bypass coding in C# or Javascript. That is perfectly fine, coding is hard to learn and easy to make mistakes. But let me give you a few tips so that you can get the most out of PlayMaker. Don’t forget uncle Dave when the money is raking in with you next iPhone chart topper, ok? 🙂
PlayMaker is based a computer science concept called Finite State Machines (FSM). If you are unfamiliar with what State Machines are, I highly recommend reading about it. It is just a high level way of thinking about your programming problem. It’s not rocket science, and it will greatly increase productivity of your indie effort. I will give a very short rundown in a bit. If you are new to programming, you are probably using PlayMaker as an alternative to actually writing code scripts. That is you are designing Flowcharts. A Flowcharts is a sequence of instruction and decision represented graphically. Please note FSM and Flowcharts are two very distinct ways to use PlayMaker: one is to represent State Machines, one is to represent low-level programming flow as Flowcharts. It is when representing FSM that PlayMaker excels and you will get the biggest bang for your buck. And although representing Flowcharts is possible and sometime a necessity, please do so with caution. I will go through the reasons in the rest of this blog series.
State Machine vs Flowcharts
Flowchart is what ordinary C# or Javascript represents. It is a flow of instructions, with branching and repeat loops (the “if else” and “for loop”). Here’s a representation of control flow in PlayMaker:
ftk_pm1
Finite State Machine represents “states” of various objects in your game and the various “events” which triggers transition from one state to another. Your game object can be in any one of the number of states your FSM defines. Here’s an example of FSM in PlayMaker:
ftk_pm2
Can you see the differences? The Control Flow represent a sequence of instructions to perform, whereas the State Machines represent a set of States the “Player” object can be in, and how you can move from between states via events.
In order to make the most of PlayMaker, it is very important to know which of these mode you are using it in. In future blogs I will talk about using PlayMaker in these two modes in more detail.