领土地图生成

发布于 2024-07-05 00:52:39 字数 279 浏览 12 评论 0原文

是否有一种简单的或至少相当直接的方法来生成领土地图(例如风险)?

我回顾过过去,我能找到的最好的就是对 Voronoi 图的模糊引用。 Voronoi 图的示例如下:

here

这些很有希望,但我想我还没有看到任何直接的渲染它们的方法,更不用说以某种形式的数据结构保存它们以将每个区域视为一个对象。

另一种有希望的方法是洪水填充,但我再次不确定开始这种方法的最佳方法。

Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)?

I have looked in the past and the best I could find were vague references to Voronoi diagrams. An example of a Voronoi diagram is this:

here.

These hold promise, but I guess i haven't seen any straight-forward ways of rendering these, let alone holding them in some form of data structure to treat each territory as an object.

Another approach that holds promise is flood fill, but again I'm unsure on the best way to start with this approach.

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

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

发布评论

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

评论(4

塔塔猫 2024-07-12 00:52:39

我见过的最好的参考文献是计算几何:算法和应用,其中涵盖了 Voronoi 图、Delaunay 三角剖分(类似于 Voronoi 图,并且可以相互转换)以及其他类似的数据结构。

他们讨论了您需要的所有数据结构,但没有为您提供实现它所需的代码(这可能是一个很好的练习)。 在代码方面,亚马逊搜索显示了Computational Geometry in C这本书,其中大概附带了代码(尽管由于您陷入了 C 语言,您也介意获得另一种并用您想要的任何语言实现它)。 我对这本书也没有任何经验,只有第一本。

抱歉,只有书籍可以推荐! 我见过的唯一像样的在线资源是两个 维基百科 文章,它并没有真正告诉您实现细节。 此链接可能会有所帮助。

The best reference I've seen on them is Computational Geometry: Algorithms and Applications, which covers Voronoi diagrams, Delaunay triangulations (similar to Voronoi diagrams and each can be converted into the other), and other similar data structures.

They talk about all the data structures you need but they don't give you the code necessary to implement it (which may be a good exercise). In terms of code, an Amazon search shows the book Computational Geometry in C, which presumably comes with the code (although since you're stuck in C, you'd mind as well get the other one and implement it in whatever language you want). I also don't have any experience with this book, only the first.

Sorry to have only books to recommend! The only decent online resource I've seen on them are the two Wikipedia articles, which doesn't really tell you implementation details. This link may be helpful though.

为什么不使用基元地图(三角形、正方形),分配国家/地区的起点(“首都”),然后通过向国家/地区添加随机相邻基元来随机扩展国家/地区。

Why not use a map of primitives (triangles, squares), distribute the starting points for the countries (the "capitals"), and then randomly expanding the countries by adding a random adjacent primitive to the country.

池木 2024-07-12 00:52:39

CGAL 是一个 C++ 库,具有计算几何中使用的数据结构和算法。

CGAL is a C++ library that has data structures and algorithms used in Computational Geometry.

墨洒年华 2024-07-12 00:52:39

事实上,我正在为我公司的视频游戏处理这类事情。 我发现的最有用的信息在这两个链接:

Paul Bourke 在 UWA 的页面,其中包含他 1989 年关于 Delaunay 的论文以及一系列实施链接。

对伪代码和视觉效果的精彩解释在 codeGuru.com 上做 Delaunay 的经历。

在渲染这些方面 - 我发现的大多数实现都需要按摩才能获得您想要的东西,但由于将其用于游戏地图会导致许多点加上它们之间的线,因此这可能是一个非常大的问题将其绘制到屏幕上很简单。

I'm actually dealing with exactly this kind of stuff for my company's video game. The most useful info I've found are at these two links:

Paul Bourke's page at UWA, with his 1989 paper on Delaunay and a series of implementation links.

A great explanation of the psudocode and a visual of doing Delaunay at codeGuru.com.

In terms of rendering these - most of the implementations I've found will need massaging to get what you'd want, but since using this for a game map would lead to a number of points plus lines between them, it could be a very simple matter to do draw this out to screen.

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