Hello, I'm a Flash game developer. Lately, more and more posts began to appear about flashbacks, and MustHave JavaScript (further JS). It seems like for JS future, and for open web.
I haven’t taken JS seriously as a game development platform for a long time. After all, this is an interpreted language, and the speed of JS leaves much to be desired. But just recently my favorite framework for animation
TweenLite was ported to JS. At the same time, the author has created a test case showing the performance of actual JS frameworks:
here .
It became very interesting to me, since TweenLite JS produced quite good FPS. And then I decided to write the same example for comparing Flash and JS frameworks.
Then it became interesting for me to compare the FPS of these examples in different browsers and on different operating systems.
The test itself is an animation of movement, and changes in the size of pictures, at which you can change their number. The test example for Flash is
here , the source code for the example is
here .
Testing was done on my old HP Compaq 625 laptop:
Iron :
AMD Turion II Dual-Core P520 (2.3 GHz), 2 GB RAM, ATI Radeon HD 4200.
Operating systems :
Windows 7 x32, Linux Mint 13 x32
')
Browsers and Flash Player :
Google Chrome 21.0.1180 (Flash Player 11.3.31), FireFox 15.0.1 (Flash Player 11.4.402 for Windows, FP 11.2.202 for Linux), Interrnet Explorer 9.0.8112 (Flash Player 11.4.402)
I want to say that the Flash Player on Firefox has been installed on different versions for different operating systems, because the official support from Adobe on Linux has already ended, only security updates for the 11.2 branch will be available. Unlike Firefox, Google Chrome Flash Player works through the new cross-platform API for the Pepper API plug-ins, and therefore it is updated to the latest version.
So, let's see what happened:
Test number 1:
Frames Per Second (Chrome 21.0.1180, Flash Player 11.3.31, Windows 7 x32) |
Frameworks \ Tests | TweenLite (AS) | tweener (AS) | GTween (AS) | jQuery (js) | TweenLite (JS) | YUI3 (JS) | MooTools (JS) | Dojo (JS) | TweenJS (JS) | Zepto (JS) |
500 | 60 | 60 | 60 | sixteen | 60 | 6 | 12 | 22 | 17 | 47 |
1000 | 60 | 41 | 60 | one | 51 | one | five | five | 2 | 28 |
3000 | 21 | 6 | nineteen | one | sixteen | one | one | one | one | five |

Three tests were carried out here, for 500, 1000 and 3000 thousand pictures. As you can see, there is a big gap between the Flash frameworks and TweenLite JS, with 3000 pictures, it overtook even the flush tweener. Zepto performed well, but the beloved jQuery for animation suits everyone very badly. It can be concluded that if development continues at that pace then JS has every chance of becoming a worthy replacement for Flash.
Further, I wondered how the performance fluctuates on different browsers and on different operating systems. After all, the flash player is developed by a single cantor, and there should be no strong performance deviations. A JS engine is written for each individual browser, completely different people (bicycle effect). So let's look at the result.

As you can see, although the flash player is the same, but it behaves differently in different browsers, this is more likely due to the fact that it uses different APIs when interacting with browsers. The most unsuccessful plugin FP turned out for Internet Explorer.
Now let's take a look at the performance test for browser-based JavaScript engines. Here the test was conducted on 500 images, because at 3000 and many frameworks just hang.

The fastest was Google Chrome, which is not surprising, despite how much money Google invests in it. Further, Firefox may change the situation when introducing a new
incremental garbage collector . And at the end of Internet Explorer. The gap between the first and the last is just enormous. Imagine you wrote a game on JS, and it works well for you in Chrome, Firefox, but then someone came from IE, you can imagine what will happen next, IE will hang and most likely will fall and with it a lot of open tabs. As a result, the user will add your site to the blacklist. If there was a flash game this would not have happened.
Since there is such a large enough spread in the performance of Flash Player on different browsers, let's now see how it will change
on different operating systems in the same browser :

Sad picture, but see in mind the small spread of Linux, Adobe carelessly refers to the optimization of their player on this OS. I will not post the results of Firefox, because I consider it unfair to compare flash player 11.4 and 11.2, but in fact the difference is not doubled.
Moving on, how does the JS engine behave on different operating systems?

As you can see, Chrome is almost the same that is good, but in Firefox, the Linux version is noticeably lagging behind.
Conclusion:
As you can see the performance of JavaScript is growing, it pleases. But many problems remain:
- We need to test how the game will behave in all browsers, and hope that when the new IE comes out, God forbid nothing has fallen off.
- The difference in the performance of browsers, will have an unpleasant effect, on some the game flies on others inhibits.
- You can’t hide the source code unless you really obfuscate it.
What other problems await when developing the client part of the game in JavaScript and how can they be solved?