Playmaker Forum

PlayMaker Feedback => Feature Requests => Topic started by: aliessmael on February 16, 2012, 11:29:19 AM

Title: Support List Variable
Post by: aliessmael on February 16, 2012, 11:29:19 AM
Hi ..
i did some search, and i saw arrayMaker
http://hutonggames.com/playmakerforum/index.php?topic=835.0
but i think it does not follow play maker variable style, and it is not easy to work with it.

what i prefer is to do the following
when adding new variable , just put check box to specify if it is list or single value.
for example to add list of float , i just add FsmFloat variable , and i put check box to specify that it is list.

now to simplify the work no need to add new actions to deal with list, just keep every thing as it is.
only there is small change.
at getting or setting variable. if it is list , just show small edit box to specify index.
and it will be very good if is supported as expression
http://hutonggames.com/playmakerforum/index.php?topic=1060.0

please implementing this will make work very easy.
Title: Re: Support List Variable
Post by: jeanfabre on February 16, 2012, 12:25:58 PM
Hi,

 Where exactly do you have difficulties in using ArrayMaker? I am more then willing to help you make the most of arrayMaker. Until Playmaker supports this, I find it mandatory when you need lists and hashtables. I tried to make it as obvious as possible within the limits of what's possible with playmaker. So if there is something you'd like to see implemented, let me know, I'll see what I can do.

Bye,

 Jean
Title: Re: Support List Variable
Post by: aliessmael on February 16, 2012, 02:30:59 PM
I did not work deeply in ArrayMaker , but i took quick look on it.
the first think is the style is different than playMaker variable
i need to add actions and may be whole state to deal with arrays. for me i prefer to make FSM simple as much as possible.

for example , if i need to make FSM to store all objects that i collide with.
in my idea i will do like this:
i will create new GameObject variable, but i will check it as list ( same way of current adding variable except the check box).
now i create one state with ( Get Collision Info ), and in "Game Object Hit" field i choose my variable.
every thing is the same and simple, no extra actions , no extra states.
Title: Re: Support List Variable
Post by: jeanfabre on February 17, 2012, 05:53:28 AM
Hi,

 I hear you.

 tho, your example is only scratching the surface of what it means to work with arrays and list in general. you'll then need to process this list somehow, and that will take you more than one state if you do it properly ( don't fear the number of states, the more you have and the less there is in each state, the better).

What you are describing is interesting however. My approach was to port the array and hashTable api, not provide convenient links between various features of Unity: this would be an overwhelming task... So, if you request things like that, I most definitely will look into it and provide convenient actions to do such things as store information in list in one go.

The other problem I have with implement arrayMaker is the limitation of the action gui interface definition. It is very limiting, and hopefully, future playmaker version will provide a more versatile ui system so that we can provide dynamic and context base gui for actions. until then... it's a trade in between the interface and the flexibility of a single action.

Bye,

 Jean
Title: Re: Support List Variable
Post by: Alex Chouls on February 17, 2012, 03:00:58 PM
It's funny, I was considering something just like this!

Certainly being able to use these transparently in all existing actions would be very nice!

I haven't worked through all the ramifications of this kind of design yet, but at first blush it seems quite appealing...


Title: Re: Support List Variable
Post by: jeanfabre on February 21, 2012, 02:01:42 AM
Ok,

 Here is a sample using arrayMaker to illustrate what aliessmael example: that is storing object colliding with a collider ( I will use triggers here, but colliders would be identical).

to install this example, first get arrayMaker here: https://hutonggames.fogbugz.com/?W715 (https://hutonggames.fogbugz.com/?W715)

then you can lod this package. It will overwrite the gameObjectPositioning scene in PLaymakerSamples/TestLab/Addons/ArrayMaker/ArrayList/

look for the gameObject named "cube trigger"

 I have several cubes falling. I created a plane "cube trigger" right in the way of the falling cubes, I set it's collider to trigger, and with one fsm and two actions, I have a system that detects the cubes and store them in an array. I have also added an array list to that gameObject ( to do so, select your gameObject, and  click on the menu "playmaker Add ons-ArraMaker-Add ArrayList proxy to selected gameobject" )

Now play the scene, and watch the prefill content of this array getting all the cubes that fall through this plane.  Also, notice that you'll get duplicated items because some cubes bounces etc etc. so as an exercice, you could check if the gameObject is already in the array ( using ArrayListContains action ) and if not add it

 I don't really see this as being complex if you actually come to need to work with arrays in your game,
-- but I appreciate that the lack of help for arrayMaker does not facilitate the task, and the action interface inability to be context based ( that is I have to display all the possible fsm variables, that is not helping clarity too...),

I would not build a specific action ( I only had to use two actions here) for this, because it would be so specific that it would unlikely be reusable ( and actions should be reusable as much as possible). For example one purpose would be to record activity, while the other would be to store and sort a list of all objects that passed through it wihout duplication, another use would only require to store a component from the gameObject, or  a particular property of that gameObject. So really, in such cases, I think building the logic using states makes more sense than building a single action.


I need to find the time to do the arrayMaker documentation ... :)

 Bye,

 Jean