Board logo

标题: [原创] 什么是“过程生成” [打印本页]

作者: Freeman    时间: 2007-8-14 13:51     标题: 什么是“过程生成”

译文见3楼!
“过程生成”专题贴:http://www.infinity-game.com/bbs/viewthread.php?tid=491


Freeman:
it seems that the Procedural Generation is the most important thing in the game!
how to understand it? is there any professional explanation about Procedural Generation?
thanks everybody!


Magellanic:
While this is no professional explanation, I do believe I have a basic understanding of the concept behind it.

Firstly, IA describes it as such:
Procedural programming is a technique to let the computer generate the game universe on-the-fly, in real-time on request, rather than manually building everything. Because of this, the generated universe can be absolutely huge. In Infinity, billions of worlds, most of them never explored by any player, are awaiting the adventurous soul.

As I understand it, it is a form of computer programming that uses mathematical algorithms with certain variables to generate the content. I believe the variables are called "seeds". Different inputs will result in different outputs of the equation. If you are VERY unfamiliar with math, then I'll use a basic algebraic statement to describe it.

5 + x = y

If x = 1, then y = 6
If x = 5, then y= 10

For every X, there is a different Y, and therefore, a variable answer. I have come to understand procedural programming as just an immensely scaled-up version of that. Using that concept, the program for Infinity can generate worlds that are different from each other, simply because they use different sets of inputs to produce a different output.

Also, because the equations are essentially set in stone, then inputting the same seed each time will result in the same output every time. Therefore, the physical data of the universe does not have to be stored on your computer, while each system retains it's own set of unique qualities, based on it's seed.


But as I said, I'm no programmer. Just an ordinary admirer. If you're looking for more, then just wait for a Dev to answer, or use Google. Sorry if I give you any erroneous information.

Delver:
Hi Freeman. I am not good with math. It hurts my head.
I think you know chinese writing more than english.
I cannot write english to describe this easy. I will try in simple words

A "Procedure" is a mathmatic formula that can be used to do something. Like draw a circle or a triangle or paint a circle or triangle. It can also be used to make complicated things. Make things like trees and planets and stars and even more complicated stuff. You can use a "procedure" to remember how stuff is supposed to look later. Now if you have something really complicated you might think that it would be hard to talk about. Math can do it easy though. It takes lots of computer work but it is easier to use math than to have someone make all the planets and stars and cities.

I could spend lots of time trying to draw a picture of a ball that looks like planet earth using a drawing program like Photoshop or 3dstudio. That will take a long time for me to do.

Instead of doing that, I can use a series of "procedures" that will create a ball, then fill it with all the islands and the water and air and even trees and animals if it was a very complicated "procedure". How can I do that? By making everything have a number. I can describe the color Red as a number like FF0000, I can describe a tree as a number and paint it with Green 0000FF

Once I make a "procedure" and I use the numbers correctly I will always make the same planet. Everything in the planet will always be where it was made to be. If I remember the numbers that tell me how to make the planet, I can tell it to you and now you can also make the same planet.

To make this short:
A procedure is a "mathmatic formula" that uses a stored or generated number to create something or tell what something is later. Think of it as a recipe about how to make something. If the number is the same and the formula is the same, then the thing we created will always be the same. If we change anything about the recipe then the thing we make will be different.

Note:
Everything in the universe could possibly made into a number. Maybe it's how the universe works. it only matters to the maker of the universe.

Freeman:
thank you very much! Magellanic & Delver
thanks for your particular explanation!

DeAdLy_cOoKiE:
I look at procedural generation in a much broader context, basically 'everything' that is 'generated'. Lots of old skool demos made use of procedural algorhitms to show off some creative and artistic stuff cuz computers were so limited in power and memory. Also a number of games made use of this (particularly to create maps), midwinter, liberation etc. It's kind of magical if you can show off some nice results just by altering parameters.

Delver:
Freeman. I hope you are able to find out a bit more information. Look into fractals because that is one of the earlier graphical representations of a procedural formula. It's all math which is way above my ability.

Getting a bit off the original question somehow I feel that the technique for this will become more and more important in the future. I postulated just a little in my last post.

Just what can be described? Just what can be created? What do we think is created? Imagine a universe (maybe only virtual for right now) that can be generated?

last edited by freeman 9.21.2007
作者: Freeman    时间: 2007-8-14 14:08

terra0nova:
Hmm, nothing is stored with procedural generation - that's the beauty of it, cached, maybe, but not stored. (Of course, modifications a player makes will have to be stored somewhere, but that's another point - you don't need to store anything for the actual generation of the planet, as long as you have x and y coordinates and a procedure to determine if a planet exists at those coordinates). Basically, given the coordinates, a procedure (using some sort of algorithm based on those coordinates, most likely using some sort of psudo-random generator using those coordinates as a seed) will generate the planet whenever you need it. You might cache a planet while you are nearby it, in case you want to visit again (to save the regeneration time), but if you ever run out of space, you can always delete everything from the cache and regenerate only what you need to.

The big problem is speed of algorithms - if we want this game to be real time (it would probably begin generating planets before you got too close to them to give it a head start), but even so, these algorithms must be FAST and scalable (generate low detail first [the actual planet], then fill in more detail as you get closer [terrain details and cities]). I don't know the speed of those algorithms, but if they are doing anything too fancy, then they are too slow, as rivers are not of the utmost importance. Though the city one seems interesting - although we would probably want an algorithm more catered to larger, more futuristic cities.


CutterJohn
Consider:

Lets pretend this is our procedural engine:

X = 2y



Now, I'm going to give everyone here that little procedural engine of mine.

Got it?

K. Now, then... Y = 5(this is also know as the 'seed'). I want everyone to pull out their calculator and solve for X.

You all got 10, yes? If you didn't, get a new calculator.



Now, my 'procedural' engine is obviously a gross simplification, but the analogy still works. Procedural is really just fancy talk for a series of equations to reach a desired answer.

So then... every client in the game will have the same equations itucked away in the game somewhere. So, when they get the same seed, the equations(identical, remember) will output the same thing on everyones computer, just as you all got the same answer to my little question up above.


Introducing Procedural Generation
The definition of Procedural Generation can be found in Wikipedia:
http://en.wikipedia.org/wiki/Procedural_generation

I won't BS anything about the power of Procedural Generation since here is a great example - a game with the size of only 96kb. Guys, check it out:
http://212.202.219.162/kkrieger

However, don't limit your imagination of Procedural Generation to just a new game coding concept. This idea of procedural synthesis is profound - to automatize some somewhat intellectual yet repetitive work that is used to be done by human. To make it even more interesting, utilizing the power of automaticity, along with a set code/procedure one can generate something that is completely mind-blowing.  The following article is about a game yet to be released, however it is much more than a game to me:
http://en.wikipedia.org/wiki/Spore_%28game%29

Enjoy
作者: ling7334    时间: 2007-10-21 23:48

Freeman:

看上去“过程生成”在游戏中占很重要的地位!怎么去理解它?有没有专业解答?诚挚谢意!


Magellanic:

没有专业解答,我相信之前我给出过基本介绍.

首先,Infinity项目负责人(IA)将其描述为:

“过程生成”是一种让电脑实时或按要求的生成宇宙的技术,而不是预先制作好。因此,创造出的宇宙理所当然很大很大。数以万亿的世界,等待着冒险者们的探索,然而大多数可能永远不会被发现。

我理解为,这是一个电脑程序,它会用数学算法创造一个多变的宇宙。我相信这多变性叫做“seeds”。(译:seed?gundan seed?我就不翻了)不同的输入会得出不同的结果。如果你十分不熟悉数学,那我就用一个简单的代数方程来解释。

5 + x = y

如果 x = 1, 那么 y = 6
如果 x = 5, 那么 y= 10

对于每一个x值,都对应着一个不同的y值,由此会得出许许多多结果。我是在ICP测试中知道的。用这个理念,我们可以创造各不相同的世界,因为我们输入了不同的数据。

而且,因为公式是不变的,只要输入相同的“seed”,就会得出相同的结果。所以,宇宙的物理参数不需要存储在你的电脑里,系统保留其特有的属性,都依赖于“seed”。

但我不是个程序员。只是个普通的玩家。如果你要更多的信息,等开IA回答吧,或用google,原谅我可能给出的错误信息。


Delver:

Hi Freeman.我对数学不是很在行。这很伤脑筋。

我想你肯定会中文。(译:haha,被看穿了)

我不能用英语简单的叙述,我试试吧。

一个程序是一个可以用来做任何事的数学公式。像是画一个圆或三角。它同样可以用来解决复杂的问题。作出树,行星或更复杂的东西。你可以让程序记住东西将会是什么样子。现在如果你有真正复杂的事,你就会想这一定很难。用数学就可以使其更简单。电脑要做很多工作,但它确实比人工制作星球,城市简单的多。

我可以用很长时间用图画软件Photoshop或3dstudio去画一张看上去很像地球图。者要很长时间。

除了做这些,如果确实太复杂,我可以用一系列的程序来创建一个球体,然后填充如岛屿,水,空气...我怎么做呢?可以给每一样物品编上号。我可以把红色描述为数字FF0000(16进制),我可以将树描述为数字,涂上绿色0000FF。

我如果正确使用这些数字画出一个星球,我就可以做出一个同样的。如果我记得画这个星球的数字,我就可以告诉你,你也可以做出一个相同的。

简而言之:

程序是一个储存或创建数字来创造东西的数学公式或告诉你这东西是什么。你可以想像成制作东西的便宜法门。如果数字相同,公式相同,我们创造的东西也永远相同。如果我改变一点,创造出来的东西就完全不同了。

注:

宇宙中的所有东西都可以编号。也许这就是宇宙的原理。我们只是上帝的玩物。


Freeman:

感谢你们Magellanic & Delver。
感谢你们现身说法。



DeAdLy_cOoKiE:

我觉得“过程生成”是在一个大空间下,所有事物都是由程序产生的.许多老套的(译:应该是old school,我讨厌学习不认真的)演示都用“过程生成”创造物体来炫耀,因为(cause,再次bs)电脑的内存在当时十分有限。当然也有用它做游戏的(特别是地图),midwinter, liberation等等。你可以通过变更参数来得出完美的效果。



Delver:

freeman,你最好再多找点资料。看看fractals(分形),这是最早的“过程生成”的图形演示。这超过我的能力了。

除了这些问题,有时我觉得这技术在未来会越来越重要。我的假设在我上个帖子写过了。

什么会被刻画?什么会被创造?想象一下整个宇宙都可以随机产生!



terra0nova:

呃,“过程生成”不会储存任何数据,这正是其美丽之处,数据可能会放在内存里,但不会在硬盘上(当然要在内存里暂存,但产生出来的行星数据,不会储存,程序会决定行星的位置)给出坐标,程序(关于坐标的算法,像是伪随机算法,把坐标作为seed[译:呵呵])就会产生出你需要的行星。行星信息可能会暂存在内存中,以防你再次来(节省时间),但你一关游戏,数据就被删除了,如果需要,将再次由程序产生数据。

最大的问题是算法的速度,如果我们要这游戏与现实时间同步(很可能你到之前,行星就已经产生好了),即使如此,这算法仍要更快更完美(可以先大致产生些数据[星球外廓],然后再慢慢填充细节[城市和地面细节])。我不知道这些算法的速度,但如果做得太花,速度就会慢下来。城市看上去很有趣,但我们想要更大,更科幻的。






太晚了,剩下的明天再译了!
作者: ling7334    时间: 2007-10-22 17:38

DeAdLy_cOoKiE:

我觉得“过程生成”是在一个大空间下,所有事物都是由程序产生的.许多老套的(译:应该是old school,我讨厌学习不认真的)演示都用“过程生成”创造物体来炫耀,因为(cause,再次bs)电脑的内存在当时十分有限。当然也有用它做游戏的(特别是地图),midwinter, liberation等等。你可以通过变更参数来得出完美的效果。



Delver:

freeman,你最好再多找点资料。看看fractals(分形),这是最早的“过程生成”的图形演示。这超过我的能力了。

除了这些问题,有时我觉得这技术在未来会越来越重要。我的假设在我上个帖子写过了。

什么会被刻画?什么会被创造?想象一下整个宇宙都可以随机产生!



terra0nova:

呃,“过程生成”不会储存任何数据,这正是其美丽之处,数据可能会放在内存里,但不会在硬盘上(当然要在内存里暂存,但产生出来的行星数据,不会储存,程序会决定行星的位置)给出坐标,程序(关于坐标的算法,像是伪随机算法,把坐标作为seed[译:呵呵])就会产生出你需要的行星。行星信息可能会暂存在内存中,以防你再次来(节省时间),但你一关游戏,数据就被删除了,如果需要,将再次由程序产生数据。

最大的问题是算法的速度,如果我们要这游戏与现实时间同步(很可能你到之前,行星就已经产生好了),即使如此,这算法仍要更快更完美(可以先大致产生些数据[星球外廓],然后再慢慢填充细节[城市和地面细节])。我不知道这些算法的速度,但如果做得太花,速度就会慢下来。城市看上去很有趣,但我们想要更大,更科幻的。
作者: ling7334    时间: 2007-10-22 17:38     标题: fractal

fractal
  由B.B.Mandelbrot于1975年提出来的分形(fracta1)理论,是20世纪70年代同混沌理论一起发展起来的,是非线性科学的重要组成部分.不同于传统的欧氏几何以零维、一维、二维、三维、四维对应的点、线、面、体和时空来描述物体的形状,分形理论用“分维”(fractal dimension)来描述大自然.事实上任何物体的微观平面都是凹凸不平的,因而欧氏几何所描述的对象,严格来讲,在现实生活中是不存在的.
    分形是用来描述大自然的一门几何学,它所描述的图形可以是分数维.分形的特征是整体和局部有严格的或统计意义下的自相似性.描述分形的定量参数为分维,而维数的定义种类很多,如相似维数、Hausdorff维数、盒维数(box dimansion)、拓扑维数(topological dimension)等,需要随研究对象的改变来选择.研究表明,分形在自然界中随处可见,例如,曲折而不规则的闪电路径,弯曲复杂的海岸线形状、密如蛛网的人体血管系统、变换不定的宇宙星云分布以及材料的组织生长、准晶态的晶体结构、材料的损伤等等.从地理学、生物学到物理学、化学甚至社会科学都普遍存在分形现象.分形理论在高分子科学中的应用研究也有很多文献报道,例如分形理论与各种现代分析手段相结合,已用于研究高分子的链结构、结晶过程、凝胶化过程、高分子的相形态结构等等方面.
   "Fractal"原是一个几何概念, 意为多维、超维或分维, 它打破了原来3 维空间的概念, 不仅可以超过3 维, 而且还可以有小数维(小数点以后 1 位、2 位或更多位数)空间。“Fractal”引用在纤维纱和织物(称为纤维集合体)中, 就是立体多层次、有不同尺度的纤维粗细、长短配合,以及存在着凹凸状点接触的纱、线织物结构。
  美国和日本都开始注意纤维的分形(Fractal)结构的研究,它们触及了纤维表面凹凸构造的自相似性与大自然的色、光的对应关系。分形理论和混沌论都是20世纪物理学的第三次革命,它研究自然界非线性过程内在随机性所具有的特殊规律性, 从字面上看是指一类极其零碎而复杂但有其自相似性的体系, 是在自然界中普遍存在的。它是用自相似、无标度方法全面描述宏观、中观、微观大自然的科学概念, 混沌是物理概念, 其几何形态则是分形的概念。
    天然纤维内在的分形维自然扭曲是其特有的一种分形结构, 它与合成纤维有本质的不同, 合成纤维的机械或化学卷曲, 包括三维卷曲都与天然纤维的从微纤的扭曲开始、自相似放大、最后导致的纤维扭曲截然不同。合成纤维中的超细旦、竹节丝、异截面丝、异收缩丝等都是1 维、2维甚至3维的整数维变化, 而天然纤维则是符合分形理论的分形维变化。
作者: yfeiy1984    时间: 2007-11-1 23:09

这意思是牺牲电脑配置为大家的吗?假设游戏很小,但这样做出来的游戏配置要求也很高  是吗?
作者: skysniper    时间: 2007-11-11 17:51

但愿不是。。。;em18; ;em18; ;em18;
作者: xhbnfcl    时间: 2007-11-11 18:57

人工生成=动物园:
我设计了一个桌子,我设计了一个人,我设计了他所有的对话,我设计了一个房间,然后设计1000个房间,那么玩家的舞台就是这1000个房间
程序生成=野生动物自然保护区
我规定了重力,我规定了摩擦系数,我规定了食物链和基因的变异概率……然后我点击“开始生成世界”,只要我不停止,这个世界就会按照我设定的规则生成下去
其实很多战略游戏的“随机生成地图”功能也勉强算是吧,比如英雄无敌系列,而强大的“程序生成”,甚至连贴图材质都可以是硬生生“算”出来的
程序生成的优点是显而易见的,无限的世界;连设计师都不知道的随机组合;以及让玩家玩起来更畅快的通用规则——如果一个门可以用锤子打碎,那么所有的门肯定都可以
不过跟一草一木皆由人设计的传统方法相比,难免会出现很多雷同的组合(因为现在的程序生成技术还不够强大),所以底层靠程序生成,然后专人加工润色是个不错的折中方案
跟机器配置什么的没关系,甚至跟服务器的配置也没关系,因为这主要是设计阶段的事儿……

[ 本帖最后由 xhbnfcl 于 2007-11-11 20:00 编辑 ]
作者: cybertarian    时间: 2008-2-2 08:54

CutterJohn
想象一下:

假如这就是我们的过程引擎:
X = 2y

那么现在我就向在座各位解释一下我的这个微型过程引擎。

请看,如果让Y = 5 (也就是所谓的‘seed’)。 每个人都拿出计算器来算一下X是多少。
都是10吧? 如果不是,去买个新的。。。

很明显,我的“过程”引擎是很简陋的,但依然是一个不错的类比。 其实所谓的“过程”就是一堆用来计算所需答案的神奇方程式组。
而游戏里的每一个客户端都内嵌了相同的方程式组。那么在给定同一个“seed”的情况下,这组方程式(完全一致的,记住)将在每一台电脑上输出一模一样的结果。这就好比你们计算如上所示的那个微型引擎必然得出相同结果一样。

作者: cybertarian    时间: 2008-2-2 09:01

过程生成简述

过程生成的定义可以在维基上找到:
http://en.wikipedia.org/wiki/Procedural_generation
由于这里已经有一个绝佳的例子了,那就不用我来跟你们吹过程生成到底有多牛了。。。一个只有96kb的游戏,伙计们,好好看看:
http://212.202.219.162/kkrieger

但是呢,不要把过程生成仅仅看作游戏编程里的概念。 过程生成的理念具有深远意义,比如它可以取代人类来自动的处理一些重复性的智能工作。 更加有趣的情况是,通过将自动性与一系列过程代码的集成,人们完全可以做到曾经不可想象的事情。下面这篇文章是介绍了一个还未发布的游戏,然而对我来说,这绝对不仅仅是一个游戏:
http://en.wikipedia.org/wiki/Spore_%28game%29

大家伙就偷着乐吧!




欢迎光临 无限星辰:失落的地球 (http://www.infinity-game.com/bbs/) Powered by Discuz! 7.2