龙与地下城用户名_多用户地下城如何教我编程

龙与地下城用户名

by Carl Tashian

卡尔·塔什安(Carl Tashian)

多用户地下城如何教我编程 (How Multi-User Dungeons taught me to program)

“Mom, what do you want me to write? Just tell me and I’ll write a program for you.” That was me at 9, urgently tugging at my mom’s pant leg.

“妈妈,你要我写什么? 告诉我,我会为您编写程序。” 那是我9岁那年,我正紧紧地拉着妈妈的裤子。

I don’t remember what, if anything, I ended up writing in BASIC on our Timex Sinclair computer, but I do remember wanting to be taken seriously — wanting to make something that would be useful to someone. I think my dad bought that computer on a whim out of a mail order catalog, which was surprising as he’s not much of a gadget guy. We hooked it up to an old 8" black and white portable TV we had. My mom wrote a program that printed my name across the screen in an infinite loop.

我不记得我最终在Timex Sinclair计算机上用BASIC编写了什么,但我确实记得要认真对待-想要做出对某人有用的事情。 我认为我父亲是从邮购目录中一时兴起买下这台计算机的,这很令人惊讶,因为他不是一个小玩意儿。 我们将其连接到一台旧的8英寸黑白便携式电视上。我妈妈编写了一个程序,该程序可以无限循环地在屏幕上打印我的名字。

The computer was calling to me. My brother and I wrote some things in BASIC on that computer, and we were even able to load and save our programs using a cassette player attached to the audio jack of the computer. We tried playing the software cassette on a regular tape player and it sounded like screeching cicadas.

电脑在打电话给我。 我的兄弟和我在那台计算机上用BASIC编写了一些东西,我们甚至能够使用连接到计算机音频插Kong的盒式播放器来加载和保存程序。 我们尝试在普通的磁带播放器上播放软件盒式磁带,听起来像是在尖叫。

It wasn’t until later, at 14, that I really got excited about programming. I became addicted to an online adventure game — a free Multi-User Dungeon (MUD) called HexOnyx. Hex was a popular virtual world with at least a hundred people playing at any given time. Though today’s MMPORGs host millions at a time, back then a few hundred people in one virtual space seemed like a lot. I made great friends there, and each night we’d battle vicious snarling wargs and Demons of Decay together in the dungeons and dark woods. The game was entirely text-based, so imagination was mandatory. Nearly 20 years later, I still have pictures in my head of some of the old stomping grounds in the game.

直到14岁以后,我才真正对编程感到兴奋。 我沉迷于在线冒险游戏-一个名为HexOnyx的免费多用户地下城(MUD)。 十六进制是一种流行的虚拟世界,在任何给定时间至少有一百个人在玩。 尽管当今的MMPORG一次可容纳数百万人,但那时在一个虚拟空间中的数百人似乎很多。 我在那里结识了好朋友,每天晚上,我们都在地牢和黑暗的树林中与恶毒的咆哮小猪和腐朽的恶魔战斗。 游戏完全基于文本,因此必须具有想象力。 将近20年后,我仍然在脑海中浮现游戏中一些旧的踩踏场景的照片。

Every day after school was a new adventure in the MUD, until the family dinner bell pulled me back into the physical world. “I’ll be right there!” I’d shout, only to slink into the dining room much later, midway through the meal. There’s never an easy stopping point when you’re facing a four-legged lamia beast who wants your head for her next meal.

放学后的每一天都是MUD的新冒险,直到家庭晚餐钟声把我拉回了现实世界。 “我马上到!” 我大声喊叫,只是在饭后途中钻进饭厅。 从未有当你面对谁想要你的头, 的下一顿饭一个四条腿的拉米亚兽一个简单的停止点。

For months, me and my online friends battled these computer-generated creatures obsessively. I eventually advanced my character to the point of immortality, which is the effective endpoint of the game.* Immortals can no longer battle — their role was be helpful to new players, resolve disputes, file bugs, and so on.

几个月以来,我和我的在线朋友都对这些计算机生成的生物进行了沉迷的战斗。 最终,我将角色提升到了永生的地步,这是游戏的有效终点。*永生不再战斗了-他们的角色对新玩家有帮助,可以解决纠纷,解决文件漏洞等。

As I made friends with Hex’s administrators and developers, I started looking at the MUD’s design, trying to understand how it was able to trigger such a deeply immersive experience, and wondering how we might make it even better.

当我与Hex的管理员和开发人员结识朋友时,我开始研究MUD的设计,试图了解它如何触发如此沉浸式的体验,并想知道我们如何使它变得更好。

There were hundreds of MUDS at the time, and each one tried to differentiate itself. To differentiate Hex, the developers had created a custom, in-game world builder. Where other MUDs had to edit a flat text file with a confusing proprietary format, the in-game builder made writing worlds enjoyable and it allowed players to get involved easily. Yaz, Hex’s caretaker, had this to say:

当时有数百个MUDS,每个MUDS都试图与众不同。 为了区分Hex,开发人员创建了一个自定义的游戏内世界构建器。 在其他MUD必须以令人困惑的专有格式编辑平面文本文件的情况下,游戏内置工具使编写世界变得愉快,并且使玩家可以轻松参与其中。 十六进制的看守者Yaz这样说:

“The object of the game from our POV at that time was to create an environment that could be maintained from within the world. i.e.: no one would really need to run the game from the outside. We got close with the world builder.”
“当时我们POV的游戏目标是创造一个可以在世界范围内维护的环境。 即:没有人真正需要从外部运行游戏。 我们与世界建筑商关系密切。”

With the world builder, you could write a new door and a new room in the game, then step through the door into the room and see how it felt. This triggered a development boom, with many new worlds under construction, waiting to be finished and connected up with the main map of the game. These unfinished worlds were eerie places accessible only to admins and filled with bloodthirsty monsters that wandered around alone day and night.

与世界建造者一起,您可以在游戏中编写一个新门和一个新房间,然后逐步进入房间并查看其感觉。 这引发了发展热潮,许多新世界正在建设中,等待完成并与游戏的主要地图联系起来。 这些未完成的世界是只有管理员才能进入的阴森恐怖的地方,到处都是嗜血的怪物,它们昼夜徘徊。

I had no interest in building worlds; even with the world builder, it seemed like too much work. Instead I wanted to understand the mechanics of the software and make structural changes.

我对建立世界没有兴趣; 即使与世界建筑商合作,这似乎也太多了。 相反,我想了解软件的机制并进行结构更改。

Unlike modern MMPORGs, most MUDs, including HexOnyx, were effectively open source. I downloaded HexOnyx’s ancestor CircleMUD, written by Jeremy Elson, and ran it on my home computer. I’d programmed a few things in BASIC before, but CircleMUD was written in C — a whole new world for me. Just getting it to compile was a project. But gradually I figured out how to make small changes, and it was thrilling to make the MUD and see the impact of my changes locally.

与现代MMPORG不同,包括HexOnyx在内的大多数MUD实际上都是开源的。 我下载了Jeremy Elson编写的HexOnyx的祖先CircleMUD ,并在我的家用计算机上运行了它。 我以前用BASIC编程过一些东西,但是CircleMUD是用C编写的-对我来说是一个全新的世界。 只是将其编译是一个项目。 但是逐渐地,我想出了如何进行小的更改, make MUD并在本地查看更改的影响令人激动。

Typically CS concepts are taught in some contrived, boring business scenario: Customers, Orders, Products, Teachers, Courses, etc. But CircleMUD was a real, working, and fairly complex piece of software that lived in the context of a great mythical world. I was learning the fundamentals of computer science by example, tweaking functions like this:

通常,CS概念是在一些人为的,无聊的业务场景中教授的:客户,订单,产品,教师,课程等。但是CircleMUD是一个真实,有效且相当复杂的软件,它生活在一个神话般的世界中。 我通过示例学习计算机科学的基础知识,调整了如下函数:

/* * Function: find_guard * * Returns the pointer to a guard on duty. * Used by Peter, the Captain of the Royal Guard */struct char_data *find_guard(struct char_data *chAtChar){  struct char_data *ch;  for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)    if (!FIGHTING(ch) && member_of_royal_guard(ch))      return (ch);  return (NULL);}

In one short function, we have looping, conditionals, pointers, a linked list, an array, preprocessor macros, and structs. And we have Peter, the Captain of the Royal Guard.

在一个简短的函数中,我们具有循环,条件,指针,链表,数组,预处理器宏和结构。 我们有皇家卫队队长彼得。

By today’s standards, parts of Circle’s code would be judged smelly and inelegant. It had no tests, as prevention-oriented software testing hadn’t caught on yet. But to me Circle was quite beautiful. It was an example of something larger than I had ever written or even conceived of writing before. Itself a fork of the MUD project DikuMUD, written in 1990 by a few people at the University of Copenhagen, Circle had the rugged appeal of a great C program: It engaged intimately with the OS’s system calls, it was highly optimized and event-driven, and it did a lot of heavy lifting that is nowadays hidden away in libraries. It managed its own TCP sockets and I/O buffers from the ground up, defined its own game file formats, and so on.

按照今天的标准,Circle的部分代码将被判断为有臭味且微不足道。 它没有测试,因为面向预防的软件测试尚未流行。 但是对我来说,Circle相当漂亮。 这是一个比我以前写过或者甚至想写的东西都要大的例子。 Circle本身是MUD项目DikuMUD的一个分支,该项目由哥本哈根大学的几个人于1990年编写,Circle具有强大的C程序的强大吸引力:它与OS的系统调用密切相关,经过高度优化和事件驱动,并且它承担了很多繁重的工作,如今这些隐藏在图书馆中。 它从头开始管理自己的TCP套接字和I / O缓冲区,定义了自己的游戏文件格式,等等。

What would be considered bare metal today was, back then, the top of the stack. Circle’s creators did not lament the lack of dynamic typing or other higher-level luxuries — they reveled in the conveniences of flying above assembly language and of leaning into the operating system for all kinds of important tasks.

那时,如今被认为是裸机的是堆栈的顶部。 Circle的创造者们并没有为缺少动态打字或其他更高层次的奢侈品而感到遗憾,他们沉迷于使用汇编语言,并倾向于使用操作系统来执行各种重要任务。

As a result, Circle is a workhorse, and in production, Hex could run smoothly with 200+ concurrent users in under 20MB of RAM on a 486. The game runs in one big 100ms event loop which never blocks; it just services all of the currently connected users, steps the world forward by one tick, then sleeps for the rest of the cycle. I remember doing some long-running thing inside this loop and learning the hard way that it halts the game for everyone. An early lesson in optimization.

结果,Circle成为了主力军,在生产中,Hex可以在200个并发用户和486上不到20MB内存的情况下平稳运行。该游戏运行在一个大的100ms事件循环中,不会阻塞。 它只是为所有当前连接的用户提供服务,将世界向前移动一格,然后在整个周期中保持睡眠状态。 我记得在此循环中做了一些长期运行的事情,并学习了使所有人停止游戏的艰难方法。 关于优化的早期课程。

After weeks of poring over the code, and after much trial and error, I was delighted to send in a little patch that changed the style of the command prompt in the game. In a mid-90s-style pull request, I dashed off an e-mail to the Hex administrators with my patch and eagerly awaited a reply.

经过数周的代码研究,并且经过多次尝试和错误,我很高兴发送一个小补丁来更改游戏中命令提示符的样式。 在90年代中期的请求请求中,我用补丁向Hex管理员发送了一封电子邮件,并热切地等待答复。

They accepted my patch. They applied it. And it was magical to see my small change incorporated into a game that so many people played every day. The developers — mostly college-age Computer Science students — gave me feedback on my patch, as did the players.

他们接受了我的补丁。 他们应用了它。 看到我的零钱被纳入每天有很多人玩的游戏中,这真是神奇。 开发人员(主要是大学计算机科学专业的学生)向我提供了有关补丁的反馈,以及玩家也是如此。

I kept working and I sent in more small patches. Eventually Yaz got tired of playing middleman and said, “Why don’t you just made edits directly to our code.” and he created an account on the server for me.

我一直努力工作,并寄出了更多小补丁。 最终,Yaz厌倦了扮演中间人的角色,并说:“为什么不直接对我们的代码进行编辑。” 他在服务器上为我创建了一个帐户。

Implementor status on Hex was by far the most personal responsibility I’d ever felt. I started releasing new changes almost every night, receiving immediate feedback from other players. Not only was I designing and building features that I, as a veteran player, wanted to see in the game — more importantly, I was iterating inside a tight feedback loop with other users.

到目前为止,Hex上的执行者身份是我有过的最个人的责任。 我几乎每天晚上开始发布新更改,收到其他玩家的立即反馈。 作为一名资深玩家,我不仅要设计和构建游戏中想要看到的功能,更重要的是,我还在与其他用户进行紧密的反馈循环。

The feedback loop drove my work. It kept me going, through bugs that seemed unfixable and problems that seemed intractable. There was no schedule — just endless small steps every day toward a better game. I was hooked on the deep satisfaction that came with enhancing something people loved to use, and I’d reached an incredible flow state.

反馈循环推动了我的工作。 它使我得以继续前进,经历了似乎无法修复的错误和似乎难以解决的问题。 没有时间表-每天只有无尽的小步骤才能开发出更好的游戏。 增强人们喜欢使用的功能给我带来了极大的满足感,并且我达到了令人难以置信的流动状态。

I think this is a great way to learn programming: rather than saying “I want to learn to program”, start with a desire to improve something that already exists. Something people use. Expect that you will hit roadblocks and challenges, and let feedback from users and collaborators be your encouragement to persevere through those. Plenty of open source projects make this opportunity available, but I think there’s something special about the gaming environment.

我认为这是学习编程的好方法:与其说“我想学习编程”,不如说是要改进已经存在的东西。 人们使用的东西。 期望您会遇到障碍和挑战,并希望鼓励用户和合作者的反馈来坚持不懈。 很多开放源代码项目都提供了这个机会,但是我认为游戏环境有些特殊之处。

Over the following months, I learned about data structures and memory allocation. I learned about sane ways to structure procedural software. I learned about sockets, data serialization (before JSON or even XML existed), timers and interrupts. I didn’t know the vocabulary for these things beyond what I was able to read in code’s comments and in manual pages for system calls. But I was hooked. Coding for the MUD was all I thought about at school each day, and all I did at home each night.

在接下来的几个月中,我了解了数据结构和内存分配。 我了解了结构化程序软件的明智方法。 我了解了套接字,数据序列化(在JSON甚至XML存在之前),计时器和中断。 除了在代码注释和系统调用手册页中无法读取的内容外,我还不知道这些词汇。 但是我迷上了。 我每天在学校里想的都是MUD编码,每天晚上我都在家做。

I added a host of new features over the next year or two. I expanded the MUDs internal economy, building a housing system (virtual storage lockers, really) and a real estate market for them. I introduced scarcity of goods into the game’s economy, writing an algorithm that limited the rate at which the best equipment would be introduced into the world. I acted as an invisible hand, making the game more fun and challenging for people, and it was a blast.

在接下来的一两年中,我添加了许多新功能。 我扩大了MUD的内部经济,为他们建立了住房系统(实际上是虚拟储物柜)和房地产市场。 我将商品的稀缺性引入到游戏的经济中,编写了一种算法,该算法限制了将最好的设备引入世界的速度。 我扮演了看不见的角色,这使游戏对人们来说更加有趣和具有挑战性,这是爆炸。

The fun of being a developer pushed me to learn more and strive to build more things that people wanted. I’m an engineer today because of that experience. I’m grateful that CircleMUD was malleable open source code, and that Yaz took a leap of faith in handing the keys over to me at just 14 years old.

成为开发人员的乐趣促使我学习更多知识,并努力构建人们想要的更多东西。 由于这一经验,我今天是一名工程师。 我很高兴CircleMUD是可延展的开源代码,并且Yaz在14岁那年就将密钥交给我的态度上有了飞跃。

I love a medium where you can approach as a consumer and smoothly transition into a producer. Today, Minecraft allows for some modifications in a simple, constrained environment and could be a good gateway for budding programmers. But the art of programming still has a long ways to go before it can be universally accessible. The most popular multiplayer games of today are largely immutable to players. Because popular games like WoW are not open source, it seems harder to get into the role of core contributor on a real, living, breathing system.

我喜欢这种媒介,您可以以此作为消费者并顺利过渡为生产者。 如今,Minecraft允许在简单,受限的环境中进行一些修改,并且可能成为初露端倪的程序员的良好门户。 但是,编程艺术在普及之前仍然还有很长的路要走。 当今最流行的多人游戏对玩家来说是一成不变的。 由于类似《魔兽世界》这样的流行游戏不是开源的,因此似乎很难在真正的,生活的,呼吸的系统中扮演核心贡献者的角色。

I’d love for the next generation of programmers to have as much fun learning to program as I did. Changing the game is a lot more interesting than playing it.

我希望下一代程序员能够像我一样开心地学习编程。 改变游戏比玩游戏有趣得多。

Originally published on my personal website. Thanks to Siobhán K Cronin for proofreading.

最初发布在我的个人网站上。 感谢SiobhánK Cronin的校对。

如果到目前为止,您应该加入我关于技术和人文的邮件列表(If you made it this far, you should join my mailing list about technology and humanity.)

翻译自: https://www.freecodecamp.org/news/how-i-learned-to-program-f196a5a8bfd3/

龙与地下城用户名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值