8 ms·
Is WebGL the future?
- hastur 15y agoDefinitely not. The performance is pathetic, the feature set is pretty basic. WebGL is where compiled 3d apps/games were, like, 20 years ago. Yes, I know it will improve, but so will compiled products. The sheer fact that WebGL is interpreted and is a poor-man's subset of OpenGL, puts it at permanent disadvantage. Of course, you could have some trick allowing for compiled graphics code to be run within the browser, analogous to the Chrome Native Client, and with all the DirectX/OpenGL features. But that's no longer WebGL, that's just a smart trick to run old-school code within the confines of a browser environment. You might just as well write a stand-alone app.
- irrlichthn 15y ago20 years ago? That was the time of Wolfenstein 3D. :) Much more thant that is possible with WebGL... Take a look at some of those demos available. (example: http://www.ambiera.com/copperlicht/demos.html http://www.ambiera.com/copperlicht/demos.html) You can always workaround that performance problem. No need to program some CPU cylcle swallowing AI for now.
- hastur 15y agoWell, maybe 20 years was too far of a shot. But I assume you're associated with the Irrlicht game engine, so I assume that when you write "is WebGL the future?", you don't mean "will it be useful at all?" or "will some silly casual games be possible in WebGL?", but whether it will be a legitimate gaming platform, capable of competing with desktop gaming (which is where Irrlicht competence lays, afaik). And to that I say firmly: no. I like the demos you've linked to (and I've seen them before), no doubt they're quite impressive, considering the constraints of the browser environment. But when I put them in context of what one could run on a computer natively, these demos remind me of Quake I. Sorry.
- hastur 15y agoAnd BTW, I really hate to put you down like this. I have dreams of my own of one day writing an MMO game, that would mostly be handled by a server and the client would run in a browser. Perhaps the clue is not BF3-level graphics, but something "decent" on the graphical side and a really cool world and mechanics within the game. I'm just a little frustrated at how inefficient all this web stuff still is. Imagine even your own demos - rather simple graphics by native standards - but with much larger world and many more characters. It would grind to a halt even on a mid-range PC, not to mention an iPad or a cheap laptop. Still, I really wish that you create a plug-and-play graphics engine for web game developers, that would allow people like me to fulfill their fantasies. :) Wish you all the best!
- nextparadigms 15y agoI think Native Client is pretty impressive if you want to make a browser-game. Bastion looks pretty good: https://chrome.google.com/webstore/detail/oohphhdkahjlioohbalmicpokoefkgid https://chrome.google.com/webstore/detail/oohphhdkahjlioohba...
- kevingadd 15y agoWebGL is interpreted? What do you mean? Modern JavaScript runtimes are DEFINITELY not interpreted, and the idea of an interpreted graphics API or GPU is nonsense.
- hastur 15y agoLOL, what is JavaScript then, if not interpreted? I'm not going to get into a semantic argument, perhaps to you Java is not interpreted either, but to me anything that doesn't compile to a binary directly executable on the CPU is substandard in terms of performance. And I'm sorry to surprise you, but in 3d graphics we're still starved for processor cycles, otherwise we'd have ray-traced, globally illuminated games with huge environments to play with.
- fridek 15y agoIt's JIT compiled and WebGL shaders are compiled as well. It is a native code executable on CPU, read how Crankshaft in V8 works. It's true that JS is at the moment N times slower than C++ (N in range 1 to 10). It's not true that you need to use JS that much to have great graphics. Everything you pointed out is done on GPU afaik. And if you wait a year or so, JIT + type inference will make JS basically as fast as C++.
- hastur 15y agoWell, I'm not that familiar with the internals of JS engines, perhaps some browsers are capable of partial compilation. On the other hand, this is a dynamic language (as in: data types and other pieces of code can change in run-time), with limited features, like data structures (wanna benchmark linked lists or kd-trees in C++ vs JS? I doubt N=10 is skeptic enough). I'm not sure if I write path-finding or collision detection or line-triangle intersection with their respective data structures in JS, it will turn out anywhere in the ballpark of real compiled code. (And this is pretty elementary stuff in 3d games.)
- fridek 15y ago
- gacek 15y agoWebGL is not a poor-man's subset of OpenGL, its the same subset that is supported by most mobile devices (OpenGL ES2.0). What are you missing? Quads? 3D textures? NURBS? And yes, we know that JS is interpreted and that it's no use for building anything more than a clock on your webpage, right?
- hastur 15y agoCould you write (graphically) Battlefield 3 in WebGL, assuming you'd be able to compile it to run efficiently? As for your second question, JS is very useful, I love JS, I write 90% of my code in JS. But we're talking sophisticated 3d apps here, not whether it's useful at all.
- fridek 15y agoYes you can. Have you seen Team Fortress 2 in WebGL? http://www.youtube.com/watch?v=DQrC5YLKFUY http://www.youtube.com/watch?v=DQrC5YLKFUY http://www.youtube.com/watch?v=Lmvj6-CFbbA http://www.youtube.com/watch?v=Lmvj6-CFbbA JS is not very pleasant to code with, so writing an actual game logic could be a bit painful, but so is development for PS3 and it's done somehow. It's not a question of performance, rather about workflow and structures provided by language.
- ehsanu1 15y agoJS has gotchas and some really bad parts, but if you know the language well and know what you're doing, I think it's quite pleasant actually for many problems. Have you done much programming with JS, and if so, what was so unpleasant about it? Though, I think I've heard pretty much all the complaints against JavaScript, many of which are addressed by using something like CoffeeScript.
- fridek 15y agoI'm using Google Closure to get rid of the bad parts, but still it's not very good. I did some testing with game AI, graphics and so on - JS is far from perfect for such things. Maybe it's a lack of tools, maybe of some features I was used to in C++ or maybe it's that all the books and tutorials are targeted for C++. It doesn't really matter, browser games are the future and no matter how complicated it's going to be, somebody will be good enough to write them. We already passed "demo era" and some games are really good, like https://chrome.google.com/webstore/detail/bhoaojooagiaaiidlnfhkkafjpbbnnno https://chrome.google.com/webstore/detail/bhoaojooagiaaiidln...
- exDM69 15y ago>> WebGL is where compiled 3d apps/games were, like, 20 years ago. 20 years is a bit of exaggeration. Doom 1 was released 20 years ago. Feature-wise WebGL/GLES2 matches a desktop GPU circa 2004 or so. Doom 3-ish feature set. Performance wise it's a bit behind, but this varies so much from device to device that it makes no sense to take this into a discussion when we're talking about API standards and their features.
- danbmil99 15y agoI agree with OP. The fact that a native app is 10X or more "better" is simply dwarfed by the low friction of full immersive 3D casual games right in the browser. The question is not "how many polygons can you render?" but rather, "how many polygons do you need to render to provide the desired experience?" So it's a threshold question, not a contest where the winner is determined by benchmarks.
- tjoff 15y agoWhy should there be less friction to go to a web page rather than install a game? I think a more honest comparison (in theory) would be to compare a site used to serve music with spotify. For those that use spotify a link that opens up spotify is probably vastly superior to anything a site can do, that's not to say that the site itself doesn't have any value. But the act of playing music is something spotify better at - and that mainly is just because (if you use spotify) you have your music collection in one place. That's where you go to play music. Playing a game locally doesn't have to be more than pressing an hyperlink. Steam is probably the, currently, best place for this but, I know, relying on something such as spotify, steam or flash sucks. But there is nothing to say that we can't have an open android/iOS-market-like place for doing this. Apple and Microsoft will push their own markets and I'm surprised that the notion of a third party market hasn't come any longer than steam. I guess people are just too greedy. There really shouldn't be any reason for why running it in the browser should be any better than running it locally. Have sandboxing as an option (or requirement), similar to what apple does, and go nuts. I miss the days when running low-level code in an all-purpose browser was something that was considered moronic.
- iamjustlooking 15y agoI think installing a game feels like a commitment. If all I need to do is open up the browser and the game will start playing I can just check it out without making that commitment, it will get me to try it if I'm undecided, if I don't like it I can just close the window and be done with it. You mention Spotify, I think Pandora is a great example of overcoming that feeling of commitment. If I go to the Pandora website I can listen to music right away by just typing in an artist. If I go to spotify I need to download some client and who knows how hard it will be to get rid of. If I complete the downloading step then I need to sign up for the service (I know they changed it to facebook login recently so I don't know if it's the same) just to start listening. I don't even know if I will like the service at this point because I haven't even got to try it yet. I think I would describe this as friction.
- Geee 15y agoFuture of what? I don't know any use case where I would want 3D graphics on my web pages. Running games in a browser? That's a stupid idea to begin with. Browser should be just a document reader, and games are not documents. Why are we reinventing wheel again? Games used to be crappy, and now we want crappy games again? Why is it so amazing if something runs in a browser? Why don't we think about other solutions like making native apps more web-like?
- gcp 15y agoWhy is it so amazing if something runs in a browser? Why don't we think about other solutions like making native apps more web-like? What's amazing is that something that runs in the browser will run on every platform where there is a browser (with some proper care of the inevitable small standard deviations). No such luck with native apps.
- tjoff 15y agoYeah, with native apps you have to run a script that compiles it for all platforms.
- Klinky 15y agoWhat magic script lets you natively compile OpenGL code for Mac, Linux, Windows & portable platforms without having to write any platform specific code?
- tjoff 15y agoWho said anything about not having to write any platform specific code? "with some proper care of the inevitable small standard deviations" Is exactly what I would say is required to make a game run on different platforms. It of course depends on what you want to do, but if you limit yourself to the subset that is the browser there shouldn't be any real problems at all.
- dtf 15y agoPlenty of games run in the browser already, without 3D. There are also plenty of use cases for in-browser 3D that aren't game-related. See Google MapsGL or the Google Body Browser. It has huge potential for education in the sciences - I've seen a number of interesting medical teaching tools appearing. One of the benefits of WebGL vs native application, is the ability to combine it with the entire set of document-based browser features that you're already familiar with. In fact, this is so useful that some native games these days are doing the opposite - embedding a browser kit into the game for the sake of the UI.