Debugging is like farting — it’s not so bad when it’s your own code.

The Big Red Button Game

Posted: February 15th, 2011 | Author: | Filed under: Projects | No Comments »
Big Red button

Big Red button

Alright, this isn’t really a full-fledged project so much as an experiment with technologies. I was contracted to construct a Facebook game The tool of choice was Unity3D, and it was to be a web-based game. As with all public-facing projects, it always pays to know exactly what happens when you hit that publish button and release it to the wolves. Hence, I created this nonsense game and launched it, just to see what would happen.

As for what it is, there’s a big red button on the screen. When you press it, you win the game. I’m sure I can make up some philosophical BS  about it given enough time. It has a high score table, and is integrated with Facebook, using the API to grab both the user details, as well as post personal best high scores to their wall.

Unity 3D

Unity was chosen because the proposed ‘other’ game was to comprise of both 2D and 3D components. It was uncertain if it would later extend to other platforms. Also, the development period was rather short, encouraging the use of rapid development tools.

From my previous rants on Unity, you can probably tell I am not a big fan.  I would probably still recommend it for project teams that are artist heavy and programmer light, but generally demur from using it myself.  However, this time I bit the bullet and gave it a go.

Developing a web app is easy. Just set a target in the build settings and say what size you want the window to be and voila! Automagic! In fact, most things are like that. The UI system was pretty ugly, but I spent some of the project budget on SpriteManager 2 and EZGui which significantly increased the automagicalness.  All the dragging and dropping somewhat irked me and made me feel unclean, but that’s just me. In truth, it was quite easy to use.

The editors, UniSciTE on Windows and Unitron on Mac, were considerably underwhelming. I ended up going back to my full-screen Vim which I love so much. However, every now and then, I’d accidentally double-click a script and the editor would jump out in my face as if it were Halloween. An integrated text editor would do wonders for a product like this.

Communication between the Unity web-app and its home web page scripts was fairly straightforward. Communication and fetching other web resources via PHP scripts was equally  easy. The unfortunate thing is that a built-in security “feature” prevents you from loading pages that are not in your domain. Which means that if my PHP scripts are on my web server, I can’t access them from a local build but have to either upload the build to server or install PHP and Apache and whatever else on my local machine, which is decidedly not cool.

One other thing is that the Mac build of Unity is significantly less polished and clunkier than the Windows build. Importing of assets takes longer. Certain windows seem to lose their graphical context until you grab the window and drag it around the screen. Also there are slight differences in workflow. (e.g. You can’t name the webplayer object when you build it under Mac Unity, but you can under Windows) It’s almost as if Unity has two teams. They put the ‘A’ team on the Windows build and the ‘B’ team on the Mac build, gave them the same specifications and let them develop independently.

Facebook API

The Facebook API has changed considerably since I last used it scarcely more than a year ago. You no longer have to put weird strings in the Application settings. Instead you can access all the functionality through their Graph API. Feed your query to the specified URL and things just happen! It also comes with JSON support, if that is your thing.

However, I had to give up on quite a bit of scripting because the Unity web player appears to render on top of everything, no matter what fancy CSS tricks you play. In the end, simplicity wins.

The tools that Facebook provides includes statistical information (they call it ‘Insights’) which gives you a rough idea of how many people are playing the game,  the number ‘likes’ you are getting, and the volume of comments.

One unfortunate thing is that there are actually 2 pages for each Facebook app. One is the actual application page where you can play the game. The other is some sort of fan page for posting comments, news updates and the like. A big mistake I made was promoting the fan page rather than the actual app page.


Unity is certainly a viable platform for developing Facebook games. Facebook and server integration are relatively simple, and there is a high degree of automation. Webplayer installation is seamless for the most part. SpriteManager 2 and EZGui are must-haves for any sort of 2D or UI work. If your programming team is small and in numbers not very experienced in general development, this is the ideal engine to use.

The final ‘game’ can be found here.

Leave a Reply