Javascrispt Game Development


Joined
Dec 1, 2006
Messages
948
Location
Scotland
Website
Visit site
Had a try at JavaScript game development and it's really straightforward. I used MousePad and Chromium along with some 'found' graphics and created a little test game using only my Pandora.

The game itself is really simple, just a tester. The main draw for me was dev-ing anywhere.

Ive included the source code (one big JS file - back to the Old Skool of game coding). Source isn't well commented (or written) but might be useful.

See it in action and download the source code HERE
 
Wow, not bad :) How long did that take you to hack together?

Tried it on Panda? I'll chekc your source .. curious what rendering style you're using.

I find js/css/html5/etc to be more or less a nightmare .. there is so much 'promise' (when they get it all sorted out, it will be almost great, excepting the worst syntax.. a syntax that makes perl people giddy), but instead we have .. SVG (may be supported by some browsers), Canvas (may be supported by some browsers, and doesnmt' even track object clicking like SVG does), and all the usual cross-browser pain. Trying to get something to work half-well and look good on iphone, Pandora, Android browsers, webOS and desktops .. its brutal.

js is a 'decent' language, but with css hacked in, and html4/5, and the brutal painful extensions that all mess with things, and the syntax out the window that will sometimes basicly 'compile' any random thing without feedback :) Man ... just thankful we have Firebug for FF, but the whole end to end dev cycle for js-games is basicly throwing away 30 years of progress and praying a lot; you don't even get logging/printing 3/4 of the time, so you just hit Refresh and pray .. and maybe have to restart the browser too.

A lot of games 'want' to be browser based now.. should be (like the game I'm working on), but I keep restarting the client .. js/css/etc just suck for multi9media right now (cross platform anyway) .. like if you want music, or opengl, or etc .. so do you go native, and rewrite it all in a few years? or make it a web app and fight like hell for each browser and pray it wonm't break a month later?

Drives me nuts.

That said, I'm converting my native-client to a webapp now, but it pains me so :)

jeff
 
Took 2 days to write - is really simple as you can see. It works fine on the Pandora in Chromium - not tried any other browser.

Rendering style? No idea - I'm just drawing to a canvas element :)

Yea, compiling without feedback is a pain. Just silently crashes or plain doesn't work. Spent an hour looking for a bug that was the old colon instead of semi-colon gem. The size of the Pandora screen doesn't make it any easier ;)
 
920 points, gets kinda crowded around that time :). Nice game :p

I've mentioned this somewhere already, but this is one I made in a few hours: http://bzar.iki.fi/files/ship.html.

I kinda like JS/HTML5 canvas because distribution and letting your friends try your new stuff out is so easy. Even if the actual game would be made in something else, prototyping in the browser has the advantage of wide immediate feedback. I'm currently working on a browser-based game (html5 canvas also) myself.
 
Your Asteroid game is really nice B-ZaR :)

I like JS/canvas for the same reasons and one more. I can now write games wherever I am with the Pandora. Probably have two projects on the go simultaneously now. One JS and one C++.

My pet hate with JavaScript games are the random slowdowns caused by things out-with your control. My first thought was 'it's because garbage collection is automatic' but in my, admittedly limited, experiments forcing garbage collection when things aren't time critical doesn't seem to help.

'Wars' looks interesting. Good luck with it :)

*edit* syntax
 
Tried it in all the browsers I have:

Arora : works well
Midori : didn't load (in fact fucked up Midori completely. Don't try this in Midori)
Firefox 3.6.1 : slow
Chromium : works well
 
I decided to do a second, nicer looking version. Doesn't play quite like that first one, because it's much higher resolution with smooth 30fps animation and stuff. It's almost ready (I recycled most of the code from the first one), but I'm too tired to get my vector math right (line segment collisions). Maybe I'll finish it tomorrow.

Just to be clear, these are very quick games of little complexity, but should work as nice, clean-ish examples and time killers. :)
 
Okay, it's not done, but it's playable. Not on a pandora though, because this one is a lot heavier on the cpu. I recommend a javascript-fast browser (like chromium).

Enjoy CanvasWorm 2!

This one has some nice basic vector collision testing (segment- and circle intersections) and uses more complex canvas features.

I know a couple of bugs in it (the tail is not always drawn full length at high speeds, no collision if turn exactly 180 degrees), but I think I'll leave it like that. It was a quick prototype after all :D . Also, it could use some actual framerate dependent movement, if you play it on a slow browser now it's easier because it doesn't go as fast.
 
Back
Top