August 20, 2005

AJAX web development

So I started a little web development project over the summer (will be released soon) and thought I'd write a little about it for fun.

It's the second incarnation of a small online game I wrote a few years back when I was first getting into server side web development. So firstly a little history lesson:

When I got my first taste of web development I quickly became interested in making more than just static web pages, at the time all I knew was javascript. I would follow the tutorials in my favourite PC mag, PC Plus, and try do clever little things like making a popup window and populating it with some pretty html. However I was constantly running up against a wall, I needed server side scripting!
I read about this thing called ASP, and started to try doing things with it, quickly I had a database connected and a simple user authentication system set up. These things were really cool, there's nothing quite like the feeling of creation.
Then, my favourite online game of the time, Planetarion, went to a pay-only business model. My friends and I were distraught! I thought I could do a better job though, with my knowledge of some ASP I was convinced that I could improve on Planetarion.
The Last Hope was born, a play on 'A New Hope' as it was originally to be a star trek vs star wars game, but it quickly evolved into something else, just two fictional races at war.
Development was slow as I only had limited spare time, and doing things in ASP quickly turned into a right bitch. My original pages were slow, difficult to follow and used bad coding techniques. My later pages were much faster, expandable and more secure. Crowning achievement of TLH was the 'ticker', which actually makes the game work, it adds resources, works out battles etc, it was originally written in vbASP, but that quickly became a nightmare, so it was written in jsASP which is so much better. My advice, never ever use vbASP, use jsASP all servers support it and it features more advanced language features, not to metion a proper syntax (see my other blog entry). Back to the ticker, it stood at over 1600 lines of code, all streamlined so it ran very quickly, it worked almost perfectly first time too.

That was really the end of TLH active development, I lost interest in the game and when someone offered to buy the code for their own game, I sold. So TLH lives on as 'Planetwars', which from time to time I have to update and fix bugs in the code, which kinda sucks, since the code is mostly horrible and reminds me of how badly I used to code. But I've always wanted to follow up TLH with a new game, with more features and more gameplay elements. So,

TLH2 was born, I decided that games like this are at there best when you have to play with others against others that are also playing together. In TLH this was enforced by alliances, galaxies of planets and the two races, in TLH2 I will take a different tack. Players will control one of several colonies on a planet, so you will share a planet with others, and you will need to work together to do well in the game. There are a lot of gameplay features that I plan, but I'll save those for another entry, but the biggest change in THL2 is the user interface.

I decided to implement TLH2's UI using AJAX (hate that term) basically instead of reloading the entire page when a user wants to do something, I use javascript to call a behind the scenes XMLHttpRequest object, this returns data from the server, which is then parsed by more javascript and the client side is updated accordingly. The system took a while to build but now it's there actual development is really quick, you don't have to create new pages everytime, with new request hadling code, you just add a few new functions and some new case statements, and you're done!

The benefits are that its much faster on the front end, the entire page doesn't have to be reloaded and so less rendering has to be carried out by the browser, also the bandwidth savings are immense.

Anyways I plan to blog more about this, maybe someone will be interested.


- No comments Not publicly viewable


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

August 2005

Mo Tu We Th Fr Sa Su
|  Today  | Sep
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31            

Search this blog

Tags

Not signed in
Sign in

Powered by BlogBuilder
© MMXXII