Answer the question
In order to leave comments, you need to log in
2d games in pure JS without Canvas?
Hi, I'm doing a thought experiment on what happens if you try to make a 2D game without Canvas, but only on divs.
All examples of the development of simple toys necessarily include the use of canvas - all kinds of snakes, flappy birds, ping-pong begin with the creation of a canvas. But what if we make them just "normal layout"? What are the downsides?
On my own behalf, I’ll add that I worked with canvas as part of a cart competition for creating a schedule - I remember there was a hemorrhoid with coordinates. Well, the complete absence of css, any style had to be set through js line by line. I know that many people have done this task using svg, and although there were some difficulties, the result turned out better.
And in terms of game development, I only did chess, I did without canvas, but, of course, there is nothing special to render there.
Answer the question
In order to leave comments, you need to log in
Anything is possible though!
On divs, you end up with a DOM tree. And DOM trees are very slow, as the browser does not optimize. They drag a lot of all kinds of legacy and a lot of things that are not needed for graphics.
They have a different purpose.
Another thing is canvas, where everything is created for fast rendering of graphics.
The larger the number and the weaker the computer, the more noticeable the difference.
Generally no problems.
Divas even have 3D action via css 3d transform!
The main thing is to clone if such objects (divs) are needed and to monitor the asynchrony of code execution wherever possible.
(+ "straight arms")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question