Generated Content
Now that I'm past the boring stuff of setting up the game, it's time to move on to the fun part: implementing procedural generation algorithms. In this dev log, I'll go into which generation tools I used and why.
First, I wanted to create the land mass. I researched with Google and ChatGPT and found that perlin noise is commonly used for this. I used ChatGPT to write a method for making an ASCII land mass with perlin noise. However, my first attempt was not a success because it used libraries I did not have access to in this project. So, I looked up ones online and through trial and error, I finally got it working using perlin noise methods written by ChatGPT and modifying it with what I learned online, including adding a random seed parameter.
The results were not what I wanted, as I was not getting the land masses I envisioned. So, I tried checking the distance from the center and modifying the magnitude based on that. Then, ChatGPT recommended using a fall-off map. After doing some research, I got ChatGPT to write a fall-off map function. Online, there were different ways of combining the fall-off map with the perlin noise, either by multiplying them together or subtracting the fall-off map from the perlin noise. The latter did the trick for me, and after some tweaking, I finally got the results I wanted.
Next, I wanted to generate dungeons. I asked ChatGPT and Google for the common and easy-to-implement maze algorithms. There was Prim's algorithm, but that looked too mazy, I wanted to have rooms and hallways. So, I researched the recursive division method and wave collapse function, and then I came across cellular automata. I love cellular automata and always wanted to make a project that employed it, but looking at the results, it was not what I wanted. Maybe I should have used it for land mass generation, but it was too late for that.
Instead, I chose the random walker algorithm because it seemed like the best way to make a space that all areas would be accessible. I went through many different iterations of random walkers, but I kept getting bad results: just one corner would be a big room, and the rest of the map would still be covered. I asked ChatGPT for solutions, and it suggested different solutions, from changing the steps to adding multiple walkers. I thought multiple walkers would solve the problem and create different paths to explore. So, I rewrote the method to have multiple walkers, which required making a RandomWalker class and randomly creating a new walker. Unfortunately, the results were the same: the walkers would walk on the same tiles as the other ones, overlapping and crisscrossing each other's paths.
ChatGPT suggested using attractors and repulsers to keep the walkers apart, but this seemed a little complicated, and I wanted to keep the code simple. So, I wrote a condition so they would not walk over a tile that was already walked over, and now I was making progress. After more iterations, I removed all the extra walkers, going back to a single walker. Then, I removed the step count and changed it to stop when a certain percentage of the map was uncovered. Finally, it was done.
Now, I wanted some random names. At first, ChatGPT just kept suggesting a list of names that were randomly selected, but that's not what I wanted. I wanted randomly generated names! I knew that just randomly choosing letters would result in gibberish, so I asked ChatGPT what I could use, and it told me about Markov chains.
I got ChatGPT to create a Markov chain name generation script, and it worked really good! Markov chains use a list of sample names to analyze and generate new names based on the patterns it finds in the sample data. So I used ChatGPT to generate lists of medieval male and female first names, last names, and location names to use as samples for the Markov chain name generator class.
With that, most of the procedural generation was finished. I made some aesthetic changes to the maps, but that's a topic for another time. I'm planning on creating tutorials for all of these techniques, so others can learn and use them in their own projects.
Endless Prose
The long awaited 3rd addition to the Epic Prose series!
Status | In development |
Author | logicandchaos |
Genre | Role Playing |
Tags | Text based |
More posts
- Finishing the LibraryApr 05, 2024
- Text Adventure Library - Builder PatternMar 27, 2024
- Text Adventure Library - Slaying the Spaghetti Monster!Nov 22, 2023
- From Prototype to ProductionSep 25, 2023
- Redesign!Jul 22, 2023
- Improving the Name Generator using ChatGPTApr 20, 2023
- Creatures & Encounters!Mar 30, 2023
- Travelling Across The MapMar 23, 2023
- Exploring DungeonsMar 13, 2023
Leave a comment
Log in with itch.io to leave a comment.