Does your game need Javascript?

Ajax is defined as ‘Asynchronous Javascript And XML’, and is used to allow pages to update small pieces of themselves, without needing to refresh the page. But does your game need it?

While most developers have been eager to adopt Ajax and build it into any(and sometimes all) of their projects, the core of the matter is that you don’t really need it, and you shouldn’t worry about it until later.

There are a few reasons for this:

Users with Javascript turned off

According to browser stats from the W3C, as of January 2008 95% of their visitors had Javascript enabled – but what about the other 5%? If you don’t make sure to build the parts of your game that are Javascript-driven in such a way that they will also be available to users who don’t have Javascript turned on, you’ve effectively killed your game in their eyes – users with Javascript disabled will think that it’s broken.

And don’t think that you can just have a boilerplate disclaimer that says “you need to be using Javascript to use this site” – some users might be accessing your game in a situation where a network or systems administrator has told them to absolutely under no condition enable Javascript. It sounds strange, but it happens.

Browser Incompatabilities

While this can be solved with extensive debugging, if you don’t use Javascript, you’ll never encounter a problem with how your game behaves from browser-to-browser – and there will never be strange Javascript errors that you need to debug. It will all just work!

Javascript for Javascript’s sake

Some developers tend to go overboard when they first learn about Ajax, and start adding it to everything – instead of having a link to a page in a situation where a link to a page would be ideal, they write complicated Ajax wrappers to load the page and display it. This is a clear case of too much Javascript, and it will frustrate your users.


At the end of the day, whether you use Javascript/Ajax in your game or not is completely up to you – but carefully consider any decision that results in adding Javascript – will it improve the user’s experience? Will the feature still work as intended for users with Javascript disabled? Both are important questions you need to ask and answer before you write one line of Javascript for your game. Doesn’t matter how cool your game is.

Wish there was more?

I'm considering writing an ebook - click here.

.

Luke is the primary editor of Building Browsergames, and has written a large portion of the articles that you read here. He generally has no idea what to say when asked to write about himself in the third person.

Thursday, May 15th, 2008 design, frustrations, interface
blog comments powered by Disqus

About

Building Browsergames is a blog about browsergames(also known as PBBG's). It's geared towards the beginner to intermediate developer who has an interest in building their own browsergame.

Sponsors

Got Something to Say?

Send an e-mail to luke@buildingbrowsergames.com, or get in touch through Twitter at http://twitter.com/bbrowsergames