lulebe / jscrusades

1 stars 0 forks source link

Canvas performance #3

Closed lulebe closed 2 years ago

lulebe commented 2 years ago

Currently I'm redrawing the whole canvas every time something changes. That's also necessary in some way since removing things isn't possible, so for example animating a moving unit would leave a trail behind without overpainting that area. Figuring out which areas that are and which items would need redrawing is more difficult that just redrawing everything IMO. But, performance even on a my surface book is questionable while animations are running. So, I'm thinking about ways to separate them, if necessary. I think for moving units it should be fine, but I don't want continuous animations with the current system (numbers flashing continuously for example) because that impairs scrolling performance which harms UX. So, an SVG layer above the canvas could be used for these things, or we just don't do that. I would keep things as is and try to use animations only when necessary (moving units, maybe at turn start to indicate where units heal or buildings are conquered).