I need a way to generate a world realistically. I want to generate worlds similar to dwarf fortress.
My current code for world generation is this:
worldTiles = ['^',',','.','.']
def generateWorld(self, x=40, y=20):
world = []
for i in range(y):
row = []
for z in range(x):
row.append(random.choice(self.worldTiles))
world.append(row)
return world
with the worlds it generates being this:
The world is ok, however what I want is biomes, not just completly random generation.
In case it helps, heres how the current generation works:
A variable called worldTiles has alls the tiles the world can have. This is used by the function. The function, creates an array, and appends a row to it. The row is then added to the world, as another array.
A example world might be:
[
['^', ',', '^'],
['^', ',', '.'],
['^', ''., '.']
]
No comments:
Post a Comment