Archive: July, 2011

Just Finished the AskMDN Session

For those of you who missed it, we had the first AskMDN (Ask Mozilla Developer Network) Q&A session on HTML5 and JavaScript Game Development and Mozilla invited me to participate as an expert in web-based game engines. You can check out the questions and answers over on Twitter by looking up the hashtag #askmdn.

It was a great session and an awesome chance to meet some other experts in my field and reconnect with some whom I’ve already had a chance to chat with before. There were tons of questions and only an hour to write some answers. I think for any future sessions we all agreed that it should go on for much longer. Rob Hawkes (@robhawkes) who was managing the session from Mozilla’s side is going to put up the Q&A plus all the questions that we didn’t get time to respond to so perhaps we can go back and answer those in our own time via their blog.

For anyone who had questions and didn’t get an answer directly and would like to have a response, I am happy to answer any questions here if you care to ask them.

Thanks to Mozilla for organising the event and to my other co-experts who took their time to write some answers!

See you all at onGameStart this September!

 

Old Screenys of a 3D Game I Made a Long Time Ago

Hi all,

I was rummaging around in an old hard drive and found some old screenshots of a 3D space game I was writing years ago. Thought I’d share them with you so they are preserved for the future… I can look back in wonder at my terribly designed space stations lol.

P.S. if anyone wants the code I might be able to dig it up! LOL

 

Node.js Domain to Host:Port Router

Hi all,

I’ve created a router in Node.js that will take a domain mapping table and automatically route connections from the domain to the host and port specified by the mapping data.

This allows a single server to run multiple listeners on different ports and route different domain names to those ports.

Consider an example where you have a domain name with all sub-domains pointing to the same IP address via an A record such as *.isogenicengine.com => 50.16.209.235

Whenever we set up a new user account for hosting, our router can allow the user to select a new sub-domain and then we modify our configuration to map the new sub-domain to a Node.js instance that we’ve just fired up on a new port. The router automatically detects the change in configuration and loads the new data into the mapping table without closing any connections or restarting itself.

You can check out the router over at github or clone it: https://github.com/coolbloke1324/node-irrelon-router

If you like this project, Flattr it! http://bit.ly/qStA2P

 

jQuery Client-Side Language Translation Plugin

Hey all,

I’ve put together a jQuery plugin that allows client-side content translation based upon a phrasebook. This works instantly without having to call server-side code or use Google Translate (where results are variable and can take time to process).

Example page: http://www.isogenicengine.com/jquery-lang-js/

Obviously this is most useful if you know someone who can do the translations perfectly for you! If not you can still use Google Translate and enter the results it gives you. This way your users don’t ever have to wait for translations.

In my app, I save the user’s language so that I can deliver the exact language pack to them rather than making their browser download all of them. It means I can write all my content in English and it automatically changes based upon the user’s default language. Woohoo!

You can get the repo over here: https://github.com/coolbloke1324/jquery-lang-js

If you like it, Flattr it!

Flattr this

 

Licensing Changes, Store Purchases and Beta

Hi all,

Some of you may notice that the Store currently only lists the graphics pack for sale and no other product including our beta engine licenses.

We are currently reviewing licenses and our model is changing. With this in mind we have suspended sales of the engine until these changes have been made.

Users who have already purchased a license can continue under their current terms and we will honour those terms going forward however no new licenses will be sold under those terms.

When we have more information about the new licensing model we will let you know via this blog and Twitter.

All the best!

 

Why Developing with Chrome Kicks Bottom & Firefox Has Lost It’s Way

Lovin’ The ‘fox

As many of you will know I am a keen web developer and love to play with new technology. When Google Chrome first came out I was a bit hesitant to jump ship from my beloved Firefox to a brand new and pretty much untested platform for a number of reasons such as plugin availability, customisation, sheer love of the ‘fox etc. Firefox had it all, the swanky plugins that made my life easier like AdBlock, the awesome themes like Noia and best of all I could feel smug in the knowledge that other lesser web users were still “surfing” the net with crumby IE – so really they were “boogie-boarding in virus-ridden sewerage” at best.

Fast = Shiny and Nothing is as Shiny as Chrome

I cannot use the web without AdBlock because I *HATE ADVERTS THAT MUCH* so it wasn’t until Chrome started getting plugin support that I finally decided to check it out. There was this bare-bones browser window with none of my usual menus or buttons and my first reaction was “Hey, where’s all my stuff? I don’t like this!”. I think it was about version 4 that I started to use Chrome.

What drew me in and kept me using Chrome for browsing was the speed at which it launched and the speed at which websites were rendered in comparison to Firefox. They were fast, I mean REALLY fast. By comparison Firefox just seemed to get slower and slower. Starting up Firefox was becoming a long drawn-out process and on some computers I’ve seen it take so long you could actually make a cup of coffee whilst it loads. Whilst I doubt that in the coffee case it was actually Firefox that was causing the problem, Chrome did not suffer so badly even on that steaming heap of a computer.

I’m currently running a solid-state drive that actually uses RAM to store the HD content. This is used as my boot drive and a place to store frequent use apps (such as web-browsers). My drive C is only 32GB because that was all I could afford; at the time 32GB in 8x4GB sticks was about £1,500. This makes my drive C excessively fast. Even with this in place, Firefox still takes 2.5 seconds to load, whereas Chrome appears instantly (yes I mean blink-of-an-eye instant).

On top of this, it had all the great tools that developers need to write web applications like an element inspector and a JavaScript debugger mirroring the Firefox Firebug plugin in many ways. This leads me nicely onto the reason that Chrome out-does every other browser out there right now… the V8.

V8 Rules the World

V8 is like a dream-come-true for web developers. It is very fast, stable and super-easy to use. It makes stuff that used to crash IE (such as iterating through millions of array items) run so fast that it feels like you can finally spend more time coding to achieve something than you do trying to optimise it. Obviously we don’t live in a web-utopia where everyone is using the most up-to-date modern powerhouse browser so there still has to be some trade-off, but some polite reminders in each app you write informing your users that they are using a sucky browser really will go a long way to converting the millions of users still living in the browser dark ages. It is SHAMEFUL to see that the UK still has a 2.6% usage of IE6. Urrgh!

Most webdevs won’t ever look but V8 also has very cool capabilities under the hood that make it a fantastic choice for other JS-enabled apps. If you want to implement your own JavaScript driven application you can just create new JS methods that make calls right back to your native code and BAM you’ve got an app that anyone with web-skills can script in and that makes for some very interesting use cases! Imagine JS-driven robots where your JS scripts control IO from an IC… hmm.

Anyway back in the real world, V8 is used in lots of cool places outside of Chrome such as Node.js and the Android OS. Expect to see it popping up all over the place!

So Firefox Sucks Then?

Firefox DOES NOT SUCK. It is one of the greatest browsers ever made and the folks at Mozilla are truely the main reason why we have a functioning world-wide-web today. Imagine a web where apps were slow, where everything you did that you needed realtime response from had to be an ActiveX object, where Flash could crash and all your other browser windows would crash with it. That is how the web would be today if Mozilla hadn’t challenged Microsoft to put an end to their train-wreck of a browser.

BUT… much like IE, Firefox has become more bloated and slower over time which is a real shame. Honestly a lot of what Firefox offers is great but it seems that Chrome can do it WAY faster.

I know that Mozilla is reacting to this criticism and has committed to releasing faster iterations of their browser and I believe I read somewhere that they are working to make it load faster too. I hope they do! I started loving the web when Firefox came along, saw the movie, spread the word, even bought a T-Shirt but for now, Chrome is king.

 

Facebook Integration!

So along with all the other stuff that we’ve been working away on, today I can announce that a new Facebook module will be released in the evening of Wednesday 13th (that’s probably today in a lot of time-zones). The module brings with it a lot of fun new features that allow you to do stuff like log users in via Facebook, post on their walls and invite their friends to play your game.

You can check out the lowdown here and see the documentation for the module here (subject to addition and change before module release).

 

Migrating to Socket.io 0.7 – Bumps Along the Road

So I decided to take the plunge and re-write my networking code that was working perfectly in Socket.io 0.6 and migrate it to 0.7. Here are some of the bumps along the road that I had to drive over and the way I solved them. They may not be perfect or the “standard” way… I don’t really know… all I know is that the 0.7 docs are pretty sparse so doing anything beyond sending simple messages becomes a source-code hunt with your favourite find-all command!

PS, There is a migration guide that will help you somewhat here: https://github.com/LearnBoost/Socket.IO/wiki/Migrating-0.6-to-0.7 which includes some of the things I’ve discussed here.

Starting Up & Hooking Events

In my 0.6 implementation, I would start Socket.io like this, then listen for the events I wanted (server-side):

var io = require('socket.io');
this.socket = io.listen(myServer);
 
this.socket.on('connection', this.bind(this._connect));
this.socket.on('clientDisconnect', this.bind(this._disconnect));
this.socket.on('clientMessage', this.bind(this._receive));

In 0.7 it’s slightly different – keep in mind that I’m running this inside a class that has access to some methods like this.bind that your code may not have / need:

var io = require('socket.io');
this.socket = io.listen(myServer);
 
this.socket.sockets.on('connection', this.bind(this._connect));
//this.socket.sockets.on('clientDisconnect', this.bind(this._disconnect));
//this.socket.sockets.on('clientMessage', this.bind(this._receive)); // AFAIK you cannot listen for all messages globally like this anymore which really sucks!

Sending Data

In the latest version of our engine, we’re using BiSON.js to encode our network data. When I tried to send a message first time round, no error was displayed on the server but the client just didn’t get any message. After some digging around I found that instead of the original 0.6 code of:

this.socket.send(finalPacketData);

I needed to use:

this.socket.sockets.json.send(finalPacketData);

This was a little frustrating to work out because I tried:

this.socket.sockets.send(finalPacketData);

There were no errors being displayed but no messages getting to the client either! After some heavy console.log lines I got it working. The important bit in there is the .json.send. I didn’t think I needed to use .json but without it, the message never gets received.

Client Session ID

In the new documentation, it says that you get the session id like this:

// v0.6.x
var sid = socket.sessionId;
 
// v0.7.x
var sid = socket.id;

This works server-side when you want the id of the connected client but client-side, I found that I still had to use:

this.sessionId = this.socket.socket.sessionid;

Getting the Client IP Address

I have fixed a bug in Socket.io and submitted it to github so that LearnBoost can pull the change into their source. The client IP should be stored in client.handshake.address as so:

this.socket.sockets.on('connection', this.bind(this._connect));
 
_connect = function (client) {
	console.log('Client connected from IP ' + client.handshake.address);
}

To get this value correctly, I modified socket.io/lib/manager.js:816 from:

connectionAddress = data.request.connection.address();

To:

connectionAddress = data.request.connection.remoteAddress;

I spoke to 3rdEden on twitter about this and my change breaks the test suite for socket.io… it works in my project but those guys are the authority on it so once they’ve updated the code, you should pull a new version from them. The code above will work for you in the time-being though as far as I know! (Works for me!)

Questions? Comments? Drop them below!

 

Irrelon Software Store Goes Live

The Store is now live and you can check out our first game graphics pack for sale now! The store will grow over the coming months as more game art, engine licenses, engine modules and sounds are made available. Our engine beta users are hard at work putting together various extension modules for the engine that will augment or enhance the engine with new functionality, whilst our artists are dreaming up new high-quality game graphics packs!

Our graphics packs are exclusive to the Irrelon Software Store so they cannot be found elsewhere and each graphic is hand-crafted by one of our in-house artists and designed to work with the Isogenic Game Engine. Graphics packs are available as either an archive of PNG files or the original Adobe Illustrator files. The Illustrator files will allow you to make modifications to the graphics yourself, or if you just want some ready-built artwork for your game, you can purchase the PNGs.

If you are an artist or sound creator and would like your work to go on sale in our store, you can email us at [email protected] for excellent rates and ultra-fast payouts.