playMaker

Author Topic: Best top scores  (Read 6987 times)

ed

  • Playmaker Newbie
  • *
  • Posts: 6
Best top scores
« on: March 13, 2012, 08:32:31 AM »
I am very new to Unity and Playmaker, I make my bread and butter from visualization presentations where I find that Playmaker truly brings the shine to Unity, so I would like to stick with it when possible . 

I was trying in vain to make a simple  score board where data is stored locally but my lack of logic and knowledge of both unity and Playmaker has hit me like a cold wet brick wall, are there any tutorials or guides that could help me achieve this in playmaker? Or is there another method that is preferred buy the more savvy users here?

Any help or nudge in the right direction  is appreciated

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Best top scores
« Reply #1 on: March 15, 2012, 03:30:26 AM »
Hi,

 if I understand, you want to store locally the user's scores. you would first need to learn and work with the playerPrefs system ( which saves locally data).

Or are you already past that?

The thing is, working with lists and arrays in playmaker is not built in so you need to hack it a bit, which makes it already an advanced feature to implement I am afraid...

Several ways out of it.

1:you maintain a simple text file that you present as is, each line showing a score.

2: more complex: implement a user pref key per score ( "score_12","score_13"), etc)

you also store the current score, ( say 13).

 you then append a new score ( save it in user pref as "score_14" and save the new current score: 14).
 you only want to store say 10 scores, so every time you add a new score you also delete from the user pref the oldest score ( 14-11 so that would be score_3)

then in your interface, you have one gui element per score, and you access the user pref like so: currentScore ( "score_14), the second (currentScore-1 ->"score_13").

 As you are new to playmaker, look at the string actions, you can build string, constructs string in various ways to achieve the process above.

3: more complex: using ArrayMaker. https://hutonggames.fogbugz.com/default.asp?W715

I have created this utility to allow you to work with lists within playmaker. so it will be easier for you to work with list, But as you are new to playmaker AND Unity, this could add the learning curve...

 so I suggest you first get acquainted with Unity and playmaker a bit more, then you'll start to find ways of working out the score board.

If you have trouble learning about one the feature I mentionned above, let me know, I'll detail more.

Bye,

 Jean

ed

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Best top scores
« Reply #2 on: March 15, 2012, 09:06:07 AM »
Thanks that did help a fair bit, at the moment instead of using arrays I sorted the score positions by iterating the PlayerPerf key value hierarchically (simplest method) however I will look into array maker in the next moments.

I do have some misunderstandings of playerPrefs, can I transfer that data to a text file if so where can I find more information on such?

And again thanks that really did help a ton, I own you a beer :)
« Last Edit: March 15, 2012, 09:07:44 AM by ed »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Best top scores
« Reply #3 on: March 16, 2012, 01:36:55 AM »
Hi,

playerPrefs: it simply allows to set or get  string, an int or else. So once you have retrieved a string from the pref for a given key, and stored it in a fsmString using PLayerPrefsGetString, you can then do whatever you want with this string

 Now if you want to save that string in a text File on the computer hard disk right? I don't think they are action for this yet.

Is this what you mean by "transfer data to a text file"? else can you develop?

 Bye,

 Jean

ed

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Best top scores
« Reply #4 on: March 16, 2012, 09:14:48 AM »
Yes that's what I meant, it would be nice to transfer that data to a *.txt and later to a DB.
If you're asking me if I can further develop PlayMaker actions? at the moment I would have to say no ...at the moment.. .in given time I will.
PlayMaker is fun like crazy but I guess it's not meant to be the absolute solution to all, even though sometime it looks like it's getting there.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Best top scores
« Reply #5 on: March 19, 2012, 01:42:17 AM »
Hi,

Yes, you will have to find a db connection system outside playmaker and then bridge the two together, which will be the fun part if you have already found and set up a working db within Unity... :)

In my projects, I do that all the time, I have some libraries, frameworks that are not compatible with playmaker. I simply write the necessary custom actions and bridges to allow communications between the various elements, it working very well. Playmaker doesnit constraint you in that regards, it has a scripting API that will take care of that, so you can link to playmaker from standard scripts.


Bye,

 Jean

ed

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Best top scores
« Reply #6 on: March 19, 2012, 07:12:17 PM »
thank you very much for your time and input it is was very much appreciated.
Finally got my score board finished!  it wasn't the most elegant solution and it did cost me quite a few headaches(growing pains, due to my  lack of skills with PlayMaker)  but it works : )... I will have to work on this further when time allows.
I really do wish that there were tutorials on how to accomplish this just as the masters would, after all its is a basic essential component to any game.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Best top scores
« Reply #7 on: March 20, 2012, 01:18:42 AM »
Hi,

 Yes. This is tricky tho, because of the scope of possibilities, a score board is very very different from one project to another. Some will want global scores, some will want the last scores not ordered by "best", some will want yet another score board system. Some will want the games to be stored so that the player can continue...

 The best way currently with the resource available is to really study all the samples provided by unity, even if they do not match your actual need, you'll find the relation between the task, and the way it's been design to be applicable to your case, by extrapolating. But I agree this requires more work on your end...

And remember: learning the hard way is the best way to burn the information in your brain for good :) not the most pleasant and mainstream way tho :)

If you could share what you have done, We would be able to comment on what you did and iterate your solution to possibly something more inline ( if at all needed).


bye,

 Jean

ed

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Best top scores
« Reply #8 on: March 26, 2012, 11:15:12 AM »
I get your point, I will post up my results on a later date, I'll save myself the embarrassment for now until I have something more simplified and logical.
And yes you are absolutely right the more I bang my head on this the more I learn, nothing like learning from failure.
Thanks a ton for you support and patience, I owe you a case of beer   

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Best top scores
« Reply #9 on: March 27, 2012, 01:11:10 AM »
Hi,

 Don't hesitate to share what you have if you can :)

Bye,

 Jean

jalex19

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Best top scores
« Reply #10 on: March 28, 2012, 08:30:31 AM »
What Jean said - even if it is convoluted at this point it might spark an idea with someone else about how to simplify it, and then all benefit :)

ed

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Best top scores
« Reply #11 on: April 01, 2012, 10:17:02 AM »
Sorry for the late reply. Am chasing a few deadlines will post it up as soon as time allows.