playMaker

Author Topic: Some questions  (Read 10228 times)

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Some questions
« on: March 24, 2011, 12:20:58 PM »
Alex, I've spent some time reading the online docs and got some questions about it, plus some additional general PlayMaker workflow doubts. Sorry if it's a somewhat long list, hopefully the answers can help other users:

In "GetChildNum", what does that "Index" refers to in Unity terms? Is that the order in which the object is listed in the Unity list?

In MoveTowards, does TargetObject take precedence over TargetPosition? Not sure if both are visible at once, since I don't have PlayMaker in this machine, I'm just asking because as it's shown in the site it's confusing. In any case, how would you add an "error factor" to MoveTowards (suppose it's a simulated shot), copy the object position to a variable then manually add the error? BTW, one thing that would be *extremely* handy for gameplay design is having a "prediction" boolean setting here. When turned on, the object would move towards not the current position of the object, but the predicted position of the gameobject supposing it doesn't change its current trajectory. I know that can be built with some Custom Action coding effort, would just be nice having that as a default.

In "Create Object" description: 'Instantiates a game object/prefab at a spawn point. Optionally parents the new object to the spawn point.' Yet no "parent" option is visible and later in the text you hint that you can store the object in a variable to later parent it. What's the right one?

In "Get Collision Info" there's no description for "Contact Point" and "Contact Normal", could you elaborate?

"Activate Game Object", there's a 'Reset On Exit" option. From other descriptions like Play Anim I infer it's an "exit from the state" option but it's not clear when that docs page is read on its own.

"Random Event" has no way to select from a specific list of events, it would be nice being able to specify a list of possible events to be chosen randomized 'coz rarely you'd want every event in the FSM to be valid for a certain action, except if the FSM is built specifically for that - eg. an attack FSM split from a move FSM in an NPC.

How would you fire up an FSM Event from an Animation Clip Event? I imagine you'd have a standard component (script) in the gameObject to receive the message and pass it to the FSM, is that how you'd deal with that? Would be cool having a sample or maybe a standard component for that, since it's very handy having specific event being pinpoint-synced to a frame within an animation - for instance, an arrow spawning exactly when the hand releases the bow rope tension. For the record, Unity used to get lost when an animation event was fired too close to the start or the end of an animation clip, especially when the even was fired during a blend, I recall a Unity guy recognizing it was a bug in 2.6. Not sure if they've fixed it since then or not, I'm just reporting it here in case anyone experience weird behavior from animclip events.

I don't see any "HasComponent" action, how can you know from within PlayMaker if a gameObject has a specific component/script attached? We use that a lot as a way to circumvent Unity's limitation of just one tag per object, basically we have "stub" components which we attach to objects to fake setting "secondary tags" in the game Object. It comes quite handy in many circumstances, for instance, you could have the "enemy" tag + "tier1" or "tier2", etc secondary tags. Maybe you can share your own ideas about how to address this.

SetMaterial as it is just changes the whole material, yet many times you want to adjust some of its property values, it's especially handy to make a material "flash" briefly by varying its alpha value (plus a glow filter of course). Currently I do that using iTween, is iTween's implementation in the new PlayMaker version able to do that as-is or does it require some tweak?

I've noticed you have a 'collections' data type but so far we have no documentation on it. As it is, how would you define a list for say, a sequence of spawn possibilities which would be picked randomly, in sequence, out of a array of possible combinations? I've thought about multiple "spawn wave" FSMs activating/deactivating each other but it seems a bit problematic to maintain and properly debug. Ideas?

I'm sure I had other questions to make but memory fails me right now.. I guess it's too close to lunch and I've already typed a lot for a single post :) Thanks in advance!
--
Breno "MaDDoX" Azevedo
@brenoazevedo

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Some questions
« Reply #1 on: March 24, 2011, 03:55:59 PM »
Quote
In "GetChildNum", what does that "Index" refers to in Unity terms? Is that the order in which the object is listed in the Unity list?

Yes. It lets you iterate through children. You can use the scene hierarchy as a form of object collection, grouping related nodes under a parent. E.g., waypoints, spawnpoints etc.

Quote
In MoveTowards, does TargetObject take precedence over TargetPosition? Not sure if both are visible at once, since I don't have PlayMaker in this machine, I'm just asking because as it's shown in the site it's confusing. In any case, how would you add an "error factor" to MoveTowards (suppose it's a simulated shot), copy the object position to a variable then manually add the error? BTW, one thing that would be *extremely* handy for gameplay design is having a "prediction" boolean setting here. When turned on, the object would move towards not the current position of the object, but the predicted position of the gameobject supposing it doesn't change its current trajectory. I know that can be built with some Custom Action coding effort, would just be nice having that as a default.

The online docs are a little out of date. The in app tooltips give more info: "The Target can be specified as a Game Object or a world Position. If you specify both, then the Position is used as a local offset from the Object's Position."

This is a common pattern used whenever you see Object and Position together like this. It can be handy to give a little offset from a node in the world.

I'm working on a TrackObjectMotion action that keeps a history of an object's motion and lets you get things like: starting point, average position, starting velocity, recent velocity, predicted position... I think it will be very useful!

Quote
In "Create Object" description: 'Instantiates a game object/prefab at a spawn point. Optionally parents the new object to the spawn point.' Yet no "parent" option is visible and later in the text you hint that you can store the object in a variable to later parent it. What's the right one?

The docs are out of date. "Optionally parent" is gone - just store the object and do anything you want to it!

Quote
In "Get Collision Info" there's no description for "Contact Point" and "Contact Normal", could you elaborate?

Added some detail to the docs. It can also be helpful to check out the Unity docs on systems like physics. I try to use the same terminology...

Quote
"Random Event" has no way to select from a specific list of events, it would be nice being able to specify a list of possible events to be chosen randomized 'coz rarely you'd want every event in the FSM to be valid for a certain action, except if the FSM is built specifically for that - eg. an attack FSM split from a move FSM in an NPC.

I agree. Random Event was one of the first actions I wrote, back before I had arrays in the Action Editor! I'll add an events list...

Quote
How would you fire up an FSM Event from an Animation Clip Event?


You can actually send the event directly to the FSM. See https://hutonggames.fogbugz.com/default.asp?W181

Quote
I don't see any "HasComponent" action...

It's in the 1.1 update. :)

Quote
SetMaterial as it is just changes the whole material...

There are other actions that target material properties. E.g., Set Material Color, Set Material Texture, Set Material Float...

1.1 also adds a Material Index so you can target any material on an object.

Quote
I've noticed you have a 'collections' data type but so far we have no documentation on it.

Quite a few actions let you define an array of choices. E.g., Select Random Game Object.

You can also use the scene hierarchy to organize things like spawn points. And use actions like Get Child Num to iterate through them.

There is no array or list Fsm Variable type yet, that you can define at the FSM level (e.g., in the PlayMakerFsm inspector). That would be nice, letting you define an array once and share it across actions.... Will probably find its way into a future update.

Also working on an Object Pool system that is good for performance, and can be used as a collection of objects. This will let you pre-populate Object Pools with game objects that you then pull from in the game loop. And you can specify what happens when the pool is empty (kill oldest etc.).


Good questions! I need to go through the docs and bring them up to date, and add all the 1.1 docs too!
-Alex

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Re: Some questions
« Reply #2 on: March 24, 2011, 08:05:04 PM »
Quote
I'm working on a TrackObjectMotion action that keeps a history of an object's motion and lets you get things like: starting point, average position, starting velocity, recent velocity, predicted position... I think it will be very useful!
Top notch, I seriously can't hold my breath! By the way you anticipate what us designers need to productively craft gameplay, you sound like someone who actually worked in the game industry in the past and faced those challenges yourself. Am I right?

Quote
Added some detail to the docs.
Thanks and sorry for being picky. I just figured that since the beta is over and you don't have a demo most prospective users would check the documentation to see what the tool is capable of, so I put myself in their shoes (instead of firing the beta, which I still have) to see how it'd go. I haven't checked all the documentation of course, completely missed that firing FSM events from within an animation or the "Set Material Float" for instance, but aside from a few errors it's overall quite comprehensive and well organized.

Quote
You can use the scene hierarchy as a form of object collection
That not only sounds super-useful, it's also quite intriguing. So, just to make it 100% clear: the scene hierarchy is ordered alphabetically, which means if I have a gameobject called, say, "NPCspawnsequence01" then a bunch of gameobjects named "1", "2", "3", etc, and parent them, they'll always be indexed in their alphabetical order right? Meaning if I want to make "3" precede "1" in the index all I have to do is rename it to "0", is that correct?

Quote
Quote
I don't see any "HasComponent" action...
It's in the 1.1 update. :)
Wow.. another show of clairvoyance ;) Excellent, thanks!

PS.: I've just (finally) bought PlayMaker and got prized with that "no-auto-download-on-3.2" asset store bug. I'm not willing to update to 3.3 to avoid the bugs that people are reporting with it. For the record, simply closing and opening the asset store will show the download as available in the downloads section. Clicking on download - and re-trying it a couple times if needed - works things out.
--
Breno "MaDDoX" Azevedo
@brenoazevedo