Spacing out walls in a procedural maze.

Hey All,

So I’ve kinda stumped myself and would like some help.

I’m making a maze and the walls are kind of close together so it feels reaaallly claustrophobic

They way it works is that it generates 1’s and 0’s in a grid.
What I would like is have either above or below the other zero so theres another space so the palyer doesn’t feel claustrophobic. The problem is I have no idea what to change or add to let me succeed in that. The code that generates it all is this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MazeDataGenerator  {

    public float placementThreshold;

    public MazeDataGenerator()
    {
        placementThreshold = .1f;
    }

    public int[,] FromDimensions(int sizeRows, int sizeCols)
    {
        int[,] maze = new int[sizeRows, sizeCols];
        int rMax = maze.GetUpperBound(0);
        int cMax = maze.GetUpperBound(1);

        for (int i = 0; i <= rMax; i++)
        {
            for (int j = 0; j <= cMax; j++)
            {
                //Outer walls
                if (i == 0 || j == 0 || i == rMax || j == cMax)
                {
                    maze[i, j] = 1;
                }

                //Inner walls
                else if (i % 2 == 0 && j % 2 == 0)
                {
                    if (Random.value > placementThreshold)
                    {
                        maze[i, j] = 1;

                        int a = Random.value < .5 ? 0 : (Random.value < .5 ? -1 : 1);
                        int b = a != 0 ? 0 : (Random.value < .5 ? -1 : 1);

                        maze[i + a, j + b] = 1;
                    }
                }
            }
        }

        return maze;

    }
}

Any help would be really great!

Thank you

Squizy

I would say what you did worked perfectly and should keep it as is. Rather you can when you Instantiate the prefabs you should use a scaling value to both place them apart and scale the transform property. The Logic will go something like this: (Not Actual Code)

Maze = 

1 1 1 1 1
1 0 0 0 1
1 1 1 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1

scale = 2;

scale * maze = 

2 2 2 2 2
2 0 0 0 2
2 2 2 0 2
2 0 2 0 2
2 0 0 0 2
2 2 2 2 2

wall.transform.scale * scale