Saturday, December 1, 2018

procedural generation - How can I add biomes to my generated world?


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:


world it generates


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

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...