MochiAds Leaderboards released – let’s see how does it work

If you read MochiAds release log, you should have noticed the new entry:

Leaderboards
We launched a new MochiAds service. Developers can now add one or more leaderboards to a game. We also included an easy to use in-game widget to display scores to users.

In my opinion Leaderboards are the best highscore management system for Flash games at the moment.

Let’s see how does it work.

When you are in MochiAds game info panel, you will notice a new menu tab called leaderboard

MochiAds Leaderboards

Click on it and you will see an info page resuming leaderboard features. When you’re ready, click on CREATE LEADERBOARD

MochiAds Leaderboards

You are only one page away from the creation of your first leaderboard.

MochiAds Leaderboards

Let’s see all options:

Title: The title of the leaderboard, this will be displayed in game as you can see in the live preview

Description: Just an optional description

Type of Scoring: You can choose if the score is a number or a time, and if lower is better or higher is better. You can also assign a label to the score that will be shown in game as you can see in the live preview

The remaining options allow to style your leaderboard to fit your game color scheme. With the live preview you can play with colors until you are satisfied.

Click again on CREATE LEADERBOARD and you’ll see the final page with instructions about embedding leaderboards into your game.

MochiAds Leaderboards

In this page you will also find the MochiServices ZIP Package. Navigate inside its folders choosing the right folder according to your Actionscript version, and you will see a folder called mochi. Just copy this folder and paste it into the root classpath of your game. In almost all cases, it’s the same path where you saved the FLA source file of your game.

It’s very easy, anyway shouldn’t be enough easy, there is a step by step documentation in the MochiAds Help Center

Let’s see how did I embed leaderboards in the first game ever created with this new API: Glomb

In the 1st frame, in the same layer where I wrote the code for displaying MochiAds ads, I added this line:

mochi.MochiServices.connect("xxxxxxxxxxxxxxxx");

That 16 figures xxxxxxxxxxxxxxx is the MochiAd ID, and must be the same as the one provided with the ads

As an example, if your MochiAds code is MochiAd.showPreGameAd({id:"0123456789ABCDEF", res:"500x500"});, then the connection line will be mochi.MochiServices.connect("0123456789ABCDEF");

Then, in your game code, when the game is over and it’s time to submit score and show leaderboard, I used this line

mochi.MochiScores.showLeaderboard({boardID:"0123456789ABCDEF", score:my_score,onClose:function ():Void { show_splash()}});

let’s see the parameters:

boardID:"0123456789ABCDEF" is the MochiAd ID explained before

score:my_score passes the score to store in the leaderboard. Just replace my_score with the variable actually used to calculate your score during the game.

onClose:function ():Void { show_splash()} this is not necessary for the leaderboard to work, but if you want you can track when the player closes the leaderboard. In my case, when the player closes the leaderboard, I call the show_splash function, a custom function I made to show the splash screen of the game.

MochiAds Leaderboards

That’s all… yes, it was an easy tutorial with only two lines to explain, but including leaderboards into your Flash games now it’s really easy.

When you’ll have your leaderboard up and running with thousands of players trying to beat the record, you can manage it with a simple administration panel. You can also ban players or clear highscores.

MochiAds Leaderboards

Least but not last, you can create more leaderboards for the same game… let’s think about a racing game where each track has its own leaderboard… or a game with different difficulty levels, each one with its leaderboard…

With such a complete leaderboards to promote, I think we should expect a competition very soon… meanwhile try to beat highscores in Glomb

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading ... Loading ...
Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 25 comments

  1. Ed

    on January 22, 2008 at 7:29 pm

    It’s getting shifty again… ;)

    Leaderboards have been around since you started this blog anyway, but I must admit these do have a nice interface.

  2. RJ

    on January 22, 2008 at 7:50 pm

    I was just looking for the leaderboards and how to include them.

    Thanks

  3. RJ

    on January 22, 2008 at 7:58 pm

    After some time of thinking, I have a question:

    Does your game need to be published with MochiAds before you can add the leaderboards? What happends if I want to finish it before publishing it, is there any way to include the leaderboards before publishing?

    Thanks

  4. Emanuele Feronato

    on January 22, 2008 at 8:08 pm

    Very good question
    I know Bob reads this blog
    Let’s wait 4 the answer

  5. Josh

    on January 22, 2008 at 10:18 pm

    Hey i have a game i am makeing and i am trying to use the wasd keys for movement i can get forward to move him forward in the direction he is rotated(he is roteated by the mouse)but i cant get him to strafe. Right now i have this
    x = Math.sin(Math.PI/180*this._rotation)*30;
    y = Math.cos(Math.PI/180*this._rotation)*-30;
    this._x += x;
    this._y += y;

    and i have no idea what to do for strafe he kinda strafes when i put it as

    x = Math.sin(Math.PI/90*this._rotation)*30;
    y = Math.cos(Math.PI/90*this._rotation)*-30;
    this._x += x;
    this._y += y;

    but he strafes in like a circle.

    help would be awsome but if it doesnt work i can just make a left and d right basic stuff.

  6. Josh

    on January 22, 2008 at 10:21 pm

    opps all of this is in a onClipEvent(enterframe) thing in the movieclip
    just if that helps

  7. Bob Ippolito

    on January 22, 2008 at 11:01 pm

    You can create a leaderboard at any point, you don’t need to distribute your game with MochiAds (ever).

  8. Kesh

    on January 23, 2008 at 8:19 am

    hey you should make a tutorial on how to take the back and forward buttons on the right click go away. It’s pretty simple, but I can mess up your glomb game using this. it looks cheap that way. It would help people out with levels on each frame and people can skip.

  9. Glomb - The first Flash game to use MochiAds Leaderboards : Emanuele Feronato - italian geek and PROgrammer

    on January 23, 2008 at 11:10 am

    [...] MochiAds Leaderboards released – let’s see how does it work – read this post [...]

  10. Gabriel

    on January 23, 2008 at 2:02 pm

    Hope they do an EVER highscore… Just monthly and weekly and daily isn’t too good….

  11. Wackiedk

    on January 23, 2008 at 2:49 pm

    Yeaaa! I will try to make a 1-3 days with leaderboard inside. :D

  12. RJ

    on January 23, 2008 at 11:36 pm

    Hi, I have a question for you, guys

    As title, does “Nitro platform” sound good?

    Does it make sense?

    Thanks for your help

  13. Emanuele Feronato

    on January 24, 2008 at 12:59 am

    It’s a good title for a platform, a bad one for a MMORPG

  14. Shiv

    on January 24, 2008 at 11:17 am

    Great leaderboards out there. Only thing is we need is an alltime leaderboard.

  15. RJ

    on January 24, 2008 at 3:27 pm

    Thanks, Emanuele

    Shiv, Bob said in mochi forums they’re developing all time highscores.

  16. Bradley lecomte

    on January 25, 2008 at 1:42 am

    The leaderboards are awesome, so simple to use!The only thing I don’t like about the them, is there is no way(that I know of) to have two scores per name, so like, the level the player made it to, and their score, all on one board. Other than that, its great!

  17. Kesh

    on January 30, 2008 at 6:24 am

    when you view highscores via the code they give, and you push done to say your done with the highscore table, it goes to the next frame, rather than going back to the main menu. How do i get around this.

    also how do I put in decimal scores. Like 2.34 seconds. It didnt let me. It put it as 2.

  18. Kesh

    on January 30, 2008 at 6:26 am

    and brad, you could just add that to their name… like for name var you could same name = name + “level” + onLevel

  19. Harry

    on February 7, 2008 at 9:34 pm

    I cant get this to work, could anybody help? i can add to creds and my game as a 2.74 on newgrounds

  20. Scott

    on March 13, 2008 at 9:14 pm

    I have created a game (still in beta) with the MochiAd leaderboards. When a player gets a high score and submits it, the submit button remains there and the player can fill the board with their score. Anyone else running into this>

    I’m guessing some code can be added to an event like onSubmit make the submit button invisible, but I’m not sure what that code should be.

    Is this happening to anyone else?

  21. Scott

    on March 14, 2008 at 12:36 am

    Ugh! I would retract my earlier question if I could.

    The problem was in me displaying a button to submit the high score. It has nothing to do with the MochiAds Leaderboards. *I* needed to make *my* high score submit button go away. MochiAds already does this.

    SOrry for any confusion (I know I had some!)

  22. DamionKutaeff

    on March 23, 2008 at 1:12 am

    Hello everybody, my name is Damion, and I’m glad to join your conmunity,
    and wish to assit as far as possible.

  23. Frogger

    on August 31, 2008 at 8:29 am

    This looks neato. I’ll have to put it in my beta Game (I used a design similar to the “Classroom” tut you made Emanuele Feronato) =)

    You get to go in the Credits Mate!

  24. JJ

    on November 27, 2008 at 9:34 am

    very good tutorial, thank you!

  25. Mark

    on April 14, 2011 at 11:19 am

    Great walkthrough! I was having the worst time trying to get it to work. And now it is! Do you mind if I ask you an AS3 question?

    Basically I was doing this before:


    MochiScores.showLeaderboard({boardID: boardID, score: Board.points,
    onDisplay: onLeaderboardDisplay(),
    onClose: onLeaderboardClose() });

    to call my own functions for hiding stuff while the leaderboard was up. It didn’t work. The onClose function was getting executed right after onDisplay.

    Why is it necessary to wrap them in function() { }?

    The variables for points and BoardID don’t require that.