Pierre-Alexandre
Pierre-Alexandre

Reputation: 765

svg vs canvas - browser game map?

I am trying to make a copy of the popular browser game Travian.com. I am currently working on the maps and I was able to get the farms overview image as a png.

What I am trying to accomplish with that map is:

Once I had the farms.png picture, I used on online tool to convert a png into a .svg file. Using a free software, I was able to draw circles around each map to build my svg.

enter image description here

This is the result:

enter image description here

I recently read about canvas and I was wondering if canvas would be a better option in my case rather using svg?

Upvotes: 0

Views: 590

Answers (1)

Paul LeBeau
Paul LeBeau

Reputation: 101820

You need to try it yourself and see if it gets redrawn quickly enough that the game is sufficiently responsive for you. If the map is very detailed, the redraw may be too slow and make your game feel slow. You really need to try it and see. If it's too slow for you, then you may need to either:

  • use bitmap images, or
  • keep the maps as SVGs, but render them to a Canvas on first load. This way they'll be sharp at whatever resolution screen the user has.

Upvotes: 1

Related Questions