Friday, February 12th, 2010
Here's a question I was pondering a couple of days ago: Can you make JavaScript's String object mutable, as in modifiable without having to re-assign the string.
Why would this be useful? Sometimes you might share a string between objects, and you'd want changing it in one place get reflected in ...
Posted in Programming | 2 Comments »
Thursday, January 7th, 2010
As I've been rewriting TankWar, I've been thinking of various approaches to displaying the game's graphics. At the moment, I can count three feasible approaches for rendering game graphics:
DHTML - In other words, using divs with images and moving them around
Canvas
A hybrid: Canvas with DHTML
I've considered each of these, and ...
Posted in general | 4 Comments »
Wednesday, December 16th, 2009
I have decided to rewrite TankWar, and I'll be writing a bunch of blog posts about the process. If you ever wanted to know how to write a scorched earth/worms-like game using just JavaScript, now is your chance to learn ;)
This is the first one: Assessing the damage. In other ...
Posted in Programming | 3 Comments »
Wednesday, December 2nd, 2009
You may recall an earlier post about TankWar, my 100% JavaScript cannons-game. Back when I wrote it, I included online play, but the server went down with a hard disk failure.
Now, I have rewritten the online mode - this time that part is also all JavaScript - continue reading to ...
Posted in Web | 5 Comments »
Friday, November 27th, 2009
Hey it's Friday so it's time to try a fun JavaScript hack - Let's go and precompile some functions!
What does "precompiling" mean? In principle, it means we take a function which takes multiple parameters and pre-define some of them. All this is done dynamically, so your code can do it ...
Posted in Programming | 1 Comment »
Friday, August 21st, 2009
Have you ever thought about writing a game? If you have, you've probably wondered how to render animations for your game characters. In this post, I'll show you how you can use JavaScript to do time-based sprite animations, drawing them on canvas - vital if you want to do a ...
Posted in Programming | 5 Comments »
Tuesday, August 4th, 2009
I've recently been looking into some JavaScript unit testing frameworks. There are many alternatives, and while many of them seem good, very few of them actually matched my requirements:
Must be able to run tests from the commend-line
Tests should be relatively easy to write
Posted in Programming | 4 Comments »
Saturday, August 1st, 2009
Have you ever filled a textarea on a page, which had a limit to how many characters you could type into it? Or maybe you are a Twitter user, and as you know, Twitter only displays 140 characters of your tweets.
(Not an actual textarea) The other day I was thinking ...
Posted in Programming | 1 Comment »
Tuesday, July 14th, 2009
Firstly I'd just like to let you know that the lack of posts lately is because I have a new full time job which I'm enjoying quite much so far, but it still means I have less time / motivation to write stuff. The unit testing series and other postings ...
Posted in Web | 4 Comments »
Tuesday, June 30th, 2009
Back in late 2006 I wrote my most ambitious JavaScript/game project so far: TankWar Online, which as you may guess from the name was about tanks, shooting stuff, and it had a real-time online game mode - as far as I know, the first such ever in a JS based ...
Posted in Web | 8 Comments »