To canvas, or not to canvas, when building browser-based games?

Posted by Letharion on Game Development See other posts from Game Development or by Letharion
Published on 2012-01-27T22:50:44Z Indexed on 2012/09/12 15:52 UTC
Read the original article Hit count: 235

Filed under:
|

Background: I have extensive development background, but the last time I coded a game was many years ago. My Javascript skills are quite limited, and I intend to improve them by building a simple game — Tetris, Pac-man, or something of that complexity level.

Question: It seems to me that a fundamental choice I need to make is whether I should render on a <canvas> element or not.

With a canvas, I have basic tools for rendering points, lines, and more complex things on top of that. Presumably there are, or will be, also various frameworks to help with this.

Without a canvas, I could keep my objects in the DOM-tree, like a regular webpage, only quite complex, with many overlapping elements.

Is one approach better than the other? Are they mutually exclusive? How do I know which to pick?

© Game Development or respective owner

Related posts about JavaScript

Related posts about html5