冒险游戏中的状态管理

发布于 2024-10-09 10:51:40 字数 305 浏览 3 评论 0原文

我一直在考虑制作一款点击式冒险游戏。我遇到的问题是以通用(而不是丑陋)的方式表示游戏逻辑和状态。

游戏状态:
你从房间里拿走了一件物品,它不应该再在那里(可以很容易地完成) 您与一个角色进行了交谈,该角色去做了一些影响另一个房间/屏幕的事情,如何保存房间和角色的状态

游戏逻辑:
你与一个角色交谈,他做了一些动画并改变了世界状态中的一些东西,你会如何设置它而不将其硬编码到游戏中?

我想这些问题是相关的,因为弄清楚如何代表国家将大大有助于弄清楚如何定义“行动”。

I have been thinking about making a point'n'click adventure game. The problem I have been running into is representing the game logic and state in a generic(and not butt ugly) way.

Game State:
You took an item from a room, it's no longer supposed to be there(could be done easily)
You talked to a character who went to do something that affects another room/screen, how to save in what state the room and character are

Game Logic:
You talk to a character, he does some animation and changes some stuff in the world state, how would you set this without hardcoding it into the game?

I guess the questions are related because figuring out how to represent the state will go a long way to figuring out how to define "actions."

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

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

发布评论

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

评论(2

有木有妳兜一样 2024-10-16 10:51:40

更好的选择之一是使用脚本语言,例如 Lua。您仅将给定房间或物品或角色可能具有的属性、它们可能如何相互关联(例如物品在房间中)以及所有真正的事情都将由脚本完成。这样做的优点是更容易调试,如果你做得正确的话(你不需要重新编译你的游戏,实际上,做得好,你甚至不需要重新启动它),但缺点是增加了一些复杂性。

此外,您可能需要考虑使用一些已经可用的游戏引擎来进行点击冒险,例如 AGSWintermute。如果您想制作一款游戏,您将希望尽可能避免编程,直接跳到游戏设计。我知道这对于程序员来说可能很难接受:)

One of the prettier options would be to use a scripting language, like Lua. You hardcode into the game only the properties that a given room or item or character might have, how they might relate to each other (e. g. item is in the room), and all the real stuff will be done by a script. This has an advantage of easier debugging, if you do it right (you won't need to recompile your game, actually, done right, you won't even need to restart it), but disadvantage of adding some complexity.

Also you may want to consider using some of the already available game engines for point and click adventures, like AGS or Wintermute. If you want to make a game, you will want to avoid programming as much as possible to jump straight to game design. I know that may be hard to accept for a programmer :)

谁与争疯 2024-10-16 10:51:40

除非您的游戏引擎包含某种脚本语言,否则您必须对某些内容进行硬编码。消除硬编码往往会将定义操作的责任推给运行时,而运行时环境将需要某种方式来定义这些操作。如果您还没有,请研究一种可嵌入语言,例如 Lua 或 Python,甚至可能是 Javascript。

Unless your game engine includes a scripting language of some sort, you'll have to hard-code something. Eliminating hard-coding tends to push the responsibility of defining actions to runtime, and the runtime environment will need some way to define those actions. If you don't have one already, look into an embeddable language like Lua or Python, or possibly even Javascript.

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