Showing MochiAds leaderboards in any Flash movie or web page

Ok, so you created your awesome game, embedded MochiAds leaderboards and want to publish high scores in your homepage, in another Flash movie, or wherever you want, just outside the game.

Just think about Kongregate, that shows top scores on the right of the game you are playing.

That’s what we are going to do.

Information stored into MochiAds leaderboards

Every player who enters the leaderboard is saved with its name, the score (obviously), the ISO 3166-1 alpha-2 Country code and the timestamp of his score.

ISO 3166-1 alpha-2 country codes are two-letter country codes in the ISO 3166-1 standard to represent countries and dependent territories.

They are published by the International Organization for Standardization (ISO) as part of its ISO 3166 standard.

Read this page for further information.

The timestamp is the number of millisecond passed from January 1st, 1970

There are other information you can get from MochiAds leaderboards such as the number of entries for each leaderboard, but in this example I am only showing an all-time top 10 chart, so I already have enough information.

Refer to MochiAds Developer Support for the full list of options. Read more

Learn an important lesson from the new search engine Cuil

Yesterday a new search engine called Cuil (pronounced “Cool”) made its debut on the web.

cuil

According to its developers, (Tom Costello and Anna Patterson, ex-Google search experts) it can index web pages significantly faster and cheaper than Google.

But the point is not how cool is Cuil, it’s that some big names think there is still room for another search engine… and want to go against Google.

What does it mean?

That you don’t have to be afraid to make another arcade site, another Bloons clone, or another “whatever-you-can-imagine”.

There is room for everybody.

Firefox has its niche. Probably Cuil will do the same. And maybe you (or me, or granny) too.

Just make something cool.

Create 3D avatars and win over $20,000 with Meez and FlashGameLicense

Let me introduce you an interesting opportunity to improve the look and feel of your games and win cash prizes: MeezInside Avatar Games Contest hosted by Meez and FlashGameLicense.

You should already know FGL for its marketplace and First Impressions services.

Meez is a social entertainment site where can create animated 3D avatars, dress up the avatars, play free games and use the avatars in virtual worlds.

You can also use created avatars as an AIM emoticon or export it into MySpace, Facebook and other sites.

I am trying the service and I have to admit the avatars you can create are very detailed.

There are lots of backgrounds, settings and assets that the only limit seems to be your creativity… and your Coinz, since some features cost Coinz, Meez’s virtual money.

This is an avatar I created almost for free, and that will be used in a game I am developing

Now, let’s talk about money…

FlashGameLicense and Meez are offering Flash games developers over $20,000 in prizes for the best games using the MeezInside Avatar API.

Oh, yes, they released an API!

Your entry is also eligible for primary licenses, ad revenue, and the other licensing options you expect from FGL!

Refer to the official page for full guidelines and let me introduce you the API.

As said in the API docs, the Meez Inside Games API offers a turnkey solution for users to bring their own custom characters effortlessly into Flash games deployed anywhere on the web. The Meez Inside Games Platform also allows developers to easily and quickly generate custom NPCs to embed in their projects, while selecting from a broad range of gameready animations.

Once you created an avatar, like mine, go to Meez Image Service and with a couple of clicks in a simple interface like this one

You will be able to generate a filmstrip with an animation such as all walking directions for a game like I did, or gestures such as laughing, waving and so on.

Also, I would like you to look at the detail of every single frame.

Now, even if you are not interested in taking part at the contest, you’ll have a beautiful animation to be used in your next game… add to it the chance to win up to $10,000 (the first prize) and you’ll definitively want to know something more about Meez.

Again, start from the MeezInside Contest Detail page and good luck!

Another vintage color action for Photoshop

I am always looking for new ways to simulate vintage colors.

I already published Vintage colors effect action for Photoshop and Create a vintage photo effect in Photoshop but I decided to turn into an action this tutorial from CreateBlog.

This action can convert a photo like this one (made by Tommy Huynh)

Before

into this one

Before

in a matter of seconds.

Download the action.

Creation of a Flash arcade site using WordPress - step 2

In this step, we’ll see how to configure WordPress to turn it into an arcade site.

Remember that my final goal is to self-populate my arcade site with MochiAds feed but if you understand how does it work, you can easily custom it to meet you needs.

Just another WordPress blog

This is how every blog comes to life.

Download WP and install it.

Categories

Now it’s time to add categories to the blog.

In the administrator panel I added all MochiAds game categories.

Let’s see them all: Action, Adventure, Board Game, Casino, Driving, Dress Up, Fighting, Puzzles, Pimp my / Customize, Shooting, Sports and Other.

I also added a categoy called “Leaderboard enabled” where to file all leaderboard enabled games. Read more

Create a Flash game like Deflection - part 3

Multipart tutorial: available parts 1, 2, 3

In this 3rd part we are going to create a complete game with exit and two levels.

Read parts 1 and 2 if you haven’t done it already.

I’ll also fix a bug reported by Questo:

I was playing around and if you right click while making a line it sotps the ball but the ball keeps moving when you put lines on it. it’s pretty cool.

It’s not a difficult task since the game engine is already working… I just created a makelevel function that handles level creation with a switch Read more

RRODE: the second one-week game

My 10th released game is my 9th produced one.

If you wonder why Summer Couples was made a month after the game I am going to introduce now, it’s because looking for a sponsorship can take some time.

More than a month in this case.

Once I uploaded the game on FlashGameLicense I received some offers in the first week but I had to wait a month in order to get the one I think it’s the best for that kind of game.

So think twice before accepting the first offer

First of all let me introduce the sponsor: HALLPASS.

Hallpass

It’s one of the big names out there, so it does not need any additional information, but just let me remind you what Hallpass has and other sites do not have: challenges Read more

Sending email with multiple attachments with PHP

Today I was looking for a cut/paste script to manage emails with multiple attachments with php and I only found classes, server-side libraries or non-working examples (!!!).

I just needed an easy script and I did not find it... so I cut/pasted here and there, I changed something, shaked a bit and here it is an easy and working script.

Just fill $files array with the files to be sent, custom email fields and you're done.

PHP:
  1. <?php
  2.  
  3. // array with filenames to be sent as attachment
  4. $files = array("file_1.ext","file_2.ext","file_3.ext",......);
  5.  
  6. // email fields: to, from, subject, and so on
  7. $to = "mail@mail.com";
  8. $from = "mail@mail.com";
  9. $subject ="My subject";
  10. $message = "My message";
  11. $headers = "From: $from";
  12.  
  13. // boundary
  14. $semi_rand = md5(time());
  15. $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
  16.  
  17. // headers for attachment
  18. $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
  19.  
  20. // multipart boundary
  21. $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
  22. $message .= "--{$mime_boundary}\n";
  23.  
  24. // preparing attachments
  25. for($x=0;$x<count($files);$x++){
  26.     $file = fopen($files[$x],"rb");
  27.     $data = fread($file,filesize($files[$x]));
  28.     fclose($file);
  29.     $data = chunk_split(base64_encode($data));
  30.     $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" .
  31.     "Content-Disposition: attachment;\n" . " filename=\"$files[$x]\"\n" .
  32.     "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
  33.     $message .= "--{$mime_boundary}\n";
  34. }
  35.  
  36. // send
  37.  
  38. $ok = @mail($to, $subject, $message, $headers);
  39. if ($ok) {
  40.     echo "<p>mail sent to $to!</p>";
  41. } else {
  42.     echo "<p>mail could not be sent!</p>";
  43. }
  44.  
  45. ?>

Enjoy and send mails with any number of attachments without any class/library

Useful information about WP powered arcade sites

Yesterday I started my project called Creation of a Flash arcade site using Wordpress and today I received a lot of emails from readers that want to run their own WP arcade.

I want to share with you some really useful information sent me by a reader who prefers to remain anonymous.

This post will help you if you want to start building your own WP arcade.

Here we go:

The reasons I chose Wordpress are:
- Its free :)
- I am primarily just going to be hosting my own games, so I don't need anything too fancy and Wordpress is as simple or complex as you need it to be.
- Most arcade scripts have a lot of features I simply wouldn't use and can cause clutter / extra pressure on server.
- Most software specifically geared for Content Managment (CMS) are more complex than I need. Wordpress is fairly easy to use.
- There is a vast user base and long established community with support for most things you would need.
- Highly customisable and with a lot of community support for template editing.
- SEO friendly and search engines supposedly 'like' Wordpress.
- Support for caching and other memory saving stuff.

With regard to caching I was looking into this yesterday and thought you might find this useful. As you know the main eventual aim of any games site is to pull in decent traffic. The downside to this is that any high traffic site is going to eat up CPU and RAM leading to the server being killed and loss of profits due to downtime.

To help prevent this I read that using multiple layers of caching amongst other things dramatically helps. Caching basically means the user is redirected to a static page rather than sending a request to pull the content from the database which can heat things up. The only drawback is that your content becomes less dynamic. So if you want to get into dynamic instant user interaction etc. it may or may not really work out. I'm not sure. If you plan to keep things fairly simple however it will definitely be a massive help.

In summary its like this ranging from least complex to more complex (I'll include everything even if some may be a bit obvious):

- Try to avoid overcrowded servers. Mainly ones that advertise "unlimited bandwidth / unlimited web space". The more crowded the server the more vunerable it is to crash from high traffic. If you can afford it a decent VPS is ideal, then later moving up to a Dedicated when necessary. You can visit http://www.webhostingtalk.com where there is a lot of info on hosts and servers.

- Don't use too many plugins. Each plugin has to be loaded up. Only use what is necessary.

- Make sure to compress images and other media.

- If you're utilising RSS feeds in any way then Feedburner is supposed to be able to do some caching.

- Edit your template theme to replace unecessary PHP calls with static content. For example the title of the site will rarely change. And some things could easily be replaced with hardcoded direct text links rather than pulling the links info in. The location of your stylesheet for example amongst other things.

- For Wordpress use a caching plugin to help lessen the frontend load. Some Wordpress plugins include: WP Super Cache, Hyper Cache, 1 Blog Cacher and an upcoming Viper Cache.

- For the server using a PHP accelerator like eAccelerator or xCache is really effective. This most likely won't be possible on shared hosting. If your host can support it, then there is also a Wordpress plugin geared towards communicating with eAccelerator and xCache on the server:
http://neosmart.net/blog/2007/xcache-and-eaccelerator-wp-plugins-updated/

- Litespeed on the server also apparently helps. I do not know much about it. This may be something that many hosts already have on their servers. If not I believe it is not free and may need further looking into. Again probably not something you can request on a shared host.

With all of this it can help the load on the server by quite a large amount and can help to carry to strain of a burst of traffic.

Some extra items that may or may not help:
- Remove unecessary items from the dashboard:
http://wordpress.org/extend/plugins/wordpress-dashboard-editor/

- "The default WordPress install has the option turned off to pre-load all the option settings at once. If you turn it on, you'll probably drop the queries by a half-dozen or more. Try putting this into your wp-config.php and see what happens:
$wp->load_options = true;" by ck

- htaccess caching (may or may not be necessary after above)

- If you get so much high traffic that you start using multiple servers then WP-Offload plugin apparently redirects to caches on external servers.

- tcp read and write socket memory buffers (really not sure what this is about, maybe something to look into if you're still suffering after doing all the above)

- MySQL query cache (again something to try after all the above. I read it may slow down things slightly so it may depend on your needs as to if this is beneficial, I would read into it further before trying.

- You can really go the full hog and optomise every aspect of the server and whatever it is using (e.g. Apache etc.). I would reccomend seeking advice before doing so incase of damaging anything and probably as a last resort if the above doesn't help.

Again a lot of this stuff is mainly for VPS etc. rather than Shared.

I got a lot of this information and the quotes from the comments on:
http://www.codinghorror.com/blog/archives/001105.html

The only thing I'd be worried about is that there are some Digg users who like to 'test' Wordpress blogs by hammering them since they feel Wordpress is easy to bring down.
http://digg.com/programming/Let_s_Bring_Down_.....
Although those seem to usually be isolated vandalism incidents I think (mainly if anyone utters the word "I can now survive high traffic and/or Digg effect" they are signing their death wish. Search for "wordpress digg effect" on Digg).

Creation of a Flash arcade site using Wordpress

I am reading for a few days a tutorial about Building a WordPress games arcade on the FingerMonkey Flash Arcade Blog and although I won't follow his tutorial, I decided I will create my Flash arcade site using Wordpress, and once ready it will replace Triqui.com.

Moreover, I will made the WP Arcade capable of updating itself from MochiAds feed.

This first step is only an introduction about what I am going to do in order to have my Flash arcade site using Wordpress

Why WordPress?

This is the first question. Let me answer because WP rocks!

It's stable, robust, always up to date, easy to install, mantain and configure, SEO friendly, free, and fully customizable.

That's why I am using it... and I will create my own theme starting from the default Kubrick theme.

Why MochiAds?

I am using MochiAds feed because they update it very day, and because more and more developers are using MochiAds to monetize their games.

A quick and easy way to have a Flash arcade site that runs without any interaction from the administrator.

The less time I spend updating the site, the more I earn working on other projects (or the more I enjoy the beach!)

Ok, I'll use MochiAds feed. JSON or XML?

I am using the JSON one because it's lighter than XML one (today's JSON feed is 2.84 MB while the XML one is 6.57 MB).

What's JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format.
It is easy for humans to read and write. It is easy for machines to parse and generate.
It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.

JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.

These properties make JSON an ideal data-interchange language.

Read more information at JSON official site

Now let's see how a game like Jamag is coded inside MochiAds JSON feed:

CODE:
  1. {"rating": "Everyone", "updated": "2008-07-19", "popularity": null, "description": "Jamag = Just Another Mouse Avoider Game\r\n\r\nBut with something new...", "key_mappings": "", "height": 500, "game_url": "http://www.mochiads.com/games/jamag", "slug": "jamag", "tags": ["mouse", "avoid", "avoider"], "instructions": "Control the red circle with the mouse\r\nCollect purple circles, avoid blue ones\r\nEvery 10 circles collected there will be an explosion\r\nUse it to wipe away blue circles\r\nPress mouse button to activate bullet time\r\nThat's all... it's just another mouse avoider game...", "uuid": "89285254-78b1-3248-9db3-f5ab67ecc542", "author": "Triqui", "control_scheme": "{\"fire\": \"na\", \"jump\": \"na\", \"movement\": \"mouse\"}", "author_link": "http://mochiads.com/community/profile/Triqui", "feed_approval_created": "2008-05-17T14:32:26.644771-08:00", "name": "Jamag", "swf_url": "http://games.mochiads.com/c/g/jamag/jamag_secure.swf", "recommended": false, "thumbnail_url": "http://cdn.mochiads.com/c/g/jamag/_thumb_100x100.jpg", "created": "2008-05-17T12:00:43.262589-08:00", "categories": ["Action", "Other"], "game_tag": "5596fb87fd0f2de1", "leaderboard_enabled": true, "zip_url": "http://cdn.mochiads.com/c/g/jamag.zip", "width": 500}

Let' see the fields I am going to consider

rating: the rating of the game. It can be "Everyone", "Teen", "Mature" or "Adult only"

updated: unix date representing the last update

popularity: the popularity of the game. Seems to be null in every game, even the bloons series, so I won't consider it

description: the description of the game

key_mappings: keys used to play the game. I won't consider it

height: the height of the SWF in pixels

game_url: the url of the game, I won't consider it

slug: the slug of the game, I won't consider it

tags: the keywords of the game... very important since WP has a native tags support

instructions: instructions how to play the game

uuid: the unique MochiAds id of the game, I won't consider it

author: the name of the author of the game

control_scheme: how to control the game, I won't consider it

author_link: the link to MochiAds author page

feed_approval_created: when the game was added for distribution, I won't consider it

name: the name of the game

swf_url: the url of the swf

recommended: in my opinion is a boolean flag stating if the game is recommended by MochiAds or not, anyway I won't consider it

thumbnail_url: the url of the 100x100 thumbnail of the game

created: the date of the creation of the game, I won't consider it

categories: array with the categories of the game

game_tag: it should be another unique id representing the MochiAds code

leaderboard_enabled: boolean stating if the game has leaderboards

zip_url: url of the zip where to download the distribution package

width: the width of the game SWF, in pixels

Let's parse JSON feed!

Ok, let's do it. I have good and bad news for you.

Good news is php supports JSON decoding from version 5.2.0, bad news is php supports JSON decoding only from version 5.2.0

That's all at the moment... in next step we'll see how to populate a WP blog with MochiAds feed.

Next Page →