Terrain/Land Generation Algorithms with Map
Hey guys! It's been a long time since I've opened up repl.it and done some coding. (I took a break over the summer, my latest post being HyperTyper) So many new things. Teams, and the discord community has grown so much.
@Coder100 got 2K cycles and passed me...
This is a project I started before the summer and have finished today. If you can remember, @DynamicSquid developed a simple terrain generation algorithm. I was inspired by this project, and added a few features.
#1) I created an HTML, CSS, JS repl in order to make it easier to read the map.
#2) After creating a random algorithm and recreating Squid's classic one, I decided it wasn't enough. I went through and added a couple more.
1 (a_random): Iterates over every tile selecting water or land with a 50/50 chance.
2 (a_classic): Iterates over every tile selecting water or land. Then repeats over the map 4 times, checking if a water tile is surrounded by 4+ land tiles. If True, the water tile becomes a land tile.
3 (a_rivers): Iterates over every tile, with a 1/50 chance of a water tile. Repeats over the map 2 times finding the water tiles. Tries to build a water tile above, to the right, left, or below. (In order of attempts).
OKKKKKKKKKKKK... These are starting to get a little complicated. If you are curious look at the source code in the repl. I'm going to skip these.
If you want to toggle an animation, regenerating a new map every 1 second, click the animate button. Regenerating manually press regenerate. Don't get offended at my stylesheet, that's not the point of the page.
If you create another one, I might add it. Make sure it's in JS and follows the same structure as the other functions.
Thanks, and have fun expirementing!
PS: Comment your favorite algorithm!
Starts with all water, places a R-pentomino in center (as land) and iterate for 2000 generations
I do, but I just want you guys to know that @Coder100 is a great coder as well. Otherwise he wouldn't be ahead of me. Also, cycles are the main point of repl.it. I mean, sure the convey your popularity, and what the community thinks of your work, but they relate to your projects. Projects/coding are the most important part of repl.it. Thanks for your support though :) @dabs364
I took a road trip, visited a ranch, and went on a backpacking trip. I also had a trip to hawaii and one to florida canceled because of the coronavirus. I haven't coded over the summer the past 3 years I've used repl.it. I also didn't have a lot of internet connection and access to technology. @DynamicSquid
this is awesome dude! I have an idea that could be cool, if you don't like it that's fine, but hear me out. There is a button that will pick from a random algorithm each time, so maybe one time it will be a river, and the next a set of islands