I’ve recently worked on a pretty interesting project and thought perhaps I could share some of the processes.

Before I continue, a slight digression, I need to outline these 3 important components that in every digital creative production must have, which are time, scalability, and optimisation. I will explain those components succinctly.

Time
Time is money, in a simplified instance perhaps it can be explained if you had project A, then you need to consider the production cost, for an agency it can be salaries, operational costs, tax, etc. and lastly you need a bit of margin to keep you cash-flow positive or perhaps for any miscalculation that may happen, so ultimately the shorter the time you spend on your production the more efficient the cost will be.
Although in can get complicated since shorter time means lower quality and in a competitive environment this will affect your business, and if I might add this condition does not apply, but I will reserve that discussion for another time.

Scalability
Idea and creativity are malleable, if you were working with complicated projects or difficult clients, the approval process can be a bit tedious or bureaucratic.
There ways to approach this systematically, one of which is managing the client expectations or using the design sprint methodology, but the least minimum approach is having a framework that can scale or reusable.

Optimisation
Optimisation is a hard thing to achieve, even large tech companies often had catastrophes and in digital agencies, you certainly cannot dedicate your undivided attention to the matter, but at the least is to have the minimum viable product.

But what is minimum can be a fickle thing, this will dependent on the product. A website and live installation projects will have different priorities, even certain client expectation can also become a factor.

Since now we have a clear topic confinement, let’s continue.

What’s the Concept
In short, it’s an online game site, where the goal is to find the hidden protagonist, sort of like Where’s Wally, and they can interact with the game by swiping or using the device orientation.

There’ll be several scenes variations where she’ll be hidden.

Production Flow
Let’s start with the production flow, have a look at the diagram below;

Building the Stage
The focal point is the stage, any changes to it will mostly affect the site, it needs a system where the it can be designed and modified in an instant.

Fortunately, Photoshop has script functionality plus (I’ve posted a blog a long time ago) the designer can use it with ease, now have a look at the diagram below.

This how the layers are laid out, the pink circles are the character or clickable object and cuts are the map, once the images have been exported the subsequent steps is to extract its information into the following JSON.

The “document” key holds the entire stage dimensions, the “layers” key holds the graphic components information, this will then be processed and calculated in Javascript.

Consolidating the Assets
The last point is to consolidate all assets into one giant JSON, the purpose of this step is simply asset management and convenience, each asset will be loaded and utilized according to its purpose.

For instance, stage A will consist of certain images or audio that aren’t included on another stage.

A slight detour here just wanted to talk about WordPress development —not actually cutting edge— but since I’ve been working on a few WordPressprojects lately I thought I’d share some of my tips, plus remember if you’re good at WordPress you could make a decent amount of ¥¥¥.

Prerequisites
This is my enviroment.

Mac OSX v10.11.3 (El Capitan)

Homebrew 0.9.5

Docker 1.9.0

Docker Kitematic 0.9.3

Choosing the right Template
There are myriads of templates out there with varying difficulties.

Most of them are already using the Gulp/Grunt combination so if you’re unfamiliar with it then get cracking.

Using Docker for Development Environment
The zeitgeist! Docker can be seen in every corner at the moment and you can integrate it with any type of application and it’s easy, I had the Tensorflow set up within minutes, although there are a few quirks in using Docker and Kitematic so I recommend you to delve more since you’d be able to debug your environment lest something happens.

The first thing you have to do is download Docker Toolbox and Kitematic, you can go to their website and download it like when Windows 95 was still around or use brew cask.

$ brew cask install dockertoolbox
$ brew cask install kitematic

And afterward, just start Kinematic up! you’ll immediately be presented with this window.

Lovely UI isn’t, this is what sold me the first time!

Now that you have everything up and running, the next thing you need to do is to create the docker-compose.yml, start by opening up the CLI (at the bottom left) and type in the code below.

$ mkdir wordpress
$ cd wordpress
$ vi docker-compose.yml

And paste this code, I’ve added a very generic comment, again Docker is a broad topic so try to read their website.

And then build the container;

$ docker-compose -d

Once everything has been built, go to the Kitematic window and you’ll see the WordPress container listed, click the setting tab and then Ports, where you’ll find the IP address, click that and it’ll automatically open the WordPress site.

Once you finished you can click the stop button on the Kitematic window or start to initiate it.

Other Environments
There are alternatives besides Docker that you can choose the easiest one would be MAMP (A slight warning there’re a few system conflicts on El Capitan), another one would be Trellis which is based on Vagrant or if you’re adventurous you could install Centos and, of course, El Capitan comes with its own apache server.

Ajax Page Transition
The fun part in developing WordPress —well, relatively speaking— would be avoiding all the plugins peril, since a copious amount of it will bog down your site.

There are a lot of websites that talks about building your own plugin, but something that compelled me was Ajax Page Transition since you could create an uninterrupted experience plus is super-cool. (Some of you would probably snigger in disgust right now)

Before I start I need to remind you that the proper way to handle AJAX in WordPress is to use; register, enqueue and localize the JavaScript files using wp_enqueue_scripts instead of wp_print_scripts.

The system can be achieved with a simple Ajax and a hint of History API, have a look at the diagram below;

It’s pretty simple isn’t! Onwards with the code.

First, you need to structure the template accordingly so it’ll be easier to extract and/or overwrite the content later, like so;

<body>
<!-- The content div would be used as a container -->
<div id="content">
<h1>About Us</h1>
<p>Lorem ipsum..</p>
</div>
</body>

Second, to change the URL path without refreshing the browser, utilize the history data.

// when the back button is pressed, each recorded history will be removed
// this listener will listen to that event
window.onpopstate = function(event) {
// Update whatever you have on the page
updatePage();
}
// This is just to illustrate the function
function callPage(url, pageData) {
// If you're using old browser don't forget to add a fallback
history.pushState(pageData, pageData.title, url);
}
// Trigger this method through button click
callPage("/about/", { item: { title: "About us" } });

There’s not much to it, you can read it more here if you want and if you need a fallback you can use history.js.

Conclusion
When working with WordPress the first thing that you always need to consider is the security aspect, its ubiquitousness attracts hacks, always follow the best practice (not guaranteed), learn about the basic security hacks, implement re-captcha, update the WordPress constantly, etc.

Another note also WordPress is notorious for its sluggishness but then again there is a trade-off that can be had, huge communities, endless plugins (but don’t use it too much), is great for obnoxious client 🙂 , but if speed is what you after then I suggest you try Amplify or Ghost.

I was intrigued by it when I first saw Gravity, their whole system seemed robust, so one thing leads to the other we ended up using it for a real project, I had to learn everything from the beginning, up to the actual project launch in 3 weeks time which was surprisingly easy to do.

Their system is similar with Quartz Composer if anybody still remember it that is.. there are 2 languages that you can use Python and TScript, obviously Python was the best choice because you can use common Python libraries.

It can seamlessly runs with almost any version of GLSL and on top of that you can throw in audio stream, OSC, Kinect, Arduino, Oculus, integrate it with redis or nodeJS or OpenCV and have a super-complex system that runs in real-time and yet -depending on how your code is- it will still chugs along without any problem.

Creating your own project while having a regular day job + family is pretty hectic, but it’s finally done, go here to download and to read the entire development click here. As for now its only work on iPhone.

It took me roughly 6 months to design, develop, debug, and optimize and had 1 pivot in the middle.

Concept

During the usual long night work and in the midst of the threes fad, I was allured by seemingly large profit (although mine isn’t very successful) and something that I could do whilst I’m working, thus the +Minus concept was conceived.

In a nutshell it just something that when a number meets another number it’ll add/subtract according to its value, I’m not sure whether somebody had done it before, but the idea seemed novel and simple enough at the time, hence I pushed forward.

Feature Creep

In the beginning, there was the dreaded feature creep, below are just some of the features I have had thought of.

Ancillary
Other extra ideas;
– Along the way, there will be Gods where you have to pass dowry to him.
– Also, the Gods will have demi-gods/minions that’ll eat the coin and return positive number or spit out another coin that resulted in negative
– Magic block(s), so basically when you stepped on it, it’ll do wonder. (teleportation, etc.)

Periodical bonus
I was thinking of having a bonus that occurs periodically during the game.
– It’ll remove 1 point off
– It’ll teleport you to a random place

Triggered bonuses
– It’ll add 1 point to the stack

Miscellaneous
– Enemy can be sedated for a period
– Wildcard coins!
– Teleport cards
– Bonus need to be bought
– Money/coins have to be earn through level completion

In the end, with all the limited time I had doing the entire features were impossible hence I had to scrape most of it and just launch the minimum viable product.

Development

In development time, I had had struggled with a few entanglement mainly on the platform and the game mechanics.

Coding Platform

There are myriad of platforms to choose from that exist within the World Wide Web, at first I chose Cocos2D-x because back then I was playing with Badland and I was compelled by their amazing graphics and stable FPS, so I thought to myself maybe this is the right platform.

Scouring through their blogs and internet, it looks sound, robust and flexible.

But I was wrong, C++ multithreading is really difficult and the fact that debugging in C++ is somewhat vague not to mention the long compile time, just made everything ultra-frustrating, hence almost half way through I dropped the whole thing.

Adding my own shaders had proven very challenging, is not as straight forward as I thought it would be, adding more vertices had made Cocos2D-x leaked all over the place.

So after awhile I dropped it and recode the entire thing in Adobe Air, which proves quite satisfying.

Game Mechanics

This was my biggest mistake ever, proceeding without testing the gameplay to the public.

At first the game was supposed to be a puzzle style game, so I built all the algorithm for that, path-finding, enemy AIs, procedurally generated dungeons, etc.

I’ve had spent quite a lot on those parts, but when I showed it to my wife and daughter, they were perplexed by it, the gameplay was unappealing.

So I pivoted! I created a new game mechanics and test it to the public first before I create the details, I showed it to some of my friends and the responses were quite good, not perfect, but then I really don’t have the time to delve deeper.

So this the rough prototype, pardon the bahasa, but basically it’s saying
– Combining a large number with a small number will result in subtraction.
– Combining a small number with a large number will result in addition.
– Equal numbers will result in 0.
– The goal is that all blocks need to disappear.

Monetization

As any developer out there, the lure of materialistic gain was always the main drive, but after a moment of contemplation I have realized that my title hadn’t had that addictive component just like threes have had, so I’ve decided to make it free and use ads.

There are a lot of platforms for ads that you can choose from and each one has it’s advantageous, and most developers chose to use multi-platform ads that can automatically switch itself depending on the ad availability, but doing so requires a bit of a time to set up.

After some research and experiments, I chose Chartboost, their API is relatively easy to adapt, it supports multi-languages, you can skip the taxation form (just to see if everything work), and everything works just as its advertised.

There are other things that I could describe the monetization process and/or strategy, but I’ll continue on other post.

Conclusion

The hardest part in producing a game is finding the right amount of fun to your gameplay and marketing, the latter will dependant on your time, budget, location, extrapersonal skills, and luck, which unfortunately I only have 2% of each trait.

Special Thanks

For the impatient check out the source code and might I warn you that I use iOS 8.0 APIs.

I’ve been watching WWDC 2014 lately and one of the most interesting talk was about Indoor Positioning, the potential is amazing .. or super-annoying :D, sort of like a heat-seeking pop-up ad that follows you around, and of course iOS8 offers a few ways to lessen the pain such as the “What’s near me” app store.

Although is not yet available but I thought it’ll be fun to at least have the basic function running, using CoreLocation is pretty straightforward, the only caveat for iOS8 is;

The NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription are mandatory, you need to provide something that will make sense to the user.

Resources

Long story short, establishing OpenGL ES 2.0 is slightly different than WebGL, but the basic principle is similar.

Cocos2d-x provides you with a few ..uh, inconvenient wrappers.. that can help you started with custom shaders but if you don’t have the knowledge in everything that is OpenGL it can get a bit hectic, plus it’s hard to find a good reference.

OpenGL is a gigantic topic so I’ll explain just the basic parts (plus I’m not an expert as well) so hopefully the below will helps you a bit.

F

What glVertexAttribPointer does it retrieves the vertices from the buffer objects, so we need to tell it how to process those data, in order to understand it have a look at this interleaved array basics explanation.

glDrawArrays(GL_TRIANGLES, 0, 3); draws the primitives, there are 3 types of primitives which are Triangle, Lines, and Points, each one has its own types, again explaining those things in detail can have your mind tangled after a while, but in a nutshell GL_TRIANGLES simply means drawing 1 triangle by 3 given vertex (n/3).

ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); basically just enables the Vertex attribute array, although why does it need to be defined explicitly is a bit puzzling.