How to procedurlly generate a Zelda like make in java

The legend of Zelda maps from a while ago use a isometric tile view. The first thing you would need to do is load a isometric tile set into your program which I’m sure you can find Zelda tile sets. You then would need to decide how you want your map to procedurally generate. Will there be oceans, different biomes, building? All of theses need to be taken into consideration when making your equation for generating your map. Each tile needs to be stored somewhere so i would make a 2d array to pack all of your tile values in. Then use a nested for loop to render the tiles. The code would look something like this

int[][] world = new int[50][50];

for( int i = 0; i < 50; i++ ){
    for( int b = 0; b < 50; b++ ){
        int tile = world[i][b];
        render(tile, i, b);
        //use i and b to position the tile on your world

generating which tiles go where is a bit more tricky then rendering the tiles once they are created. Above only a empty matrix has been made. I would use a for loop again to fill the world to your liking with different int id values that represent tiles. This however would be at complete random so you need some method to your madness. I would test the surrounding tiles when generating and give the surrounding tiles a higher probability to generate so the terrain would be more smoothed out. If you want the same world for every game you play you can just supply your matrix with constant values instead of generating them. I don’t intent on writing a entire isometric view engine, but i hope some of these concepts can help you out.

Leave a Comment