playMaker

Author Topic: PlayMaker: Conditions use [Solved]  (Read 17519 times)

Sly

  • Full Member
  • ***
  • Posts: 123
PlayMaker: Conditions use [Solved]
« on: August 22, 2011, 11:52:49 AM »
Hello,

I am new to playmaker. I allready used workflow system in other engines. This one seems to be cool.
But I despairingly want to find/understand if there is a condition system. Because maybe I'm wrong but I didn't find anything for this.

I give you an example about what I try to do:

I used a variable name 'myvariableA' and this variable is used for scale a character. I add +1 to this variable every 1 sec. So every second my character is bigger. That's ok, it's work. But I want when my variable "myvariableA" will be equal to 10 to stop scall my variable.
I don't understant how to do this using playmaker, because I don't find any conditions way.

Is it possible? Is someone can help me, not to do my work, but to explain me what way to use.

Thanks
« Last Edit: August 25, 2011, 01:53:05 PM by Sly »

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #1 on: August 22, 2011, 12:26:42 PM »
Well under Logic there are tests you can do on variables?

If that is what you mean.. Like Float Compare..

If it does not do exactly what you mean then you can write a custom Action easily to suit a need if it is something that you need over and over.

Q

Sly

  • Full Member
  • ***
  • Posts: 123
Re: PlayMaker: Conditions use
« Reply #2 on: August 22, 2011, 01:04:11 PM »
Yea it can be like to compare float. If A < 10 do the scall actionm or if A >=10 do an other action.

I don't understand how to do that, and I hope it's possible because it exist in a lot's of workflow basic system.
Basicely, I want to do like on this picture

And yea, I can't work without conditions. I hope I'm clear in my explications.

Thanks man

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #3 on: August 22, 2011, 01:19:55 PM »
Ok so if you use Float Compare then you put in an event for = or > and do your increment loop in that same state.. Then have another state with a global event attached.. the same one you put in for => that it goes to for the => event you set up. And in that state it could do nothing or wait for some other event to leave.. It could also monitor it to see if it goes below 10 or slowly shrink it to 0 or something..

Very easy.

If you still dont get it i could do a pic of some kind.

Q

Sly

  • Full Member
  • ***
  • Posts: 123
Re: PlayMaker: Conditions use
« Reply #4 on: August 22, 2011, 01:55:10 PM »
Yo,

Ok i will check with the Float Compare. I already take a look at the event, and it's a little weird for me for now, because I always use conditions directly on the arrow (like on picture) in others engine.

And for sure if you have time to make a pic It can be cool :)
Thanks a lot for your help and quick answer!

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #5 on: August 22, 2011, 02:14:18 PM »
Here is a quick pic.. I assume this is what you want?
Q

Sly

  • Full Member
  • ***
  • Posts: 123
Re: PlayMaker: Conditions use
« Reply #6 on: August 22, 2011, 03:22:45 PM »
Wow! That was not what I am thinking about, because I have not the reflexe yet to use event. I was thinking to have multiple arrows with different way.
But it seems to be a good way, I understand better. So I will test this like that when back home.

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #7 on: August 22, 2011, 04:25:16 PM »
well that is like 1 of 10 different ways you can do it or similar....

To be honest i dont use the arrow wires much just global events and global transitions...

They are the same as far as i know. You still need to have a transition and an event to leave a state so why not just use a global transition and call the event that way... Its just how i do it

Q

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PlayMaker: Conditions use
« Reply #8 on: August 23, 2011, 02:24:36 AM »
Hi,

 Well, I'd like to comment on this actually :)


 I think using wires is something very important in some cases. For example if you implement an If statement. You create a YES and NO event and plug that as transition for your state, and from there you progress through your fsm.

 the benefit of this for me is that I reuse the YES and NO event within my fsm, and keep the verbose within the state title. So I end up with a clear flow of what this fsm is achieving. If you only rely on global events, then it can become almost impossible to understand how that all works in 6 month time because everything is loose.

On complex project, for a given state you might request the system to perform differently. The problem with using only global events is that you loose that "state": how would you know that a particular global event needs to be active or inactive: you end up checking for this on each and every global events. if you use wiring, you can safely define several different behavior for the same system by simply triggering a top most global event that itself define the state of the system.


Another good reason to wire things up is during playback and debug, you can follow the flow. If you only use global events,it is impossible to know from where it just came out.

 I have attached a screenshot of an fsm that shows how wires can help building complex behavior with only generic events like YES NO DONE, etc. This prevents ending up with hundreds of global events with no real added benefit cause each would serve a too narrow purpose. When I reach the end of this flow ( "carry on trip in" or "robot top grippers needs to come in" ) that's when I trigger global events. And I also use a global event to actually start the routine "ENGAGE ROBOT PIPE".

This flow is one of several dozens other similar processes defined in that system. During testing and approval. I have to react fast to questions like: how does it actually performs in a particular situation: If it's wired, I can simply look and most of the time don't even need to run the thing, cause there are visual evidences.

So yes. Global events are nice and convenient, but they should carry on a clear message meant to be global. In you particular case, this is perfect, but you should be careful not to extrapolate and only rely on such technic for bigger fsm and more complex behavior.

I do use global events a lot, but when I need to shout to the system really :) I have attached an fsm acting as a repository of events. This repository is used for a referencing, so that if I want to implement a listener for a certain type of event, I know where they are all described ( and I don't have to search the actual fsm that triggers it). Note that this fsm do not fire itself these events, it's only a "listener". For example this can be the root for updating the user interface, logging things in a file or triggering sound effects etc etc.

What do you think?

 
Bye,

 Jean
« Last Edit: August 23, 2011, 02:37:52 AM by jeanfabre »

Sly

  • Full Member
  • ***
  • Posts: 123
Re: PlayMaker: Conditions use
« Reply #9 on: August 23, 2011, 08:02:50 AM »
Hello Jean,

I really prefer the first example with arrows and YES/NO. It's more "read-able" for me.

What does your event YES and NO? It's probably just a basic event name with this, but what do you put into this transitions? Because for now I don't understand how it's possible to pass to a transition to an other in the same state. How it can pass to the second transition without use the first transition arrow?

For the second choice, yea it's possible, but you need to be f**** organize (and more if you work in a team with other people).

Anyway, that's why I search for arrows with conditions on it  :D

Thanks for your helps and your point of view

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #10 on: August 23, 2011, 10:35:06 AM »
Yes Jean you are correct,,, ;D

I  can totally see how using the arrows is way easier to follow.. In my current project i dont really have a lot of decision making in one FSM so i have adopted this style. Although a have a couple that are bigger and have more then just a few states in them so i have also used the wires/arrows to connect.

I dont know why i resist the wired versions...

What do you use for an IF Function then? Do you have a custom one or just use a couple of standard ones?

You could use one or two Float Compare Actions in a State to do a kind of IF statement... Create two Events in the Event Editor one YES and the other NO.. Then in your Float Compare Action set the Equals to Action to YES maybe and then Set the Less Than to NO maybe..   Then add the Two Transitions to the State and set them to YES and the other to NO

As far as the structure of the States and what is wired to what you just need to follow your own basic Flowchart structure for the most part.. Draw out the logic on a piece of paper or in your Flowcharting program and then build it in PM.

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #11 on: August 23, 2011, 10:56:21 AM »
Picture wise i think Jean had something like this in mind...

Although doing this i could not get the Float Add to work as Per Sec with out Every Frame enabled which would not work of course. So i am not sure how to handle the incrementing in this type of loop..

Q

Sly

  • Full Member
  • ***
  • Posts: 123
Re: PlayMaker: Conditions use
« Reply #12 on: August 23, 2011, 11:05:30 AM »
The problem with this is that you will have a lot's of variables, maybe too many!

So yes it can be possible I guess but maybe too complicate in some cases.
For example if I need for an AI to check distance for target I will need to convert distance to a variable, and this for each AI :/ Nothing standard.

And what's happen if you have multiple state using transition YES or NO?

I really want to know if there are other way to do this.
« Last Edit: August 23, 2011, 11:07:26 AM by Sly »

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: PlayMaker: Conditions use
« Reply #13 on: August 23, 2011, 11:17:01 AM »
Well i am getting out of what i know... But only one state is active at one time... in an FSM   And each FSM is local unless you are accessing Global Variables or Global Events.. In these examples everything was local.. So another FSM could have Yes No set up for its local decisions too.. And i make Templates for my repetitive local setups.. That saves a lot of time.

What i do for logic in my simple project is... if there is some complex decision making to be done for different objects i create a separate Object that just does that decision making and i call it from my other objects passing variables along. It has all the logic in one place so that you can keep it editable and not spread all over the place.

I think you need to do some more tutorials and start building simple versions of what you are thinking.. I find that makes it way more clear for me and for getting help..

Q

Sly

  • Full Member
  • ***
  • Posts: 123
Re: PlayMaker: Conditions use
« Reply #14 on: August 23, 2011, 01:44:06 PM »
Hello,

I am working in the professional field too, so I have the reflexe to always try to optimize my work and to have things standard, so I can re-use it. That's why I try to find a better way.

I tried to check some tuto about that but nothing special about what I want.
And I am trying a lot's of things for now the limitations. Variable and conditions are the most important for me because you can do what you want with it, but using a good way.

I need playmaker for a project, and I need to check for an other a little bit more conplicate.
But you are right, I will check more tuto.

And I am just curious to know how JeanFabre on his own method "YES/NO". If you can give more details it can be great (if it's really different than Qholmes' method).

For now, thanks for your advises guyz. Enjoy the sun  :D