html5-canvasonline-game

html5 canvas or dom for online backgammon game


I'm starting to develop an online backgammon game. I 'm not sure whether to use html5 canvas or use dom and css. could you tell me the pros and cons of each approach for moving and animating pieces?


Solution

  • Board games like backgammon require very little animation, and/or fancy animations. In other words, it's a relative "simple" 2d game (relative to what's possible with both DOM manipulation and Canvas 2d context). I assume you want to make it in 2d.

    This means that you can use both methods to create the game; they will both do just fine. The real question becomes: which technique do you know more about, and do you prefer? If you don't know the answer to that, start investigating in both techniques. Read simple tutorials, play with some code and get the gist of both techniques. Then make your decision.

    Canvas

    DOM manipulation

    See the canvas pros and cons, and revert them ;)

    Here a nice guide to canvas 2d context methods.