Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Procedural Generated 2D Map

Discussion in 'Scripting' started by Shimuni, May 27, 2020.

  1. Shimuni

    Shimuni

    Joined:
    Sep 14, 2018
    Posts:
    8
    Hello, i want to procedurally generat a map with certain rules: The player looks at a randomly generated map consisting of 4 or 5 pathways connected from left to right Pathways undulate (May have up and down ramps in them). Pathways must not have steps in them (Use appropriate east/west ramps). Pathways may be partially concealed by other pathways in front of them. Every Pathway has at least three consecutive visible, unconcealed blocks.

    i have no clue how to do it any help/tipps would be much appreciated
     

    Attached Files:

  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Hi @Shimuni,
    Since you wrote the rules, you already planned the logic you need for your map generation. Now just figure out each part of the implementation individually.

    What is causing trouble so far? Are you going to use Tilemap for visuals? But that really doesn't matter that much.

    In any case, you could probably build this kind of map as data, and then decide how to render it. So you could set the map tiles to a 2D array or 1D array and do a 2D to 1D and vice versa conversion when needed. You need to apply your constraints to the generation of your paths. How you generate your paths could vary a lot - you could use pre-built segments which you just add randomly or just generate them completely with code, applying your logic (keep track of east/west ramps and so on.)
     
    Kurt-Dekker likes this.
  3. Shimuni

    Shimuni

    Joined:
    Sep 14, 2018
    Posts:
    8
    i have no clue how to do that or what you mean :(