Ejemplo n.º 1
0
def generate_world(w=None, seed=117):
    if w == None:
        w = world.World(seed=seed)

    # Set altitudes using simplex noise
    terrain.generate_simplex_noise_terrain(w.all_boundary_nodes, seed)

    print("Generating wind speed and heading")
    wind.generate_wind(w.all_boundary_nodes, w.all_cells, prevailing_wind_bearing=270)  # generate overall westerly wind
    print("Flood-filling oceans starting from the deepest point")
    terrain.flood_fill_ocean(w.all_boundary_nodes)
    print("Generating temperatures")
    temperature.generate_temperature(w.all_boundary_nodes)
    print(
        "This world is {}% ocean".format(
            int(
                round(
                    100.0
                    * float(len([n for n in w.all_boundary_nodes if n.get_feature(["surface", "type"]) == 0]))
                    / float(len(w.all_boundary_nodes))
                )
            )
        )
    )
    print("Generating rainfall")
    # precipitation.generate_rainfall()
    precipitation.generate_rainfall_from_temperature(w.all_boundary_nodes)
    # Increase voronoi cell density along coastlines
    terrain.refine_coastlines(seed, w)

    terrain.grow_random_altitude_spike(w.all_boundary_nodes)

    return w
Ejemplo n.º 2
0
def generate_world(w=None, seed=117):
    if w == None:
        w = world.World(seed=seed)

    print("Generating normal altitudes")
    terrain.generate_uniform_altitudes(w.all_boundary_nodes, target_wateriness=0.55)
    print("Generating a big mountain and a deep trench")
    terrain.generate_altitude_extremes(w.all_boundary_nodes)
    print("Generating wind speed and heading")
    wind.generate_wind(w.all_boundary_nodes, w.all_cells, prevailing_wind_bearing=270)  # generate overall westerly wind
    print("Flood-filling oceans starting from the deepest point")
    terrain.flood_fill_ocean(w.all_boundary_nodes)
    print("Generating temperatures")
    temperature.generate_temperature(w.all_boundary_nodes)
    print("This world is {}% ocean".format(int(round(100.0*float(len([n for n in w.all_boundary_nodes if n.get_feature(['surface', 'type']) == 0]))/float(len(w.all_boundary_nodes))))))
    print("Generating rainfall")
    # precipitation.generate_rainfall()
    precipitation.generate_rainfall_from_temperature(w.all_boundary_nodes)

    return w