Playmaker Forum

PlayMaker Help & Tips => PlayMaker Tutorials => Topic started by: jellyam on October 08, 2017, 12:59:02 PM

Title: how to make a timer and a basic turn system
Post by: jellyam on October 08, 2017, 12:59:02 PM
hey guys, I've mostly been lurking here but I recently made some playmaker tutorials you guys might be interested in

simple turn system
https://www.youtube.com/watch?v=rzpDZsDdA_U (https://www.youtube.com/watch?v=rzpDZsDdA_U)

timer
https://www.youtube.com/watch?v=8Pt2JE5WGpA (https://www.youtube.com/watch?v=8Pt2JE5WGpA)
Title: Re: how to make a timer and a basic turn system
Post by: Thore on October 09, 2017, 05:47:50 AM
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.
Title: Re: how to make a timer and a basic turn system
Post by: jellyam on December 03, 2017, 08:46:33 PM
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

Title: Re: how to make a timer and a basic turn system
Post by: Thore on December 06, 2017, 06:35:47 PM
Glad it's useful. Go ahead, and use this as you see fit. :)