playMaker

Author Topic: PlayMaker/ArrayMaker character list and selection  (Read 6932 times)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
PlayMaker/ArrayMaker character list and selection
« on: July 24, 2012, 11:29:37 PM »
I have a need for some close assistance with something I’m trying to achieve with PlayMaker and AssetMaker.

My project has a character select screen.  There are about 300 pre-defined characters in my project, but only X number of them are accessible at any given time.  The number of selectable characters (“X”) is derived from an Int variable during gameplay.

What I need to do is feed that Int to ArrayMaker so it will retrieve X number of the characters for the select screen.

The characters are dynamically generated by a String variable, so the list of characters stored in the Array are 300 strings, not actual gameObjects.  ArrayMaker will simply be isolating X number of the strings from the total list and passing it to my avatar generator which constructs and displays them.


I have found ArrayMaker to be a bit daunting.  I have also had no experience with Array’s (uh oh).  I did look through and study all the example scenes, but I think some of them might not even work (hitting enter in the wordMatch dialog only starts another line of text, rather than searches the array list).
At the same time I’m quite dumb, so I could just be making my usual mistakes.  ;)  I would greatly appreciate a quick example of how to set up such an FSM though, and if you can help, I probably have a couple other questions to add to it.

Many thanks in advance, as always.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PlayMaker/ArrayMaker character list and selection
« Reply #1 on: July 25, 2012, 07:12:47 AM »
Hi,

 Let me rephrase so we are on the same thing.
 

 you have 300 items and you only want to pass the first 40 items for example ( let's call it "number of avatars")

 few solutions:

1: either your avator generator knows about the "number of avatars" and you always work with the raw list and simply stop iterating or accessing any item above that "number of avatars"

2: your avator generator has another arrayList and you copy the items from the raw list to that avator generator using the actions "ArrayListCopyTo", that action lets you specify what part of the array to copy, so start index is 0 and count would be "number of avatars". your avatat generator will end up with only what's needed.

 Are they things you already tried?

bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: PlayMaker/ArrayMaker character list and selection
« Reply #2 on: July 25, 2012, 08:54:16 PM »
Hi Jean, I was hoping you'd find this thread. 

You have the right idea, yes.

Unfortunately I'm not even quite as far along as to be able to try your suggestions.  I have such basic questions that some equally basic documentation would help more than anything.  My primary concern is to figure out as much as I can on my own, and not burden the community with asking people to teach me things, but I still need a few explanations and help with this.

First question I have is: Does ArrayMaker more or less use identical terminology that would be found in traditional language Array's?  Could I prep myself for using ArrayMaker by reading up on Arrays in C#? 

Other than that there are a few specific questions I have, if you have time.  For example, what purpose does the Reference field serve?  Is it simply a string identifier for the respective ArrayList Proxy Component?  That is the impression I got from the tool tip, but it's such a prominent field I wasn't sure why it just didn't say "Array Name" (unless that's just proper terminology).

Secondly, in the context of "PreFilled data", and using the example of what I'm trying to achieve in my original post, would PreFilled Data be the section of the component that would hold the 300 character strings?  I am assuming I would store them here in advance, and then pass the script events onto the list to isolate the ones I want for character selection.

Lastly, can single data type have multiple types of variables associated with it?

For example, the player will be able to choose and play as any of the 300 characters over the course of the game, and these extra characters act like extra lives do in older games. Sometimes the characters will die and I don't want them to ever be selectable again.  How would I mark the associated character string in the Array List Proxy so my character select loading script skips that data from then on?  Can I associate a bool with each string? 

So I apologize that this is so amateur, but I had to post for some help since there wasn't any documentation, and I wasn't certain if terms and concepts were transferable from the traditional approach.

I really appreciate any tips.  Thank you!




jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PlayMaker/ArrayMaker character list and selection
« Reply #3 on: July 26, 2012, 08:09:40 AM »
Hi,

 don't worry about you asking things that you might feel not adequate. A forum is meant for you to ask questions in the first place, so never hesitate!

Yes, ArrayMaker use the very same vocabulary as the methods you would use with arrays if you were scripting. So yes you can look at examples and theory on c# arrayList and hashtable and find the corresponding playmaker actions for them.

the reference field must be used when you have more than one arrayList or hashtable on the same GameObject, I need a way to identify which one you want to access, does that make sense? Ignore this completly if you are only hosting ONE arrayList and/or ONE hashtable on a gameObject, in that case, there can be no doubt about that. This is something that I added for the implementation, this is not somethign that belongs to the array Itself.

You can prefill with 300 hundred items yes... tho I would not recommand this AT ALL. instead you should maintain a text file that you parse when the application starts that will read each line of the text file and make an try out of it in arrayMaker. Please look at the word search example for a example, you would use the very same technic.

A single arrayList or hashtable can host any data you want, the prefill system I have in place constrains you in only filling one type, but that could be easily lifted with a more flexible editor interface. So yes, you can have a string, then an int, then a gameObjet in the same arrayList, ArrayMaker will be fine with this. Of course it will be up to the designer to properly make use of that power.

in your case, have two arrayList, one that host the string themselves, and have a second arrayList hoting bollean values. so for a given index ( say item 10) , you willg et the string fromt he first array and get it's flag from the second array. Does that make sense? this is a perfect example of using the reference, have both arrays on the same gameObject, name the first array "name" and the second array "selectable". Does that make sense?

Bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: PlayMaker/ArrayMaker character list and selection
« Reply #4 on: July 26, 2012, 12:27:43 PM »
Hi Jean,

Thank you for your assistance, as always.

Your explanations make perfect sense, I understand how to go about doing this now.  Now I just need to learn how to create the scripts themselves. 

Thank you again!


artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: PlayMaker/ArrayMaker character list and selection
« Reply #5 on: July 27, 2012, 01:01:11 AM »
I think I could just use some general information about the way PlayMaker displays its Array actions.

Here is a state where I (intend to) search for an existing entry in my Array List, but it also represents the trouble I'm having in general with understanding ArrayMaker, since most of the actions look something like this.



I'm confused by the Set up section and the Data sections contents.  In Set up, (I think) I declare the variable type to retrieve from the list.  But then in the Data section it gives the option for every datatype the list can possibly hold. 

This is extremely confusing to me. 

Shouldn't the Data section also allow for a preconfiguration of the desired datatype, so you can isolate the data you're looking for instead of having everything displayed at once?

Or am I misunderstanding the nature of this interface, and it's possible to search for multiple datatypes?  (I don't know why I would do that).

If the latter is true, what purpose does the FSM Variable Type option in the Set up section serve?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PlayMaker/ArrayMaker character list and selection
« Reply #6 on: July 27, 2012, 03:27:18 AM »
Hi,

 Yes, indeed this is confusing, and it's unfortunatly something I can not do anything about because of the constraint nature of how an action declares its interface.

So, the "Set up" section lets you define the "Fsm Variable Type", so if you want to tes it that array contains a String, you must select "Fsm String" in "Fsm Variable type" AND then in the Data section, fill the "Contains String data".

 You are right that ALL the remaining Data fields are no necessary, but there is currently no other way for me to propose such actions. Else I would need to duplicate each actions for each possible data type which would make hundreds of actions as a result...


 Does it helps understanding how to use the actions? you say which variable type you want to work with and you only need to fill that variable type in the data section.



bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: PlayMaker/ArrayMaker character list and selection
« Reply #7 on: July 27, 2012, 05:00:35 PM »
Thanks!  This does help.  I'm sure I will have more questions later, but for now I appreciate the information.  It's good to know that I wasn't just crazy.  :)

Cheers.