top | item 4333615

Letter to John Carmack

149 points| austinhallock | 13 years ago |phoboslab.org | reply

133 comments

order
[+] tumult|13 years ago|reply
I am 100% with Carmack. Sorry, guy. JavaScript is crap. The reasons that JavaScript sucks have been hashed to death in the past. If you are already disagreeing with me, then anything I say here won't change your mind, because you've already heard the arguments before and built up a repertoire of responses. That's fine, whatever floats your boat. Lots of fun games have been, and will be written, in silly languages like JavaScript and ActionScript and whatever. People used to write games in assembly, and they were still fun. In the end, it's the game that matters.

But don't tell John Carmack, or any of the other many people who have been writing simulation engines and 3D rendering engines since around when you were born to use your web browser scripting engine. Seriously. (Also before I was born.)

And unsecured access to the graphics stack is a terrible idea. Flash already randomly causes my GPU to crash.

[+] lazerwalker|13 years ago|reply
Do you not see the rhetorical problem with what you're saying? To come in here with a controversial statement and preemptively write off all oppositional viewpoints is to act in exactly the same way you deride pro-JavaScript proponents for allegedly behaving.
[+] drcode|13 years ago|reply
Of course javascript is crap...

...however, this is also true of every other part of web programming: HTML and CSS are similarly a mixture of academic navel gazing nonsense and ugly cludges designed by committee.

The fact is that HTML5 is still really only version 0.1 of where web programming should be- But this doesn't mean it isn't improving. The fact is that having portable code snippets that can execute within a website is extremely powerful and right now javascript is essentially the only way to accomplish this.

You don't have to love javascript to love what it allows you to do.

[+] user24|13 years ago|reply
> The reasons that JavaScript sucks have been hashed to death in the past. If you are already disagreeing with me, then anything I say here won't change your mind, because you've already heard the arguments before and built up a repertoire of responses.

You're implying I'm closed-minded because I have an opinion. I would actually like to hear your reasons for saying JS is crap/silly.

[+] runjake|13 years ago|reply
It seems to me like you missed the point of his letter to Carmack entirely. He's saying it doesn't have to be the greatest tool for the job, he's saying it's a good intro for would-be programmers and dabblers.

And don't give me that "when you were born" line. It's built to hinder fresh, new ideas and perspectives.

Signed,

A dinosaur who tries to refrain from using the "When I was your age..." line.

[+] greggman|13 years ago|reply
I've been writing "writing simulation engines and 3D rendering engines since around when you were born" and I love JavaScript.

Like most C/C++/ASM programmers I hated it at first and I'm under no delusion that it's going to replace C/C++/ASM any time soon. But like many say, "the right tool for the job". By any measure Lua is complete shit and yet Carmack made it popular by using as the glue for most of his games.

JavaScript does many things extremely elegantly and the environment it runs in is fun, cross platform and accessible. It's fun to make things in JavaScript the same way it was fun to make programs on my Atari 800, Commodore 64. You type something and click "refresh" and it's up. No downloading a 2-4gig dev environment. No finding 4 SDKs you need to install. No figuring out how to get your image libraries to link. No worrying about how to get the initial screen up,

And even better, when it works you just send you friends a link. No installing. No worries if they are on OSX and you are on Windows or Linux.

Are you going to write Shadow of the Colossus in JavaScript? Probably not. But ICO? Yea, no problem. Any Zelda to date? Sure. 80-90% of all games ever shipped would run just fine in JavaScript at this point in time. Very few games actually need every once of perf.

> And unsecured access to the graphics stack is a terrible idea.

WebGL does not provide unsecured access to the graphics stack so I'm not sure what this BS remark was about.

[+] azakai|13 years ago|reply
> And unsecured access to the graphics stack is a terrible idea.

No one gives you unsecured access to the graphics stack. WebGL shaders are parsed and modified for security (for example, inserting things like bounds checks).

(Of course, there are security risks with any new technology.)

[+] chris_wot|13 years ago|reply
Yeah, no one is "telling" John Carmack et al. to do anything. Unless you consider making an argument to be ordering folks around, in which case may I suggest you listen to this guy John who recently talked about JavaScript...
[+] daleharvey|13 years ago|reply
The post has absolutely no mention about the quality of JavaScript. It is arguing that Web technologies are 'good enough' for an extremely large class of problems, and that they have massive advantages due to a lowe barrier to entry and ubiquity.

You might want to argue those points, but this is a complete strawman.

[+] bryanlarsen|13 years ago|reply
He's not telling Carmack to use a web browser scripting engine. In fact he specifically says "Nobody pretends that the next AAA-title will be written in JavaScript."
[+] zurn|13 years ago|reply
> JavaScript is crap

You don't have to write JS though, just use something compiles to it.

> And unsecured access to the graphics stack is a terrible idea. Flash already randomly causes my GPU to crash

Letting only safe operations through to the driver is the biggest part of a WebGL implementation's job. Hopefully HTML 5, WebGL, WebRTC etc can replace Flash. I'd much rather trust those jobs to Chrome than to Flash (Flash provides accelerated 3d too these days btw.)

There's lot to be done still, and you can score bug bounties from Mozilla and Google if you manage to poke holes in Chrome/Firefox :)

[+] duaneb|13 years ago|reply
I'm pretty sure the compiled graphics code is sandboxed making an actual crash (theoretically) impossible.
[+] secoif|13 years ago|reply
Talented people like Carmack have the potential to make things less crap, if they took an interest. If they don't take an interest, things will remain the way they are for a lot longer. John Carmack should join the Chrome team.
[+] batista|13 years ago|reply
>If you are already disagreeing with me, then anything I say here won't change your mind, because you've already heard the arguments before and built up a repertoire of responses.

Really? Ever stopped to think it's you that is biased, so much that you pre-emptively null any possible responses with the above cheap trick?

[+] chao-|13 years ago|reply
I don't have enough knowledge of native graphics libraries, nor of WebGL, to speak to the core issue in this article. But, as a young'n, the last line really strikes a chord with me.

I will never experience the joy people had fiddling around with their Apple II's and I still don't know the first thing about the Commodore 64 besides the name. My attitude toward the "How will the kids ever learn unless they can tinker with it?" nostalgia that comes up on HN has always been: "Meh. No one I work with had an Apple II, and we all still ended up as tech-types."

That said, the first computer I owned myself ran Windows 98, and the first thing I learned to do with it was noodle around in HTML and JavaScript. Well, Okay. It was second thing I learned to do, after installing Sim City 2000 and wasting a week's worth of time.

It was very poignant to realize all at once how the internet provided a chance to be part of an easily-accessible ecosystem, one where you could tell a computer to do something and it just did it. Even if it was in a browser.

[+] tluyben2|13 years ago|reply
Buy an old computer from your local classifieds site/paper; it'll cost you $15 or something including working disks, mags and books. And start coding on it (and hardware tinkering if you like that); it's like a Bonzai tree; it makes a brilliant and relaxing hobby. If you do this a few hours / week, you'll get that serene feeling (at least I do :) of something which is very fulfilling without the stress of HAVING to do it (Javascript is also a job of many and that gives the mixes/stressy feelings).

In a year or so you will understand fully a) what we are on about b) how very cheap and simple things can be very fulfilling c) why 'older folks' sometimes sigh when yet a faster CPU is eaten 100% by Windows while not significant seems to have changed d) how your computer works internally ; if you are interested on the digital pulse and IC level (I can extend my MSX computers using 74series logic ICs, which is, again very fulfilling) e) how you can do stuff efficiently in very little memory on very slow computers.

That e) point is something which might not seem valuable, but it is and it still is; if you know how to do things on these computers, you understand how computers work and why some assembly code is much slower than other. Although computers are vastly more complex these days, you can extrapolate quite a bit on high level and it will be easier to read current tech documentation about hardware (and software) as well.

Anyway; I would recommend everyone to at least try this as I strongly believe it will help current generation understand better. It's also better for your children (and children of others you might know) to let them tinker and learn this young instead of playing XBOX 360 games (that's my opinion but I believe it sticks). Maybe their friends won't be as impressed with them trying to implement a ray caster on a 3.58 mhz machine, but when they get to 12 they can program the Next Great App and win science fairs while the others, well, can play Skyrim.

[+] debacle|13 years ago|reply
> We're there again: take 3 lines of JavaScript and you're drawing an image to a canvas element. Take 20 more lines and you have a rendering loop and a sprite that moves with the arrow keys.

Processing (Java), PyGame (Python), and I'm sure many other libraries can do the same thing. They're also faster, cleaner, more robust, and you're not writing some insane garbled blend of JavaScript and GLSL with all the associated scaffolding code between the two vastly differently typed languages.

I would highly recommend Processing for any graphics playing that you might do. Yes, you have to write a bit more code (it is Java, after all), but it's also much more rewarding and just as portable as something written for WebGL.

[+] swang|13 years ago|reply
Those libraries/languages don't have the user install base of javascript, which is nearly every single piece of computing that has been released in the last 10 years, albeit most of those older models probably won't be able to run the javascript that's running now.

And there is no "click download" required like those two libraries would need and also no need for patch updates. Your "download" is just pointing to a URL.

[+] DanI-S|13 years ago|reply
Not to knock Processing, but I don't see how it can be described as 'just as portable' when a WebGL-capable interpreter is already installed on millions of machines worldwide, with zero knowledge required to use it?
[+] TazeTSchnitzel|13 years ago|reply
I find it amusing that you mention Pygame, because it's a wreck with horrible performance due to software rendering, it has bad tutorials, inadequate documentation, and last time I checked had 32-bit/64-bit issues.

Source: Personal experience porting a multiplayer 2D game

Edit: By contrast, JavaScript (well, CoffeeScript) and the DOM was a much nicer experience.

[+] aw3c2|13 years ago|reply
With Web/Local Storage you are limited to 5-10 Megabytes of data.

There will be a shitstorm once graphic drivers get exploited through WebGL.

The game the writer self-promotes is a completely different genre than what id Software does (2D shmup versus a 3D FPS with detailed graphics). It eats a whole CPU core for a seemingly trivial game (might just be missing sleeping in the code, I have no clue).

If you use a good codebase, you do not need to write 200 lines just to setup your screen, eg http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenG... .

And never forget that web-based games are kinda non-free unless you can download them and play them locally. You are always at the whim of the developer/hoster/provider. I much prefer games that run natively, disconnected from the internet (attack vector) and whenever I want.

[+] dangoor|13 years ago|reply
The web platform is rapidly improving for games, on all fronts.

The HTML5 offline (appcache) spec allows you to have resources available when offline (and you don't need to write your own code to stuff things into localstorage...) Besides, localstorage is not considered, by browser hackers, to be the best idea performance-wise. They recommend IndexedDB.

Those specifics aside, my main point is to say that game makers are targeting the browser and browser vendors are very much aware of the pain points they have and are working to correct them. Browsers today evolve much faster than they did a few years ago.

(obdisclaimer: I work for Mozilla)

[+] streptomycin|13 years ago|reply
> With Web/Local Storage you are limited to 5-10 Megabytes of data.

IndexedDB has unlimited storage.

[+] ajuc|13 years ago|reply
You only need localStorage for saving game or preferences.

Static assets (like models, textures, most of the level) should be, well, static, and can be as huge, as you like them.

Also you can write html5 game as one-page website without server part, and downloading it to play it offline is as simple as file->save complete web page as.. in your browser. You can provide installer for your players that just unpacks the game to directory and places shortcut in start menu (no dll-s, no register settings), you can pack your game into chrome app format for some users and place your game in chrome app store.

One thing I think chrome gets wrong is its security policy that by default prevents local web apps (when you open html file on your disk in browser directly) from doing ajax requests on the same directory. That means you need to wrap static assets in html, and that's stupid, I should be able to load xml from the directory my index.html is stored in. But whatever, there's workaround.

I think most games don't really need super detailed 3d graphic, and simplicity of distribution (nothing to install, just click link and play) is the killer feature of html5 for simple casual games.

[+] tsahyt|13 years ago|reply
>We're there again: take 3 lines of JavaScript and you're drawing an image[...]

I think Carmack wasn't referring to how more abstractions could make his life easier. I've never had the time to dig deeply into id Software's sources (which get open sourced after a couple of years, in case someone didn't know), but what I've often heard him complain about were the abstractions themselves! This is basically about how we wrap a couple of layers around the drivers these days - drivers which have become increasingly complex.

See, abstractions are a good thing. General purpose abstractions might be a good thing for a lot of applications. For some, like graphics engines, they're not. Suppose you're working on a cutting edge 3D engine and you want to squeeze the last bit of performance from the machine. What you end up doing is talking to the graphics card as directly as possible, with the least amount of "layers of crap", as Carmack called them, inbetween you and the hardware.

General-purpose abstractions are loaded with stuff you don't necessarily need and come with quite a bit of overhead. Suppose you have 10 layers between you and the hardware, then everything you try to tell the hardware has to go through all those layers and possibly back to you. That's quite a drawback.

Since drivers have become rather complex themselves as GFX hardware has become more powerful in the last 2 decades you need quite a lot of code to talk to it properly.

The same thing goes for setting up the screen for rendering. Windows wants you to be quite verbose about what you're going to do (obviously). That's why you need 200 lines of code to do so.

The only way round that is using libraries that abstract those things away from you, but they do so at additional cost. Obviously it's possible to do the same thing in just one line of <insert your favourite language here> in the same way that it's possible to do the same thing in just a couple of lines of low level code as long as you have a library doing it for you.

However, as pointed out, in an AAA game engine, that's not what you want to do. There's a reason why the "highest common denominator" is usually D3D here. It's because D3D is still reasonably quick (although not as quick as OpenGL) and does enough things for you.

[+] duaneb|13 years ago|reply
> It's because D3D is still reasonably quick (although not as quick as OpenGL)

While I believe that OpenGL is better for everyone if only because it's an open standard, I think that one article noting a difference between the two APIs should not lead to the conclusion that "OpenGL is faster than D3D, full stop".

[+] NinjaWarrior|13 years ago|reply
I totally agree with Carmack. Why the hell crap technologies dominate all the time? HTML5 and JavaScript is the most disgusting thing I've experienced in my 20 years game programming history.

"Nobody pretends that the next AAA-title will be written in JavaScript. The community understands that it's magnitudes slower than native code"

Obviously no. Most web standard adbocates insist that all software will and should be web based. They must be criticized.

[+] joeyespo|13 years ago|reply
> Why the hell crap technologies dominate all the time?

It's because you're not looking at the bigger picture. The technology doesn't matter. It's all about the players.

Most people don't want to install something to "test out your new game" with. Even Steam is a higher barrier to entry than a web browser--and that's just a single download. Give players minimum resistance to play your game and you'll have more players.

Sharing is also huge. With browsers, it's trivial. Other systems, you need more context. More instructions. More work for the players who just want to share their experience. Or even better, for developers. "Hey, check out my new game: http://my.new/game. It's buggy, but what do you think about the controls so far?" Zero friction to sharing. Zero friction to playing.

Portability is also big. But I think in cases like JavaScript, that's more a consequence of not having to install anything.

[+] etanol|13 years ago|reply
Just like with C++. That language is a horrible mostruosity, yet projects keep migrating to it, e.g., Id's game engines, GCC, etc.
[+] rjzzleep|13 years ago|reply
op also completely misses the point. we're even further from the 4 lines than we were ever before.

sure john could just use someones library. but in the terms john was speaking, javascript + library + browser stack etc. etc. is not 4 lines it's hundreds of thousands.

there was only one prof at university i enjoyed. he would stand in the cpu design class and mock the java world and how things get slower despite us having faster cpus.

ps. i earn my money with web work

pps. javascript is a horrible language. holding my breath for dart and anything else thats not javascript

[+] phoboslab|13 years ago|reply
Yes, we're moving further and further away from the metal, but that's not the point Carmack was making when he said that getting started and pushing pixels to the screen was easier on the Apple II than it is on Windows/Linux. He didn't mean the actual machine code that is executed, but the code you have to write/understand.
[+] pwny|13 years ago|reply
It would be great if people stopped seeing native and web games as mutually exclusive. I'm a huge fan of native games and all the oomph they can dish out. Of course we're not going to see AAA titles in the browser any time soon and of course native games will ALWAYS have an advantage, at least performance wise, over browser games since they don't have the browser and javascript overheads.

That being said, there are both native and browser games that are great, just like there are some that are mediocre. The browser is imho a great place to prototype a game, make a first game as a newbie or even publish something that's not too resource hungry.

I'd even go as far as saying that WebGL will stimulate the development of native games as well. WebGL based game development is a lot closer to native game development in a way than Flash games are (at least from my limited experience) so new developers might make the switch more easily when their needs exceed what the browser can give them. Exactly the position John Carmack's company is in, although they never had the modern browser at their disposal in the past.

These are exciting times and I suffer a little bit inside whenever I see talented people arguing over them instead of making the best of them.

[+] bazookaBen|13 years ago|reply
the arguments here will cause innovation.
[+] preshing|13 years ago|reply
Why does it matter whether Carmack likes JavaScript? If he doesn't like it, it won't vanish in a puff of smoke.
[+] geoka9|13 years ago|reply
I guess it matters because Carmack's opinion carries weight in the industry.
[+] rjzzleep|13 years ago|reply
it won't vanish in a puff of smoke. but i have a feeling it will turn into the new internet explorer 6 of the web at some point
[+] duaneb|13 years ago|reply
As far as I can see the only true parallel between the Javascript/HTML/Whatever environment and Apple II basic is that it comes pre-installed on every computer. This does NOT mean that it is a good way to teach anyone. It's not. It's pretty horrible, compared to pretty much everything else.

IMHO it's a much bigger revolution in terms of being able to teach your kid from across the globe over skype (or whatever).

[+] mr_luc|13 years ago|reply
A quick aside for the people who say that Javascript stuff pegs their CPU: it's not always going to be that way.

We've got OpenGL now, and people are already writing shaders that do the work of physics and matrix rotations, etc, but OpenCL (with a C) is already popping up (you can get it running on node with a couple of different libraries, and there's a Ruby lib for it as well), which will let us write substantially more "general" code that runs on the gpu.

We were spoiled with traditional gaming; having unfettered access to the CPU, and all of the space we wanted when installing from physical media, is pretty crazy when you think about it.

I think the bigger question isn't "can Javascript be fast enough", because once the GPU is handling the physics and graphics, Javascript will be almost in the position of a traditional 3d engine's scripting language. It'll still have to do more than, say, UnrealScript. The networking code will be in JS, probably the model of the scene graph, etc. On the other hand, it's probably faster than UnrealScript; I know it's faster than TorqueScript.

Space requirements are the real killer, though. Current techniques rely on ever higher-resolution textures, 1024 pixels square or more, including additionally a displacement map (so that the textures appear three-dimensional) generally of equal resolution. These are for character textures -- the environments that they inhabit include literally gigabytes of resources that are streaming in and out of the GPU.

So almost any Modern Warfare game is never going to happen on the browser. We're talking gigabytes of content, as opposed to the megabytes we typically load even on content-heavy sites.

Nonetheless, a mixture of traditional and procedural techniques could get us a lot of the way there. Maybe use up a couple of MB on character textures, which contain difficult-to-generate details, and a few more on level geometry, but generate procedural textures and displacement maps for the environment.

I know it seems like the traditional wisdom is "never gonna happen", but that's only true so long as traditional games are "never gonna" get off the CPU and move most of their code onto the GPU (physics as well as drawing). Once the heavyweight tasks can be offloaded, a new and bewildering world opens up.

[+] donkeylips|13 years ago|reply
In 1998 you couldn't even stream a music video over the internet. In 2012 you can stream the entire game of Quake 2 through your browser in under 5 minutes. If you told me this while I was installing Quake 2 through my CD-ROM and waiting 30 minutes for it to finish, my head would have exploded.

http://playwebgl.com/games/quake-2-webgl/

[+] Johngibb|13 years ago|reply
Well, let's not say "never" going to happen... I'd like to think that _someday_ gigabit internet will be the norm. :)
[+] tszming|13 years ago|reply
If you have watched Carmack's previous keynote, he strongly believe in static typing and static analysis, not only features and performance.
[+] quux|13 years ago|reply
Anyone have a link to a video of Carmack's keynote?
[+] dsirijus|13 years ago|reply
Huh? I'm really not the one to pull in the generic argument but - there's a place for both and much more.

It's great not needing write hundreds of lines of boilerplate code to get a 2D physics game prototype running, and conversely, it is nice to get awesome graphical support using directx sdk, much of it handled in there by sane API.

Whatever floats your boat.

[+] ja30278|13 years ago|reply
As an aside, I find that I usually disagree with anyone who feels compelled to frame their argument as an 'open letter'.

In this case, I agree that javascript is ubiquitous, and has the advantage of being delivered to the end-user in (more or less) source code form. However, the language itself is a mess, and it's a bit of a shame that we seem to have gotten stuck with it for so long as the only dynamic web runtime.

I think the most annoying thing about javascript is that people who learn it for web-programming seem to insist on using it everywhere, without regard for whether it's the best tool for the job.

[+] Avshalom|13 years ago|reply
An aside to anyone who does want to just push pixels with native code in 3 lines: http://code.google.com/p/pixeltoaster/

Pixeltoaster is a dead easy to use framebuffer wrapped on top of GL/SDL. It also comes with a timer and keyboard/mouse input, it's pretty much as much fun as you can have in C++.

[+] dinkumthinkum|13 years ago|reply
JavaScript is our generation's Apple II? Look I think Javascript is great but this is just ridiculous. But then I think it's also crazy to throw away all this great work on hardware and software and only innovate for the Web where we are re-solving problems that were solved long ago just so they are "Web based."
[+] etanol|13 years ago|reply
> Right-Click -> View Source is what made the web so successful and it's awesome that we now have this for 3D graphics as well.

That can't be serious. I bet he didn't try it on GMail.

[+] WesleyJohnson|13 years ago|reply
It's how I, and many other programmers I've worked with in my age range, got started.
[+] huhtenberg|13 years ago|reply
Stage 3 of linked X-fire game on my super-duper 64bit laptop running latest FF is just plain laggy. Just saying.