I based my code off of a video I saw in which a guy does the same thing I'm trying to do but in unity. Even though the code was simple and easy to understand. I wasn't able to get it working in love. It is basically meant go check if the tiles around each tiles are empty (0) or walls (1) and if walls are greater than 4 it becomes a wall tile but if it's less than 4 it turns into an empty tile. However when I loop over the algorithm, nothing happens. It's just noise.
[SOLVED] I tried writing a procedural generation algorithm but it doesn't seem to be working and I'm not sure why
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED] I tried writing a procedural generation algorithm but it doesn't seem to be working and I'm not sure why
Last edited by MaxGamz on Sat Sep 09, 2023 1:39 am, edited 1 time in total.
Re: I tried writing a procedural generation algorithm but it doesn't seem to be working and I'm not sure why
Edit, I commented out the part of the code that smooths the map, keep in mind even if left as is (without comments) it still doesn't workMaxGamz wrote: ↑Fri Sep 08, 2023 10:19 pm I based my code off of a video I saw in which a guy does the same thing I'm trying to do but in unity. Even though the code was simple and easy to understand. I wasn't able to get it working in love. It is basically meant go check if the tiles around each tiles are empty (0) or walls (1) and if walls are greater than 4 it becomes a wall tile but if it's less than 4 it turns into an empty tile. However when I loop over the algorithm, nothing happens. It's just noise.
map.love
Re: I tried writing a procedural generation algorithm but it doesn't seem to be working and I'm not sure why
Look at your getBorderCount function:
should be:
That way, your smooth function actually works!
Code: Select all
wallCount = wallCount + map[gridX][gridY]
Code: Select all
wallCount = wallCount + map[a][b]
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
Re: I tried writing a procedural generation algorithm but it doesn't seem to be working and I'm not sure why
Oh my God that actually worked! I can't thank you enough. Only thing I need to figure out is how but at least I got something workingkeharriso wrote: ↑Fri Sep 08, 2023 11:48 pm Look at your getBorderCount function:
should be:Code: Select all
wallCount = wallCount + map[gridX][gridY]
That way, your smooth function actually works!Code: Select all
wallCount = wallCount + map[a][b]
Who is online
Users browsing this forum: No registered users and 9 guests