Playmaker Help & Tips > Playmaker Tutorials

how to make a timer and a basic turn system


hey guys, I've mostly been lurking here but I recently made some playmaker tutorials you guys might be interested in

simple turn system


Hi, good start with the tutorials. :)

The turn mechanic could be improved a little, and work without the every frame check. You can do this using global events, and send event.

Think of this as a chess clock which gives control to one player. The player does their thing, then hits the Clock to say "I'm done" and the Clock then "knows" what to do next. That is: give control to the next player. Using a Clock or Manager as a third party is a bit more robust, because then you can separate the taking turns rules from whatever is supposed to happen within a given turn. In a more complicated game, it can count up the int which stand for any number of players, for example. It can skip turns, or change the order etc. Thus, it's better to keep this mechanic separate in more advanced games.

If you really only have two players in a simpler game, you don't strictly need the Clock, because you then can start both players and let them run into an Idle / Awake state. One of the two continues to whatever they do in their turn, while the other is stuck in the Idle, going to Sleep. When the active player is done, it goes to it's Sleep state, but before it Send Event over to the other player to wake them up , to start chain of events. Now the other player's FSM runs becomes active player and does whatever it does, until done, go sleep but before Send Event over again to wake up the other player, and so on.

I built an example on the quick. Player Blue's job is to press the space bar, and Player Red's job is to press the tab, taking turns. You're correct that using Input Manager is always a good idea, but for debugging and testing I use the keys.

i can't believe it took me this long to see this post! I took a look at the unitypackage and I'm going to share with my youtube audience since its better than what i did in the tutorial. =) and thank you

Glad it's useful. Go ahead, and use this as you see fit. :)


[0] Message Index

Go to full version