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

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

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:


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

Get the most popular Phaser 3 book

Through 202 pages, 32 source code examples and an Android Studio project you will learn how to build cross platform HTML5 games and create a complete game along the way.

Get the book

// 1+2=3
// 100 rounds
// 10000000
// 2 Cars
// 2048
// A Blocky Christmas
// A Jumping Block
// A Life of Logic
// Angry Birds
// Angry Birds Space
// Artillery
// Astro-PANIC!
// Avoider
// Back to Square One
// Ball Game
// Ball vs Ball
// Ball: Revamped
// Balloon Invasion
// BallPusher
// Ballz
// Bar Balance
// Bejeweled
// Biggification
// Block it
// Blockage
// Bloons
// Boids
// Bombuzal
// Boom Dots
// Bouncing Ball
// Bouncing Ball 2
// Bouncy Light
// BoxHead
// Breakout
// Bricks
// Bubble Chaos
// Bubbles 2
// Card Game
// Castle Ramble
// Chronotron
// Circle Chain
// Circle Path
// Circle Race
// Circular endless runner
// Cirplosion
// CLOCKS - The Game
// Color Hit
// Color Jump
// ColorFill
// Columns
// Concentration
// Crossy Road
// Crush the Castle
// Cube Jump
// CubesOut
// Dash N Blast
// Dashy Panda
// Deflection
// Diamond Digger Saga
// Don't touch the spikes
// Dots
// Down The Mountain
// Drag and Match
// Draw Game
// Drop Wizard
// DROP'd
// Dudeski
// Dungeon Raid
// Educational Game
// Elasticity
// Endless Runner
// Erase Box
// Eskiv
// Farm Heroes Saga
// Filler
// Flappy Bird
// Fling
// Flipping Legend
// Floaty Light
// Fuse Ballz
// GearTaker
// Gem Sweeper
// Globe
// Goat Rider
// Gold Miner
// Grindstone
// GuessNext
// Helicopter
// Hero Emblems
// Hero Slide
// Hexagonal Tiles
// HookPod
// Hop Hop Hop Underwater
// Horizontal Endless Runner
// Hundreds
// Hungry Hero
// Hurry it's Christmas
// InkTd
// Iromeku
// Jet Set Willy
// Jigsaw Game
// Knife Hit
// Knightfall
// Legends of Runeterra
// Lep's World
// Line Rider
// Lumines
// Magick
// MagOrMin
// Mass Attack
// Math Game
// Maze
// Meeblings
// Memdot
// Metro Siberia Underground
// Mike Dangers
// Mikey Hooks
// Nano War
// Nodes
// o:anquan
// One Button Game
// One Tap RPG
// Ononmin
// Pacco
// Perfect Square!
// Perfectionism
// Phyballs
// Pixel Purge
// PixelField
// Planet Revenge
// Plants Vs Zombies
// Platform
// Platform game
// Plus+Plus
// Pocket Snap
// Poker
// Pool
// Pop the Lock
// Pop to Save
// Poux
// Pudi
// Pumpkin Story
// Puppet Bird
// Pyramids of Ra
// qomp
// Quick Switch
// Racing
// Radical
// Rebuild Chile
// Renju
// Rise Above
// Risky Road
// Roguelike
// Roly Poly
// Run Around
// Rush Hour
// SameGame
// SamePhysics
// Save the Totem
// Security
// Serious Scramblers
// Shrink it
// Sling
// Slingy
// Snowflakes
// Sokoban
// Space Checkers
// Space is Key
// Spellfall
// Spinny Gun
// Splitter
// Spring Ninja
// Sproing
// Stabilize!
// Stack
// Stairs
// Stick Hero
// String Avoider
// Stringy
// Sudoku
// Super Mario Bros
// Surfingers
// Survival Horror
// Talesworth Adventure
// Tetris
// The Impossible Line
// The Moops - Combos of Joy
// The Next Arrow
// Threes
// Tic Tac Toe
// Timberman
// Tiny Wings
// Tipsy Tower
// Toony
// Totem Destroyer
// Tower Defense
// Trick Shot
// Tunnelball
// Turn
// Turnellio
// TwinSpin
// vvvvvv
// Warp Shift
// Way of an Idea
// Whack a Creep
// Wheel of Fortune
// Where's my Water
// Wish Upon a Star
// Word Game
// Wordle
// Worms
// Yanga
// Yeah Bunny
// Zhed
// zNumbers