Hacker News new | ask | show | jobs
by hastur 5294 days ago
Could 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.

2 comments

Yes you can. Have you seen Team Fortress 2 in WebGL?

http://www.youtube.com/watch?v=DQrC5YLKFUY

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.

JS 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.

I'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/bhoaojooagiaaiidln...

But why do you need to write BF3? There are tons of games besides 3D shooters. Could you write minecraft in WebGL? I bet.