2D Map Generator
2D Map Generator was inspired by the concept of Cellular Automata. After implementing simple procedural cave generation for a simple unity engine game I was looking for a way to experiment with different map generation styles. I decided to go with approach that allows me to render the process as it happens so I can more clearly see the "map filter" in effect. This program proved very useful for research purposes and has been used to provide inspiration in both Demon Hunt and Radioactive Bubble Boy 2.
How it works is quite simple. First the program generates large 2D array of effectively random boolean values. Then we can on demand start filtering this array with our map filter. By default the map filter is 3 by 3 grid with only center piece deactivated. Now the filtering process goes through each position in the array and checks the center relative positions of our filter. If filter finds enough active positions it turns the current position active. If there is less then required active positions then the current position turns inactive. These results are cached and imposed on the original 2D array after whole process is complete as to avoid the "leaning" effect directly modifying original 2D array would have.
Some observation about different types of filters I've made using this program:
- Larger filters provide on first pass provide less useful erratic results but only need the second pass to give useful results.
- Minimal filters of size 3 by 3 are extremely useful for the final passes to fix fine details.
- Cross filters create strait walls and sharp corners.
- Box filters create smooth and rounded shapes.
Feel free to try and experiment.
- [Enter] Re-randomize Map
- [Space] Apply current filter to map
- [Up Arrow] Increase filter size
- [Down Arrow] Decrease filter size
- [Mouse] click on filter positions to toggle them.