News for hackers. Stuff that matters.

Ask HN: Any javascript game libraries?

I'm trying to develop a browser based 2D game with top view. I've been trying out javascript game libraries.

I found a jquery plugin called gameQuery but doesn't have adequate docs and the only tutorial is lengthy and doesn't explain much.

There was an old library called gamelib but that's obsolete. jsGameSoup isn't in-development.

I've started writing a tile based javascript game engine already (no canvas or svg). Wondering is there are already some that exist.

( 10 comments | 19 points | on HN )
Re:Ask HN: Any javascript game libraries? by Magneus on Sunday August 22, 2010 @01:00PM (#1624880)
You state that you're building a tile based game without canvas/svg already, but is it a requirement to not use either canvas or svg?

If a canvas-based library is acceptable, I recommend Akihabara: http://www.kesiev.com/akihabara/

Re:Ask HN: Any javascript game libraries? by teamonkey on Sunday August 22, 2010 @01:07PM (#1624892)
Akihabara is probably the most complete JS game lib, but man is it messy. It has clearly grown organically and is in need of a good refactoring.

CakeJS is a bit cleaner, it has a nice scene graph, but it's at a much lower level than Aki. There's none of the useful game basics like collision detection so you have to write those yourself. http://glimr.rubyforge.org/cake/canvas.html

Raphael is similar to Cake in scope but for SVG/VML instead of Canvas. http://raphaeljs.com/

Finally there's Processing.js, which is the javscript port of the Java library. http://processingjs.org/

Re:Ask HN: Any javascript game libraries? by SingAlong on Sunday August 22, 2010 @01:48PM (#1624938)
No it's not a requirement that I use canvas or svg. But does svg have javascript functions to make elements drawn interactive, like keyboard movements etc? (under the assumption that svg/canvas is one way. like only draw and not refer to the elements and edit props)

Teamonkey and Akihabara. Thanks for the links.

CakeJS and Akihabara are both good enough for me. Also, CakeJS's Google Code page says that the author is looking for a maintainer.

http://github.com/kesiev/akihabara

Somehow, these days I feel like if an opensource project is on Github it seems to be active and the maintainer responsible enough. Don't know why I have this feeling, maybe it's just easier to look at the last commit date or fork it or just find another forker who's been working on it actively.

And if anyone's interested, I'm using the graphics from http://www.lostgarden.com/search/label/free%20game%20graphic... to prototype the game. This guy has some cool graphics to make prototypes look neat :)

P.S: Just tried Akihabara's demo game Legend of Sadness here: http://www.kesiev.com/akihabara/demo/game-tlol.html and it's super awesome. Suits my needs.

Re:Ask HN: Any javascript game libraries? by _delirium on Sunday August 22, 2010 @06:35PM (#1625416)
> But does svg have javascript functions to make elements drawn interactive, like keyboard movements etc? (under the assumption that svg/canvas is one way. like only draw and not refer to the elements and edit props)

Not sure about svg, but you're right that canvas doesn't support that sort of thing natively. It's one of the main things canvas-based game engines encapsulate, though. While the canvas loses all your higher-level object information once you write it (it's just a bunch of pixels), the engines keep track of object locations separately, and then map clicks on canvas (x,y) coordinates to the objects that were clicked on, which can then trigger a callback (sometimes with some additional features supported beyond the direct click-to-object mapping).

Re:Ask HN: Any javascript game libraries? by alttab on Sunday August 22, 2010 @12:29PM (#1624822)
Library:

Check this out: http://www.sean.co.uk/a/webdesign/javascript_gamelib/javascr...

Forum:

Also check out http://www.gamedev.net/community/forums/forum.asp?forum_id=5...

which is a great place to start for web game development. This crowd has historically come from desktop C++ gaming with DirectX and OpenGL but have great niches for technical aspects, technology, and open forum.

Re:Ask HN: Any javascript game libraries? by SingAlong on Sunday August 22, 2010 @12:44PM (#1624847)
That's the library I was referring to as "gamelib" in the thread's text. The last update it got was in 13/04/04 (by Brent Silby) as per the docs in the download :)

Thanks for the link to the forum on the gamedev.net site. That sounds useful.

Re:Ask HN: Any javascript game libraries? by bts on Sunday August 22, 2010 @04:00PM (#1625156)
Check out the Effect engine: http://www.effectgames.com/effect. It's been discussed here on HN previously: http://news.ycombinator.com/item?id=986196
Re:Ask HN: Any javascript game libraries? by kilian on Sunday August 22, 2010 @04:07PM (#1625166)
Here's a slightly older one that looks very interesting as well, and has been on my list of things to try: http://tommysmind.com/
Re:Ask HN: Any javascript game libraries? by dstein on Sunday August 22, 2010 @01:10PM (#1624898)
The HTML5 canvas and audio API's are fairly simple and easy to coordinate. You probably do not need a library unless you require complex collision detection, or physics math.
Re:Ask HN: Any javascript game libraries? by bni on Sunday August 22, 2010 @04:19PM (#1625187)
I Agree. A library you use might not align 100% with the type of game that you are developing, slowing you down, especially if you target mobile.

The game I have built with web technology, Orbium (http://jsway.se/m/), I choose to use no libraries, the HTML5 stuff that already exist in the browser is already very powerful and easy to use.