views:

135

answers:

7

If i decide to write a simple game both text and graphical (2d) what libs may i use? Assuming we are using a HTML5 compatible browser.

The main things i can think of

  • Rendering text on screen
  • Animating sprites (using images/css)
  • Input (capturing the arrow keys and getting relative mouse positions)
  • Perhaps some preloading resource or dynamically loading resources and choosing order
  • Sound (but i am unsure how important this will be to me at first). Perhaps with mixing and chaining sounds or looping forever until stop.
  • Networking (low priority) to connect a user to another or to continuously GET data without multiple request (i know this exist but i dont know how easy it is to setup or use. But this isnt important to me. Its for the question).
+1  A: 

Well.... there's Rocket Engine. I haven't used it, but it appears (on the surface) to do much of what you want.

I'd also recommend HTML5 Gamer, a blog on the issues for building games in HTML5/JS

Randolpho
A: 

GameJs does this:

  • Sprites, SpriteGroups
  • Text rendering
  • input handling (key/mouse)
  • collision detection
  • sound
  • resource preloading

http://gamejs.org, Disclaimer: I'm dev of GameJs.

The stuff above works good and I did games with it. The API is similar to http://PyGame.org which some people like a lot.

Networking is planned.

oberhamsi
Hey you might want to look at http://www.effectgames.com/effect/ A company owns it now see http://html5gamer.com/2010/07/effect-games-acquired-by-dextrose-ag-aves-engine/ and aves engine was shown at google. I dont know how impress i am with aves but i am impressed with effect and i suspect effect (and possible aves, maybe one is meant to be free while the other is the enterprise version?) will be THE lib to use.
acidzombie24
a) not open source b) not yet available. And it's a different beast as it works with imgs/css instead of drawing to the canvas.my lib is on github right now ;)
oberhamsi
A: 

I can recommend Cometd for using ajax push networking (ie. comet)

Jani Hartikainen
A: 

Check out cake js. It's been around a long time and it's really nice to use - especially if you've used actionscript before.

Mikee
A: 

If you're familiar with jQuery then gamequery is a good one to try. Here's a great demo of what you can do with it: brainsnackers.

Here are some of the features:

  • multi layer-sprite animations sprite
  • hierarchies (grouping) collision
  • detection swappable sound support
  • periodic callbacks keyboard state
  • polling free and open source license
cmaxo
A: 

The http://js1k.com contest just ended and the 2D platform game Legend Of The Bouncing Beholder (by marijnjh) was the winning entry. You might want to look over the source since it would provide a very easy to grasp overview of sidescrollers without needing to read lots of code.

Another good one is the two-player crazy pong which is a lot of fun.

Plus, 1kb games are just awesome.

Xeoncross
A: 

Hi, i would use RenderEngine i think it has all you need and solves one of the most important problems that would be collision detection, and it also has sprite support...

Tutorial <- this is a great tutorial i found

i hope this helps

mklfarha