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:

{"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 100×100 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.

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

214 GAME PROTOTYPES EXPLAINED WITH SOURCE CODE
// 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
// 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