walker-level-gen
walker-level-gen copied to clipboard
Walker generates lots of duplicate locations
It's not exactly a bug, but when I tried to adapt this code for a project of my own, I kept having all kinds of issues. It turned out the root of them all was because the walker returns a list of locations that includes many duplicates. So while the code as is works fine, (because setting the tile to the same value multiple times doesn't hurt anything,) if you're creating other things to populate your map, making duplicates might be an issue. Just leaving this for others who might avoid all the headaches I encountered.
I solved this like this:
if _step():
--if !step_history.has(position):
---step_history.append(position)