CatCoding

John Carmack 的编程学习建议

2022-01-27

John Carmack 是游戏编程祖师爷级别的人物,id Software 的创始人之一。代表作有《德军总部 3D》(Wolfenstein 3D)、《毁灭战士》(Doom)和《雷神之锤》(Quake)等等,这些游戏和它们的后续版本都获取了巨大的成功。

《Doom 启示录》这本书可以说是很多游戏创作者的启蒙书。

他更是创造了游戏编程和图形学中的一些经典技术,比如他在 Doom 上第一次使用了二叉树分割技术,表面缓存技术则在 Quake 中第一次出现。

前段时间看到个说法:

衡量一职业是否越老越吃香,就看能不能在前面加上德高望重四字。例如:德高望重的医生,德高望重的老师,德高望重的鉴定师……

我想 John Carmack 是不是可以配得上这四个字?但是总感觉哪里不对,原来是年纪,其实 John Carmack 今年不过才 51 岁。

就是这样的大神,仍然对编程保持着好奇心和学习的心态,从他的 Twitter @ID_AA_Carmack 可以偶尔看到一些关于编程学习的心得和体会。

比如前几年他对函数式编程感兴趣了,所以做了一个 Scheme 脚本语言来进行 VR 开发

他提倡的学习方式是实际动手去做一些小东西,这两年他在学一些 AI 相关的东西 :

My advice to people wanting to get into game programming has been to write small games completely from scratch while also working on commercial game mods and with unity or unreal. I’m following that myself for AI — I have some C++ backprop-from-scratch projects while also learning python / pytorch / jupyter and experimenting with pretrained models. I had to give myself a bit of a kick to not dwell too much in the lowest levels, but now I am enjoying the new world quite a bit. You can do a remarkable amount with very little code, but when I actually write a loop in python because I don’t know the correct way to do something with tensor ops I get reminded just how slow python is relative to C++.

Carmark 甚至还会使用这种静修式的方式来找回编程的乐趣,完整地花费一周时间来自己实现神经网络的小项目,顺便玩一些自己用得比较少的工具:

I’m not a Unix geek. I get around ok, but I am most comfortable developing in Visual Studio on Windows. I thought a week of full immersion work in the old school Unix style would be interesting, even if it meant working at a slower pace. It was sort of an adventure in retro computing — this was fvwm and vi. Not vim, actual BSD vi.
…..
Maybe next time I do this I will try to go full emacs, another major culture that I don’t have much exposure to.

你看,当一个喜欢编程的程序员财富自由了之后,最有乐趣的事还是编程。

那大佬对学习编程有什么建议么?

简而言之还是那句话:多看,多写!

2005 年有个 14 岁的小朋友发邮件问 John Carmack 如何学习编程,他当年给了一个回复,2018 年的时候又被翻出来,虽然十多年过去了,技术变得越来越复杂,但是这仍然是学习编程的好建议:

John Carmack on Twitter: “This is still generally good advice.” / Twitter

这里完整地分享一下,顺便一起学学英语 🙌

When I started, computers couldn’t do much more than simple arithmetic and if statements – my first computer had 4k of memory. How I learned probably isn’t very relevant, because there are so much better resources available today.

Don’t expect it to be easy, you will have to work at it. Get a few more books from the library that cover beginning programming to go with the ones you have – sometimes a different author explaining the same thing will help a concept click. Go through all of them at least twice. Try to do every problem and exercise, don’t just read them and think you get it. Lots of people that want to program will talk a lot about programming, but not actually write that many programs. You should write hundreds of programs

If you want to get good at something you need to focus on it, which means choosing to exclude some other things from your life. Keep a little journal of what you are working on each day, you may find that you aren’t applying yourself all that hard. Learn something new every single day.

Avoid “cookbook programming”, where you copy and paste bits of code that you have found to make something work. Make sure you fully understand what everything it actually doing, and that you are comfortable applying the techniques in other situations.

It isn’t a bad idea to start in an environment that give you more exciting feedback, like visual basic, flash, or javascript, but you should try and “find the excitement” in even the most simple data processing tasks. There are layers and layers of things going on in just compiling and running the simplest program that are worth investigating.

Pay attention in school to the math classes. It is more important to be able to do basic algebra and trigonometry extremely well than to sort of get by in higher math classes. You should be able to ace all the tests and teach other people if you truly have a complete understanding of the subjects.

John Carmack

公号同步更新,欢迎关注👻
Tags: 写作