2D瓷砖地图生成瓷砖、地图

由网友(遛皮肤)分享简介:我正在开发一个2D的瓷砖引擎,并在这一刻我工作的地图生成算法。我尝试了基本的人通常从事简单的高度图生成像山代在柏林噪声在钻石广场但我总是得到同样的问题:当用瓷砖地图,也有高度的组件处理这种算法似乎合适的,但这不是我的情况。我基本都如草,海洋,沙漠等精灵,但根据生成的高度,但像的东西,他们不应该被放置在地图内一切开始...

我正在开发一个2D的瓷砖引擎,并在这一刻我工作的地图生成算法。

我尝试了基本的人通常从事简单的高度图生成像

山代 在柏林噪声 在钻石广场

但我总是得到同样的问题:当用瓷砖地图,也有高度的组件处理这种算法似乎合适的,但这不是我的情况。

我基本都如草,海洋,沙漠等精灵,但根据生成的高度,但像

的东西,他们不应该被放置在地图内 一切开始于海洋 在岛屿被放置在地图的中间(这是我试过的算法失败居多) 在沙漠中产生(他们应该是这样的随机点左右) 在山区和丘陵链催生了(他们应该像蛇)

我应该尝试什么样的做法?

我通过制定专门的算法做什么,我需要(例如山开始从一个点,然后按照与转向的机会的方向)解决了这个问题,子组件(如沙漠,丘陵和山区),但我没有用的基本岛屿的生成(可以是可定制的,以只是一个盘古或多少度大小的)。

只给你我正在寻找一个切实可行的想法是一样的东西文明的算法:

解决方案   

[山代,培林,钻石广场] ...这种算法时瓷砖地图,也有高度的组件处理似乎合适的,但这不是我的情况。

但它是你的情况。山区比平原高,平原比水高。

  ___ /
                    ___ / ___山截止
                ___ /
         ______ /
    ____ / ___停水
__ /
 

可以量化数据,以便如果它是一组水平之间,它被算作一次型瓦的,而当它是在一个不同的范围,它是一种不同类型的砖。你会抛出一些细节,但你仍然可以得到相匹配的噪音,你生成型轮廓。

这可能会需要调整的一个良好的数额,并要求你产生其他土地功能(除了不觉山)自己,但你必须要调整很多与任何内容生成解决方案。

I'm developing a 2D tile engine and at this moment I'm working on map generation algorithms.

关于游戏开发中地图瓷砖贴图的过渡 tile

I tried the basic ones usually involved in simple heightmap generation like

hill generation perlin noise diamond square

but I always get the same problem: this kind of algorithms seems suitable when dealing with tile maps that also have a height component but this is not my case.

I basically have sprites like grass, sea, desert and so on but they shouldn't be placed inside the map according to a generated height but something like

everything starts from ocean islands are placed in the middle of the map (this is where algorithms that I tried failed mostly) desert are generated (they should be like random spots around) mountain and hills chains are spawned (they should be like snakes)

What kind of approach should I try?

I solved the subcomponent problems (like deserts, hills and mountains) by developing specialized algorithms to do what I needed (for example mountain starts from a point and then follow a direction with a chance of turning) but I'm failing with the generation of the basic islands (which could be customizable to be just a pangea or many degrees of size).

Just to give you a practical idea what I'm looking for is something like the civilization algorithm:

解决方案

[hill generation, perlin, diamond square] ... this kind of algorithms seems suitable when dealing with tile maps that also have a height component but this is not my case.

But it is your case. Mountains are higher than plains, and plains are higher than water.

                        ___/
                    ___/ ___ Mountain cutoff
                ___/
         ______/
    ____/ ___ Water cutoff
__/

You can quantize your data so that if it is between one set of levels, it is counted as one type of tile, whereas when it is in a different range, it is a different type of tile. You'll be throwing out some detail, but you'll still get outlines that match the type of noise that you're generating.

It'll probably take a good amount of tweaking, and will require you to generate other land features (besides impassible mountains) yourself, but you'll have to tweak a lot with any content generation solution.

阅读全文

相关推荐

最新文章