如何开始程序生成?

发布于 2024-07-06 14:58:02 字数 272 浏览 7 评论 0 原文

程序生成 最近(由 Spore、MMO 等)引起了人们的关注,而且似乎就像一种有趣/强大的编程技术。

我的问题是:

  • 您知道有使用程序生成技术的中型项目吗?
  • 什么语言/语言类别最适合程序生成?
  • 您可以使用过程生成来生成“严肃”的代码吗? (即,不是游戏)

Procedural generation has been brought into the spotlight recently (by Spore, MMOs, etc), and it seems like an interesting/powerful programming technique.

My questions are these:

  • Do you know of any mid-sized projects that utilize procedural generation techniques?
  • What language/class of languages is best for procedural generation?
  • Can you use procedural generation for "serious" code? (i.e., not a game)

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

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

发布评论

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

评论(10

只是我以为 2024-07-13 14:58:02

您可能应该从一些理论和简单的示例开始,例如 中点位移算法。 如果您对生成图形感兴趣,您还应该了解一些关于 Perlin Noise 的知识。 我用它开始了我最后一年的程序生成项目。

分形与程序生成密切相关。

TerragenSpeedTree 将向您展示程序生成的一些惊人的可能性。

过程生成是一种可以在任何语言中使用的技术(它绝对不限于C等过程语言,因为它可以用于Java等OO语言和Prolog等逻辑语言)。 对任何语言中的递归的良好理解将增强您对过程生成的掌握。

至于“严肃”或非游戏代码,程序生成技术已用于:

  • 模拟城市的增长,以规划交通管理
  • 模拟血管的增长
  • SpeedTree 用于电影和建筑演示

You should probably start with a little theory and simple examples such as the midpoint displacement algorithm. You should also learn a little about Perlin Noise if you are interested in generating graphics. I used this to get me started with my final year project on procedural generation.

Fractals are closely related to procedural generation.

Terragen and SpeedTree will show you some amazing possibilities of procedural generation.

Procedural generation is a technique that can be used in any language (it is definitely not restricted to procedural languages such as C, as it can be used in OO languages such as Java, and Logic languages such as Prolog). A good understanding of recursion in any language will strengthen your grasp of Procedural Generation.

As for 'serious' or non-game code, procedural generation techniques have been used to:

  • simulate the growth of cities in order to plan for traffic management
  • to simulate the growth of blood vessels
  • SpeedTree is used in movies and architectural presentations
情仇皆在手 2024-07-13 14:58:02

程序内容生成 wiki:

http://pcg.wikidot.com/

(如果那里没有您想要的内容) ,然后添加它;)

Procedural Content Generation wiki:

http://pcg.wikidot.com/

if what you want isn't on there, then add it ;)

有深☉意 2024-07-13 14:58:02

程序内容生成现在都是为 GPU 编写的,因此您需要了解着色器语言。 这意味着 GLSL 或 HLSL。 这些语言分别与 OpenGL 和 DirectX 相关。

虽然我个人更喜欢 Dx11 / HLSL,因为速度快、学习曲线更容易以及 Frank D Luna,更多平台支持 OpenGL。

如果您想直接开始编写着色器,而不必花费(大量)时间来设置 OpenGL / DirectX 游戏引擎,那么您还应该查看 WebGL。

程序内容从噪音开始。

因此,您需要了解 Perlin 噪声(及其后继者 Simplex 噪声) 。

Shadertoy 是学习着色器编程的绝佳参考。 我建议您在自己尝试过着色器编码后就开始阅读它,因为那里的代码不适合数学上的挑剔,但这就是程序内容的完成方式。

Shadertoy 是由一位程序天才 Inigo Quilez 创建的,他是在皮克斯工作的演示场景的产品。 他有一些 YouTube 视频 (很好的例子)现场编码会议,我也可以推荐这些。

Procedural content generation is now all written for the GPU, so you'll need to know a shader language. That means GLSL or HLSL. These are languages tied to OpenGL and DirectX respectively.

While my personal preference is for Dx11 / HLSL due to speed, an easier learning curve and Frank D Luna, OpenGL is supported on more platforms.

You should also check out WebGL if you want to jump right into writing shaders without having to spend the (considerable) time it takes to setup an OpenGL / DirectX game engine.

Procedural content starts with noise.

So you'll need to learn about Perlin noise (and its successor Simplex noise).

Shadertoy is a superb reference for learning about shader programming. I would recommend you come to it once you've given shader coding a go yourself, as the code there is not for the mathematically squeamish, but that is how procedural content is done.

Shadertoy was created by a procedural genius, Inigo Quilez, a product of the demo scene who works at Pixar. He has some youtube videos (great example) of live coding sessions and I can also recommend these.

花期渐远 2024-07-13 14:58:02

程序生成在演示场景中大量使用,以在小型可执行文件中创建复杂的图形。 威尔·赖特甚至表示,他在制作《孢子》时受到了演示场景的启发。 这可能是您最好的起点。

http://en.wikipedia.org/wiki/Demoscene

Procedural generation is used heavily in the demoscene to create complex graphics in a small executable. Will Wright even said that he was inspired by the demoscene while making Spore. That may be your best place to start.

http://en.wikipedia.org/wiki/Demoscene

呆° 2024-07-13 14:58:02

有一本关于该主题的优秀书籍:

http://www.amazon.com/Texturing- Modeling-Third-Procedural-Approach/dp/1558608486

它偏向于非实时视觉效果和动画生成,但我认为理论和想法在这些领域之外也可用。

还值得一提的是,有一个专业软件包可以实现完整的程序工作流程,称为 SideFX 的 Houdini。 您可以使用它来发明和原型化问题的程序解决方案,然后将其转换为代码。

虽然它是一个相当昂贵的软件包,但它有一个免费的评估许可证,可以用作非常好的教育和/或工程工具。

There is an excellent book about the topic:

http://www.amazon.com/Texturing-Modeling-Third-Procedural-Approach/dp/1558608486

It is biased toward non-real-time visual effects and animation generation, but the theory and ideas are usable outside of these fields, I suppose.

It may also worth to mention that there is a professional software package that implements a complete procedural workflow called SideFX's Houdini. You can use it to invent and prototype procedural solutions to problems, that you can later translate to code.

While it's a rather expensive package, it has a free evaluation licence, which can be used as a very nice educational and/or engineering tool.

§对你不离不弃 2024-07-13 14:58:02

如果您想要世界生成器模拟板块构造、侵蚀、雨影等的示例,请查看:
https://github.com/ftomassetti/lands

除此之外,还有一个文明进化模拟器:

https://github.com/ftomassetti/civs

一个充满有趣资源的博客是:

dungeonleague.com/

它现在已被放弃,但您应该阅读其所有内容帖子

If you want an example of a world generator simulation plates tectonics, erosion, rain-shadow, etc. take a look at:
https://github.com/ftomassetti/lands

On top of that there is also a civilizations evolution simulator:

https://github.com/ftomassetti/civs

A blog full on interesting resource is:

dungeonleague.com/

It is abandoned now but you should read all its posts

╭ゆ眷念 2024-07-13 14:58:02

我不是这方面的专家,但我可以尝试提供一些答案:

  1. NetHack 及其兄弟都是开源的,并且严重依赖于程序生成关卡(地图)。 链接到它的下载。
    如果您对景观/纹理/云生成更感兴趣,我建议您搜索 GamasutraGameDev 其中有很多关于这些主题的文章。

  2. 据我所知,我认为语言之间没有太大区别。 您看到的大部分代码都将采用 C/CPP 语言,因为它仍然是游戏开发人员的官方语言,但您可以使用任何您想要的语言...

  3. 这取决于您是否有一个可以从中受益的项目技术。 我看到军队模拟器中使用了程序生成(可以将其视为游戏,尽管它们的可玩性不是很好:))。

还有一个小注释 - 我的定义是,如果程序生成是从少量规则或模式以及大量随机性生成大量数据的任何东西,那么您的结果可能会有所不同:)

I'm not an expert on this, but I can try and contribute a few answers:

  1. NetHack and it's brethern are open source and rely heavily on procedural generation of levels (maps). Link to the downloads of it.
    If you are more interested in landscape/texture/cloud generation, I'd recommend you search Gamasutra and GameDev which have quite a few articles on those subjects.

  2. AFAIK I don't think there is much difference between languages. Most of the code you see will be in C/CPP because it's still very much the official language of Game Developers, but you can use anything you want...

  3. Well it depends if you have a project that can benefit from such technology. I saw procedural generation used in simulators for the army (which can be considered a game, although they are not very playable :)).

And a small note - my definition if procedural generation is anything generating a lot of data from a small amount of rules or patterns and lots of randomness, your results may vary :)

罪歌 2024-07-13 14:58:02

(十多年后...)

过程生成仅意味着使用代码来生成数据,而不是手工制作。 例如,如果您想生成一个包含各种树木的森林,您不会手动设计每棵树,因此编码可以更有效地生成变体。 它可能是树图形、大小、结构、位置的生成......

一般来说,存在某种带有一些规则交互,除了您可以添加一些你自己的随机性和逻辑,结合所有这些技术......
任何有点混乱但不太混乱的事情都可以产生有趣的结果。

以下是一些值得注意的技术:

一些以其程序性而闻名的游戏生成:

有关程序性陆地生成的视频教程。

关于游戏程序内容生成的会议,有很多关于该主题的视频: everythingprocedural

玩得开心。

(More than 10 years later ...)

Procedural generation only means that code is used to generate the data instead of it being hand made. For example if you want to generate a forest with various trees you are not going to design each tree by hand, thus coding is more efficient to generate the variations. It could be the generation of the tree graphics, size, structure, placement ...

In general there is some kind of interation with a few rules, in addition to that you can add some randomness and logic of your own, combine all of these techniques ...
Anything somewhat chaotic but not too chaotic can yield interesting results.

Here are a few notable techniques:

A few games famous for their procedural generation:

Video tutorial about Procedural Landmass Generation.

Conference on procedural content generation for games, has a lot of videos on the topic: everythingprocedural

Have fun.

自控 2024-07-13 14:58:02

最重要的是分析道路、城市、街区和建筑物的结构。 找出所有建筑物的共同点。 查看照片、地图、计划和现实。 如果你这样做了,你就会比那些认为城市建设仅仅是计算机技术问题的人领先一步。

接下来,您应该制定有关如何通过微小而独特的步骤创建几何图形的解决方案。 你必须定义构成可信城市的规则。 如果您热衷于 3D 建模,您必须重新思考您所学到的很多知识,以便计算机在任何情况下都能遵循您的指示。

为了不松懈,您应该设置许多只负责整个过程的一小部分的操作员。 这使得调试、扩展和改进您的系统变得更加容易。 在下一步中,您应该链接这些运算符并通过更改参数检查结果。

我见过太多的“城市生成器”,主要由随机形状的盒子组成,上面有一些窗户纹理:(

the most important thing is to analyze how roads, cities, blocks and buildings are structured. find out what all eg buildings have in common. look at photos, maps, plans and reality. if you do that you will be one step ahead of people who consider city building as a merely computer-technological matter.

next you should develop solutions on how to create that geometry in tiny, distinct steps. you have to define rules that make up a believable city. if you are into 3d modelling you have to rethink a lot of what you have learned so the computer can follow your instructions in any situation.

in order to not loose track you should set up a lot of operators that are only responsible for little parts of the whole process. that makes debugging, expanding and improving your system much easier. in the next step you should link those operators and check the results by changing parameters.

i have seen too many "city generators" that mainly consist of random-shaped boxes with some window textures on them : (

转瞬即逝 2024-07-13 14:58:02

回答“您知道有使用程序生成技术的中型项目吗?” - Wilder World 项目是一个 Web3,正在创建的虚拟世界,利用程序生成技术来创建 NFT 资产,我相信该虚拟世界将使用 UnReal Engine 创建。 访问 wilderworld.com 获取主站点或 zine.wilderworld.com 了解更多信息。

Answering "Do you know of any mid-sized projects that utilize procedural generation techniques?" - the Wilder World project is a Web3, virtual world being created that utilizes procedural generation techniques to create the NFT assets and I believe the virtual world which will be created using UnReal Engine. Visit wilderworld.com for the main site or zine.wilderworld.com for more info.

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