After onGameStart conference I’ve been thinking about what are the actual differences between desktop and browser games. What should be done to make browser games better and to finally compete Flash? This is not only about browser engines and WebGL, it’s also about developers and techniques used.
- Better graphics
- Involve desktop game developers
- Easier animations
- Code like in C++
- Fix WebGL
- Write better WebGL tutorials
- More physics engines
- Kongregate for HTML5
Most of the current HTML5 games are not very beautiful and common user/developer thinks that it’s because of the technology limits. It’s not. Let me say it clear – everything that can be done in Flash, can be done in HTML and CSS as well. It may be harder to code some things, but performance is more or less the same.
We need to get designers involved, we need to use only high quality graphics in our games and tutorials. Stop using stupid rectangles, boxes and retro games in your work, it is black PR for HTML5. Adding something of high quality is very easy! For my university I wrote a simple fighter game and it was rated A not because the code was great (it wasn’t, it’s based on jQuery) but because the graphics were nice and it was more or less playable. And they were absolutely free.
Involve desktop game developers
I recently have started studying gamedev and I met some game developers at the university. Probably not the best ones (hey, it’s only university), but good enough to show me that we suck. There is so much knowledge already there, about optimization, tricks and techniques to use and make your games so much better! Even during onGameStart only some of people actually knew all this stuff (good example: Brandon Jones). If you have experience only with front-end programming, you can’t switch easily to game development. If you want to make 3D games, get a book about writing games in C++, about physics engines. For 2D games Flash resources should be more suitable. We have a lot to learn.
I think that for the next onGameStart there should be few good desktop gamedevs speaking (hey, invite John Carmack ). Convincing some of them to switch to JS is also a good idea. A great example is Erik Möller team porting Emberwind from C++ to JS. Performance and graphics are great, game is already successful and there should be more projects like this. I believe that, with enough effort, every game can be ported to HTML5.
To be honest – CSS3 animations have terrible syntax. In Flash you draw a path and say to object “follow this path”. It’s plain and simple. There are some projects that help with animations, but are not very popular yet. They should be.
Code like in C++
Most of the desktop games are written in C++. It’s not as flexible as JS, but there are few methods that are missing in JS and it will cause a lot of troubles.
First of all, there are no operators. If you want to do some math in C++, you define operators and write something sane, as:
V3 = M1 * V1 + V2; V4 = V1 + M1 * M2;
You know how this code would look like in JS?
V3 = M1.multiply(V1).add(V2); // and even worse V4 = V1.add(M1.multiply(V2));
There is a lot of very advanced math involved in physics engines and it quickly becomes very messy.
JS also misses variable types. It’s actually the biggest problem in my opinion. Changing types is forbidden anyway (because it breaks browser JIT).
var a = 5; console.log(a); a = "aaa"; console.log(a); // you will burn in hell for such code
There are typed arrays, but they don’t help that much. We still can’t use function overloading. JS should be improved or we need tools that would help working with types. Check this paper for some scientific stuff about types in JS. Or again, write some great tool for that and become famous.
Memory management is also better in C. Going the Java’s way and firing garbage collector from time to time is not very good.
Most of the things in this paragraph are just me complaining. I don’t think there are any chances that it will change anytime soon (and I spoke with some ECMAScript 6 guy about that). You may disagree with these arguments, but unless you’ve read something like Seven Languages in Seven Weeks or programmed few games in C++, I’m not going to listen. JS fanboys, please go away.
WebGL should be secure and easy to use. There is a lot of talk about bugs in drivers that allow attacking your computer. OpenGL was designed to trust running programs. By installing something on your computer and running it you are confirming, that you let this program to use GPU power. It would be easy to do the same with inline content. Every browser should ask user, if he allows website to run WebGL content.
I also have no idea why we have to write our own shaders. There should be a default graphics pipeline like in OpenGL, so we could learn faster. GLSL is a good thing, but now it is raising entry level of WebGL a lot.
And IE team, for Zark’s sake, could you support WebGL or at least WebDirectX?
Write better WebGL tutorials
There should be more focus on reusable tools and functions. At the moment you have to either be very persistent, use some framework (which is not always a good solution) or give up using WebGL.
More physics engines
Stop making rendering frameworks. We have these already. What we need now are physics engines like Bullet, but working with WebGL. Writing collision detection is pain in the ass, and collision reaction is even worse. There is a lot of awful math to implement and optimization to do, I think that it’s far beyond most of the programmers level (including me). If you are able to write a good engine that supports any of existing rendering frameworks, please do so. The world is counting on you.
Kongregate for HTML5
Somebody said that on the conference, that we should have some huge game portal that supports HTML5. And in the very same day Kongregate approved the very first HTML5 game created as a promo for onGameStart. Awesome
Other things that were already said
Great and more technical list: http://codeflow.org/entries/2011/sep/11/webgl-and-html5-challenges-for-the-future/
Go and read it, it may be even more important!
I hope that in a year or so I’ll write a summary how everything got better. For now I’ll try to push things by myself a little and write some (hopefully) awesome games. I hope you will do the same!