Canvas vs. SVG for games [closed]

SVG V Canvas

As a professional games creator my advice is to stay away from SVG if you wish to create browser based games. The main reason is that it is simply too slow. Second reason is that it will make your job as a programmer more difficult because finding solutions to SVG’s lack of performance is hard. Third reason, because it is VERY SLOW and games are all about performance.

This page will go over SVG game design An Original Approach to Web Game Development Using SVG but before you dive in and read all of it have a look at the prototype of the game it`s all about Runes and Relics Prototype. A little oh hum in my book.

I am sure there are other attempts this was just first up in my search. But I have never played a good SVG game.

So what is SVG good for? Graphic resources. SVG is a good way to package images for your game, Once you have them on the client you can render them to bitmaps and then use them to render your game. The beauty is you get the resolution independent scalability of SVG and small images size. But by rendering them to bitmap at load time you get the full use of the GPU to move pixels about. SVG is just too slow to use within the game.

Why use Canvas? I would like to say because it’s fast, but it is not when you compare it to a native C++ app which will run 10* quicker than the equivalent Javascript / canvas game. Ten times quicker is very significant but then you do not get the cross platform advantage you get with Javascript.

Currently canvas is the best option for truly cross platform game applications. Using either 2D or 3D webGL you can build full screen full frame rate games. HTML5 has a good set of APIs for all gaming needs and is easy to learn.

I am not a fan of game engines, they are a cover all solution, the middle man between you and the already well designed API’s that force you to do it their (not that great) way. But they will give you a good overview of what is possible.

Phaser is a javascript canvas game engine that has lots of resources and examples. It is a good place to start and see what can be done. Don’t be sucked in by the fact that game engines sell themselves as such. HTML5 & JavaScript is out of the box the best game engine in town, runs native code, has a huge user and support base. The time you spend learning how to use a Game engine’s API will not be time spent learning how to use the HTML5 API’s (and quite frankly the HTML5 APIs are perfect, the result of the 20 year browser wars) which is actually easier than the Game engines to use and learn.

Leave a Comment

tech