MUD编程问题

发布于 2024-08-13 03:34:37 字数 546 浏览 6 评论 0原文

我曾经玩过基于 Smaug 代码库 的 MUD。它是高度定制的,但核心是相同的。我有这个 MUD 的源代码,并且有兴趣编写自己的源代码(只是为了一个有趣的项目)。不过,我有一些问题,主要是关于设计方面的问题。也许有人可以帮我?

  1. 我应该使用什么语言?解释的还是编译的?有什么区别吗? SMAUG 是用 C 编写的。我对很多语言都很熟悉,并且学习更多语言也没有问题。
  2. 我是否应该遵循某种特定的方法来不影响性能?面向对象、函数式等等?
  3. 我应该使用什么介质来存储数据?平面文件(这就是 SMAUG 使用的文件),或者类似 SQLite 的文件。两者的性能优缺点是什么?
  4. 有没有人知道如何开始这样的项目的指南?

我希望它能够扩展到允许 50 名玩家同时在线,而性能不会下降。如果我使用 Ruby 1.8(非常慢),与使用 Python 3.1(更快)或编译的 C/C++ 相比会有什么不同吗?

如果有人可以伸出援手并提供一些信息或建议,我将永远感激不已。

I used to play a MUD based on the Smaug Codebase. It was highly customized, but was the same at the core. I have the source code for this MUD, and am interested in writing my own (Just for a fun project). I've got some questions though, mostly about design aspects. Maybe someone can give me a hand?

  1. What language should I use? Interpreted or compiled? Does it make a difference? SMAUG is written in C. I am comfortable with a lot of languages, and have no problem learning more.
  2. Is there a particular approach I should follow to not hinder performance? Object Oriented, functional, etc?
  3. What medium should I use for storing data? Flat files (This is what SMAUG uses), or something like SQLite. What are the performance pros/cons of both?
  4. Are there any guides that anyone knows of on how to get started on a project like this?

I want it to scale to allow 50 players online at a time with no decrease in performance. If I used Ruby 1.8 (very slow), would it make a difference compared to using Python 3.1 (Faster), or compiled C/C++?

If anyone can lend a hand and give some info or advice, I'd be eternally grateful.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

想念有你 2024-08-20 03:34:37

我会尝试一下:

  1. 在 2009 年,对于 50 名玩家的游戏来说,这并不重要。如果您想进一步发展它,您可能想选择一种您熟悉的分析工具的语言,但由于现在 RAM 非常便宜,驱动早期 LPMUD(我有过经验)和 DikuMUD(它)的限制你的史矛革源自)不适用。 (LPMUD 可以在具有 8MB RAM 的机器上处理约 10-15 名玩家)
  2. 编程风格并不一定会导致性能困难,大型网站如 Amazon's 'obidos' webserver 是用 C 编写的,但像最初的雅虎商店这样的大型网站是用 Lisp、StackOverflow 编写的是用 ASP.NET 等编写的。我/个人/使用 C,但很多人会称我为虐待狂。
  3. 平面文件在当今时代对于大量数据存储来说毫无意义,也有特定情况的例外(例如,大型邮件服务器有时使用“maildir”,它是结构化平面文件)。游戏的大小可能意味着您不会遇到因数据检索延迟而导致的巨大缓慢,但崩溃时的数据完整性可能会成为最有说服力的论据。
  4. 不知道任何指南,但我要做的就是尝试将游戏作为一个愚蠢的聊天服务器启动,确保用户可以登录并执行某些操作(获取他们的输入并将其转储给所有其他用户) ,然后将其构建为允许特定登录,因此您将开始面临用户名/密码处理以及用户选项设置/存储/检索的挑战...然后开始添加游戏驱动程序元素(让井字游戏在游戏中运行),然后变得更复杂一点(得到一个 5 个房间的设置,使用可以拾取/掉落/互相攻击的对象),然后添加一些非玩家角色,然后担心在 Diku 衍生的 smaug 中吞食城堡/等并与他们合作。 :)

这有点即兴,我确信会有不同意见。 :) 祝你好运!

I'll give this a shot:

  1. In 2009, for a 50 player game, it doesn't matter. You may want to pick a language that you're familiar with profiling tools for, if you want to grow it further, but since RAM is so cheap nowadays, the constraints driving the early LPMUD (which I have experience with) and DikuMUD (which your Smaug is derived from) don't apply. (LPMUD could handle ~10-15 players on a machine with 8MB RAM)
  2. The programming style doesn't necessarily lead to performance difficulties, large sites like Amazon's 'obidos' webserver are written in C, but just-as-large sites like the original Yahoo Stores were written in Lisp, StackOverflow is written in ASP.NET, etc. I'd /personally/ use C but many people would call me a sadist.
  3. Flat Files are kind of pointless in today's day and age for lots of data storage, there are specific-case exceptions (Large mailservers sometimes use 'maildir' which is structured flat-files, for example). The size of your game likely means you won't be running into huge slowness driven by data retrieval delays, but the data integrity in-case-of-crash are probably going to make the most convincing argument.
  4. Don't know of any guide, but what I'd do is try to get the game started as a dumb chat server to start, make sure users can log in and do something (take their input and dump it to all other users), then build that up to allowing specific logins, so you'll start facing the challenge of username/password handling, and user option setting / storage / retrieval ... then start adding the gamedriver elements (get tic tac toe games working in game), then go a little more complex (get a 5-room setup working with objects you can pick up / drop / bash each other with), then add some non-player characters, and THEN worry about slurping in the Diku-derived smaug castles / etc and working with them. :)

This is a bit off the cuff , I'm sure there are dissenting opinions. :) Good luck!

迎风吟唱 2024-08-20 03:34:37

这是一个基于文字的游戏,对吗?在这种情况下,使用当前的硬件,似乎您所需要担心的并不是意外创建 O(n**2) 算法。即使这样对于 50 个用户来说也可能不会太糟糕。

This is a text based game, right? In that case, with current hardware, it seems all you would have to worry about is not accidentally creating an O(n**2) algorithm. Even that probably wouldn't be too bad with 50 users.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文