Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Free easy to implement LeaderBoard

Discussion in 'Works In Progress' started by carmine, May 6, 2012.

  1. artouiros

    artouiros

    Joined:
    Mar 10, 2015
    Posts:
    8
    Hello, how do I get all scores? I am onyl getting first 100 lines with pipe.
     
  2. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    Hello,
    95% of leaderboards in the system have under 100 scores. If you are storing more than that, you could write a loop to get more scores if needed.

    The intention of this is to function as a "high score board". If you are trying to save every score for every player ever, you might want to use more of an online database than a high score system.
     
  3. Trickzbunny

    Trickzbunny

    Joined:
    Jun 26, 2015
    Posts:
    64
    2-3 Questions:

    - How can I switch the username and Score (to have score, username). I tried switching the (string username, int score) around, but that gave me a lot of errors.
    - Can I download the score of a username if the username is saved as a Playerpref.SetString?
    Basically, I dont want to save the score the same way due to easy cheating and would rather "check" the username that you are playing as download the score that is used from dreamlo.

    - And last but not least, I know dreamlo saves the highest score, is there an easy way to make it possible to check dreamlo if that username exists, if not then you cant pick that username?


    I followed the 2 videos of Sebastian Lague on youtube:
    this is part 2.
     
  4. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    - Are you trying to DISPLAY the Score then Name. Or did you mean something else?

    - If you want to see if the name exists already, you could get a list of all the scores, then you can see if the name is in the list. (you need to do a little programming for that)

    There is documentation here:
    http://dreamlo.com/developer

    You see there is an example here:
    "To get the score for just 1 person, just add -get and the person's name:"
    http://dreamlo.com/lb/(your public code goes here)/pipe-get/Carmine


    You can write that yourself using Unity3D's WWW object.

    -Carmine
     
  5. Peysbubby

    Peysbubby

    Joined:
    May 27, 2015
    Posts:
    7
    Hello Carmine

    Let me start by saying I love this asset.

    Now for my question. I am trying to implement dreamlo into my game, I have it working so I can upload the scores, but I am trying to display the scores using unity's new UI system, however the asset only comes with the scripts and docs for using the old UI. I have put a lot of time trying to figure out how to get it to work, but to no avail. If you could at least point me in the correct direction I would be eternally greatful.

    P.S. I use c#
     
  6. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    There are a couple ways to do this.
    If you google for "Unity3D UI display list" - you can find examples of how to make a dynamically scrollable list. For instance, this youtube video makes an object with a controller for each row: http://www.folio3.com/blog/creating-dynamic-scrollable-lists-with-new-unity-canvas-ui/

    Something more simple might be to make 2 UI.Text elements called "namelist" and "scorelist".
    - Get a reference to the 2 text elements
    - set them to blank namelist.text = "";
    - As you look through them, just do namelist.text + name + "\n";

    -Carmine
     
  7. Woodmouth

    Woodmouth

    Joined:
    Feb 15, 2017
    Posts:
    3
    Hello,
    First of all, thank you so much for dreamlo! :D
    I've made a game, and i'm trying to upload it to Kongregate. The highscore system works on Firefox with a webGL build, but once it is on Kongregate it is unable to retrieve any data. I've done some research, and it seems as though Kongregate requires the server to have CORS enabled (http://developers.kongregate.com/blog/unity-webgl). I think this is the problem. But i have also run http://www.test-cors.org/, and there it does seem to work fine, so I'm uncertain again. Any suggestions? Thank you for the massive favor you've already done for so many!
     
  8. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    I've found that the CORS thing just doesn't seem to work for some hosts such as dropbox and others. Are you connecting to "dreamlo.com" or "www.dreamlo.com"

    Also, is there another host you can try it on to see if it's an issue with Kongregate or something else?

    Thanks!
     
  9. Woodmouth

    Woodmouth

    Joined:
    Feb 15, 2017
    Posts:
    3
    I had uploaded it to Itch as well, and it had the same problem. I was using "https://dreamlo.com", but I tried changing it to "https://www.dreamlo.com", re-uploaded it to both platforms, and none of them work now either. Thank you for your quick response.
     
  10. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    Hey, I'm sorry :( but I'm not sure what the issue is. My server / code / etc. all have CORS turned on. I wonder if it's a browser restriction at all.
     
  11. Woodmouth

    Woodmouth

    Joined:
    Feb 15, 2017
    Posts:
    3
    Hmm, I'll try to remember to post here if i ever find out how to make it work, but thank you for the help, and thanks again for making dreamlo :D
     
  12. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    By the way... it's possible (but I can't say for sure), that if your host is SSL, then you need to use SSL on my end too. (I can't guarantee I am right about that)
     
  13. Peysbubby

    Peysbubby

    Joined:
    May 27, 2015
    Posts:
    7
    I can pretty much guarantee that is probably what it is. I have a website with an active SSL certificate, but it won't display my leaderboard because "it comes from an unsecure site" I haven't tested yet, but I am 90% sure if I was to upgrade my dreamlo account to have the SSL, it would work fine. because if I turn my SSL on my website off, the leaderboard will display perfectly.
     
  14. Voker54

    Voker54

    Joined:
    Apr 27, 2017
    Posts:
    1
    Welp, it's 5 years later and I just have to ask... Is it still up? :)
     
  15. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    http://dreamlo.com

    Yep!
     
  16. mhaze618

    mhaze618

    Joined:
    Sep 16, 2015
    Posts:
    3
    I just started using this today and right when I completed successfully downloaded/uploaded from my leader board the site went down. This is a AWESOME asset please let it be maintenance!

    Its back up thank god
     
    Last edited: Aug 6, 2017
  17. PenguinLord

    PenguinLord

    Joined:
    Sep 27, 2013
    Posts:
    9
    Hey, I've encountered an error whilst trying to get scores.

    NullReferenceException: Object reference not set to an instance of an object
    dreamloLeaderBoard.ToStringArray () (at Assets/dreamlo/dreamloLeaderBoard.cs:105)
    dreamloLeaderBoard.ToScoreArray () (at Assets/dreamlo/dreamloLeaderBoard.cs:111)
    GetScore.displayScore () (at Assets/GetScore.cs:21)
    GetScore.Start () (at Assets/GetScore.cs:14)

    Here is my code :p

    https://pastebin.com/FKBGe8vd

    The Example works but mine doesn't, i've tried to copy the example to see if i can fix it but no luck :/

    Error Line:
    string[] rows = this.highScores.Split(new char[] {'\n'}, System.StringSplitOptions.RemoveEmptyEntries);
     
  18. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391

    Make sure the prefab is in your scene and the public/private ode are set.
     
  19. PenguinLord

    PenguinLord

    Joined:
    Sep 27, 2013
    Posts:
    9
    Yeah i had already done that.
     
  20. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    In your code, your checking if scoreList is null inside our for loop instead of before it. You can't do a foreach on something that's null.
     
  21. PenguinLord

    PenguinLord

    Joined:
    Sep 27, 2013
    Posts:
    9
    Yeah i scrapped that, and i know i did that i saw it afterwards but it didn't change anything :p

    Anyway i'm using Sebastian Lague's Tutorial,Still having a problem though :p it doesn't like the username.

    Highscores.AddNewHighscore("User", 6, "00-36-34");

    error line:

    public static void AddNewHighscore(string username, int score, string time)
    {
    instance.StartCoroutine(instance.UploadNewHighscore(username, score, time));
    }

    So rip, just going to try to get it working.
     
  22. NEFT_GAMES

    NEFT_GAMES

    Joined:
    Feb 25, 2018
    Posts:
    1
    Hi,
    I just wanted to say this stuff is really really good!
    Implemented it in our premier game and it works just so fine
    It is much simpler to implement and it works nonetheless.
    Thumbs up to the developer
    I was hoping it could be endless but I can't figure out how to do so?
     
  23. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    Hello, I am the developer... what do you mean by endless?
     
  24. dohaiha930

    dohaiha930

    Joined:
    Mar 27, 2018
    Posts:
    53
    @carmine : Thank you for really useful stuff!
    Can you open source this? So we can improve it or setup on our own server?
     
  25. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    Hello, the system is entangled with a bunch of other stuff, so I can't just put it out there.

    However....

    It's really really simple. To make your own, you just need to have a table in a database, and then write some code on a website to get to that database and that's it. Any tutorial on making a web service would show you how to do this. There are several on how to write this kind of thing in Python, PHP, C#, Node.js, etc.
     
    dohaiha930 likes this.
  26. wowthecoder

    wowthecoder

    Joined:
    Aug 30, 2018
    Posts:
    2
    Hello,
    First of all, I must say that the dreamlo leaderboard system is AWESOME!!! I used it in my Unity project and it is working
    excellently. However, I am stuck on a little problem(which is actually mentioned above already): I am only getting first 100 lines with pipe, and I have about 300 scores on the online leaderboard. You answered above that "you could write a loop to get more scores if needed."
    How do I do that?
    Thanks!
     
  27. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    391
    Hello,
    The documentation shows you can get a range of scores like this:

    (this would be XML starting at 100 and to get 50.
    http://dreamlo.com/lb/(your public code)/xml/100/50

    You can just do a for loop for 3 times and get from /0/100 then 100/100. 200/100

    -Carmine
     
unityunity