实时生成二维地形

发布于 2024-09-03 20:04:56 字数 357 浏览 9 评论 0原文

我正在尝试创建一个类似于 this 的游戏(注意:当您单击“玩”时,游戏中有 SFX,您似乎无法关闭,因此您可能需要检查音量)。我特别有兴趣了解“无限”景观是如何生成的。有任何教程/文章对此进行描述吗?我遇到了程序生成,但我不太确定我应该寻找哪些主题(或者如果它甚至是程序生成)。

(我使用的是 C#,但我不介意这种语言,因为我认为它背后的理论保持不变)

I'm trying to create a game similar to this (Note:When you click 'play', there are SFX in the game which you can't seem to turn off, so you may want to check volume). In particular, I'm interested in knowing how the 'infinite' landscape is generated. Are there any tutorials/articles describing this? I came across procedural generation, but I'm not quite sure what topics I should be looking for (or if it's even procedural generation).

(I'm using C#, but I don't mind the language as I assume the theory behind it remains the same)

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

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

发布评论

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

评论(1

扎心 2024-09-10 20:04:56

这个看起来很容易复制——我想象一种算法可以计算景观的下一个“步骤”(屏幕外的部分)。它需要知道先前的高度(甚至可能是先前的坡度),以便(随机)增加或减少步长。然后,随着时间的流逝/关卡的完成,您可以将算法调整为更加流畅(轻轻倾斜)或极端(来回锯齿状)。

不过,在点击链接之前,我以为你可能在谈论体素景观——我已经有十几年没有想过这个问题了,但当我第一次看到它们时,我感到很惊讶。我做了一些谷歌搜索,并认为您可能对此感兴趣:

http://www.gamedev.net/reference/articles/article655.asp" gamedev.net/reference/articles/article655.asp

(不确定 Mars 演示是否仍然存在,或者是否有人有 DOS 机器可以玩它,但这是一个很好的例子,展示了它过去的样子例如: http://www.codermind.com/文章/Voxel-terrain-engine-building-the-terrain.html

That one seems like it would be pretty easy to duplicate -- I would imagine an algorithm that calculates the next "step" of the landscape (the part that is off the screen). It would need to know the prior height (and maybe even the previous slope) in order to then (randomly) increment or decrement the step. You could then tweak the algorithm to be more fluid (gently sloping), or extreme (whipsawing back and forth) as time passes/levels are completed.

Before I clicked the link though, I thought you might have been talking about voxel landscapes -- which I haven't thought about for over a dozen years, but amazed me when I first saw them. I did some googling, and thought you might be interested in this:

http://www.gamedev.net/reference/articles/article655.asp

(Not sure if the Mars demo still exists, or if anyone has a DOS machine to play it on, but this is a good example that shows what it used to look like: http://www.codermind.com/articles/Voxel-terrain-engine-building-the-terrain.html )

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