在 MMO 中保存数据

发布于 2024-10-15 08:31:43 字数 319 浏览 2 评论 0原文

您对于在 MMO 游戏中保存数据(例如角色统计数据、成就、物品)有何看法?显然,如果服务器由于某种原因发生故障,您希望尽可能少地丢失数据。

  • 当重要的事情发生时拯救角色?就性能而言,看起来很神经质?
  • 每 X 小时保存一次所有内容?导致几秒钟的冻结,但可能会伴随着一条漂亮的“世界正在拯救”的消息。
  • 也许为每个角色都有一个保存计时器,您可以在其中每隔一段时间将角色排队保存一次,并且服务器在不忙时就在该队列上工作?

在这三个中,我认为最后一个是一个非常好的解决方案,但我可能忽略了一些东西。 但你有什么想法,“大男孩”们是怎么做的呢?

What are your thought about saving data (such as character stats, achivements, items) on a MMO game? Clearly you want as little dataloss as possible if(when) the server goes down for some reason.

  • Saving the character whenever something important has happend? Seems jumpy, performancewise?
  • Saving everything once very X Hours? Causes a few seconds freeze, but could be accompanied with a nice "The world is saving"-message.
  • Maybe having a save-timer for every character, where you queue the character for saving every once in a while, and the server works on this queue whenever it is not busy?

Out of these three i think the last one is a pretty good solution, but i might have overlooked something.
But what are your thoughts, how are the "big boys" doing it?

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

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

发布评论

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

评论(4

怪异←思 2024-10-22 08:31:43

随时保存角色
有什么重要的事情发生了吗?似乎
神经质,性能方面?

一点也不。与此类游戏所需要做的所有其他事情相比,这完全是微不足道的。任何像样的数据库引擎都可以处理这个问题。这就是他们的目的。

Saving the character whenever
something important has happend? Seems
jumpy, performancewise?

Not in the least. Compared to everything else that has to be done for such a game, this is utterly trivial. Any decent database engine will handle that. That's what they're built to do.

耶耶耶 2024-10-22 08:31:43

我会为我的数据库使用直写式缓存。角色的大多数方面都不会经常改变。那些确实需要做的事情,比如职位,已经需要一些相当繁重的工程来保持服务器和客户端之间的一致性。

I would use a write-through cache for my database. Most aspects of a character don't change very often. Those that do, like position, already require some pretty heavy engineering to keep coherent across servers and clients.

烦人精 2024-10-22 08:31:43

也许制作一种缓存服务器。游戏服务器将向缓存服务器发送读/写请求,缓存服务器将从数据库写入/读取内容并将其发送回游戏服务器。这样,如果某些查询变得滞后,它不会停止游戏服务器中的线程,如果服务器出现故障 - 缓存服务器仍将缓存数据并保存它(如果尚未保存)。

maybe make a sort of cache server. game server would send read/write requests to cache server, cache server would write/read stuff from db and send back to game server. this way if certain query gets laggy it wont stop thread in gameserver, if server goes down - cahe server will still have cached data and save it if not saved already.

网名女生简单气质 2024-10-22 08:31:43

我写了这篇http://onemanmmo.com/?doubleentry,同时解决了如何记录微交易并保证它们在我的游戏服务器崩溃。本文介绍了在 MySQL 之上使用复式记账数据库模式以及有关存储过程和安全性的一些信息。

I wrote this http://onemanmmo.com/?doubleentry while solving how to record microtransactions and guarantee they survive a server crash for my game. The article is on using a double-entry accounting database schema on top of MySQL with some info on stored procedures and security.

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