mardi 15 février 2022

2-D World map generation

Good evening everyone. I am writing a 2-D platform. I have a world map. Here is the function which generates the world map 1000x1000.

 def generate_map_matrix():
    return [[0 for __ in range(1000)] for _ in range(1000)]  # generate the matrix

So. I have patterns they are represented as lakes. Here they are.

The representation of matrix 1      # center 2 2
    [[20 20 20 20]
     [20 20 20 20]
     [20 20 20 20]
     [ 0 20 20  0]]
    ====================
    The representation of matrix 2      # center 1 1
    [[ 0 20  0]
     [20 20 20]
     [ 0 20  0]]
    ====================
    The representation of matrix 3         # center 2 2
    [[ 0 20 20 20  0]
     [20 20 20 20 20]
     [20 20 20 20 20]
     [20 20 20 20 20]
     [ 0 20 20 20  0]]
    ====================
    The representation of matrix 4       # center 1 1
    [[20 20 20]
     [20 20 20]
     [20 20 20]]
    ====================
    The representation of matrix 5    # center 1 1
    [[20 20  0]
     [20 20 20]
     [ 0 20 20]]
    ====================
    The representation of matrix 6   # center 4 3
    [[ 0  0 20 20 20  0  0]
     [ 0  0 20 20 20 20  0]
     [ 0 20 20 20 20 20 20]
     [ 0 20 20 20 20 20 20]
     [20 20 20 20 20 20 20]
     [20 20 20 20 20 20 20]
     [ 0 20 20 20 20 20 20]
     [ 0 20 20 20 20 20  0]
     [ 0  0 20 20 20  0  0]]
    ====================
    The representation of matrix 7    # center 4 3
    [[ 0 20 20 20  0  0  0]
     [ 0 20 20 20 20  0  0]
     [ 0 20 20 20 20 20  0]
     [ 0 20 20 20 20 20  0]
     [20 20 20 20 20 20 20]
     [20 20 20 20 20 20 20]
     [20 20 20 20 20 20 20]
     [ 0  0 20 20 20  0 20]
     [ 0  0 20 20 20  0  0]
     [ 0  0 20 20 20  0  0]
     [ 0  0 20 20 20  0  0]]
    ====================
    

The main goal is to create a unique algorithm which fills the map within these matrix's on the land in order to generate a world. It must be random, but the coverage of the water on the land must be between 30-40%. Can you help meee? Pleeeeeasee!




Aucun commentaire:

Enregistrer un commentaire