Is the impact of the HTML5 Canvas in game development overestimated?
-
The Canvas element certainly has its purpose, and whenever bitmap graphics must be generated or drastically modified at runtime, there simply is no better solution. I seriously started to doubt, however, whether, even for game development, there should be one major canvas, where all the action should happen. Refreshing a large canvas is a CPU-expensive operation. Why not stick to the DOM/CSS model that frameworks like jQuery have made miracles with, and use Canvas only for specific purposes? Since the Canvas is also a DOM element, it could be used for smaller abstractions such as sprites, etc, and moved around just like every other DOM element.
-
Answer:
I've seen both methods tried on the web platform. Runtime performance is key here. Developers like to use the canvas 2D drawing because it gives them complete control of the paint logic per frame. If you use the DOM API the compositing and painting is driven by the native browser engine which typically does not perform as well. Depending on the structure of your DOM and CSS, the render tree generated can be very complicated and make paints very expensive. An example: The Bespin programmers' text editor web application was originally written all in canvas 2D. Many web-based games on the webOS platform are written in canvas 2D. Canvas refreshes are only expensive if you redraw them completely every time. If you do not need to update anything, the web browser just blits the canvas raster when doing its page compositing. Remember that if you are using Canvas the painting logic is completely up to the web developer. Another example: the calendar day view in webOS was originally written using DOM but the render tree generated was so complicated that runtime performance suffered. It was re-written as canvas to get smooth scrolling. The month and week views are DOM-based however.
Greg Simon at Quora Visit the source
Related Q & A:
- What's the proper structure of an HTML5 page that briefly lists other articles?Best solution by Webmasters
- How to style the HTML5 form validation messages?Best solution by Stack Overflow
- How to create html5 audio playlist?Best solution by Stack Overflow
- Is cognitive development the same as intellectual development?Best solution by Yahoo! Answers
- What is the difference between impact and non-impact printers?Best solution by smallbusiness.chron.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.