The Dungeons Of Tweet_Dungeon
Can't have a dungeon-crawler without dungeons! Today we'll look at how the dungeons in Tweet_Dungeon take form, and what you can expect to encounter while traversing these dangerous-depths!
Making Fun Dungeons
In yesterday's dev-log, I talked about the tools we're using to help build Tweet_Dungeon. In it, I showed-off the "Cavern Crafter" app I made to help speed up the process of making rooms (or as they're referred to in Tweet_Dungeon terms: caverns).
Due to the way the game is played (turns taking 20 minutes to resolve), it's important that each cavern you enter is fun & filled with interesting stuff. That's why I decided to skip "total-random-generation", and instead opt for more of a "semi-random" method. Me & my project-partner, ROLLINKUNZ use the Cavern Crafter to design a bunch of caverns, then my code takes care of the rest. This gives us a little more control over what you'll encounter, ensuring fun & fair gameplay.
Making Dungeons. Fun?
The first version of this code actually just generated a bunch of totally random sized "pockets" and placed them randomly all over a map:
Each of these "pockets" of open, walkable space, were added to a list. I then iterated over that list, adding connection hallways between room to room:
This worked well enough, but was a bit too linear. Plus, we decided on implementing a MAP command, where players could request to see an overview of the entire dungeon that they've explored so far. The MAP command would return an emoji-based map, like the following:
Because of this feature, we would have to ensure that each room / cavern in the dungeon is aligned to a grid. Thus, the new dungeon-generation method was born!
Making Fun, Dungeons?
Well... of course, it wasn't without a few bumps & bruises along the way... Glitches are, in every game-dev project, to be expected:
sometimes things get glitchy...
But this got remedied and thankfully dungeons now look pretty. Here's a bit of a step-by-step in how this all goes down:
PREVIEW
EXPLANATION
First, we create a grid based on how many caverns wide & how many caverns tall we want our dungeon to be, multiplied by the size of each cavern
Then, we randomly choose caverns from our "cavern stack" (which is just an array of caverns that we've created by hand) and place them into these empty grid slots. BUT! That doesn't look so good, we should add hallways connecting the rooms together!
So, we add a 1-tile sized buffer between all rooms, this will be the hallway. Then, we need our code to find where we placed our "hallway entry points" (the little 1-tile sized holes in the wall) for each cavern (in this example, they all match up & are aligned, but that's not always the case)
We then add these entry points to one of four lists: Top points, Right points, Bottom points, Left points, depending on where they're located. We loop through the "Right points" list, connecting each point to their neighbor in the "Left points" list.
Apply the same loop from the above step, but do so for the "Top points" list & the "Bottom points" list. Now you've got connected caverns!
Making Dungeons Fun!
Now that we got a stack of caverns to randomly place throughout the dungeon, as well as hallways that connect to various points, our dungeon system is ready for prime-time fun, and it looks great as well!
bunch of randomly-generated dungeons, with no duplicated rooms per map
And there you have it, semi-random, grid-based, cute little emoji dungeons that you can keep exploring until the inevitable heat-death of the universe! Enjoy!
What Is Tweet_Dungeon? 😶💀
Tweet_Dungeon is a Twitter-based dungeon-crawling roguelike game, where the entire game (moves, attacking, looting, exploring, etc.) takes places entirely on Twitter. Players vote on what the little adventurer will do using Twitter polls. Turns are 20 minutes long, and updates constantly all day long.
Follow along with my progress where each day I'll post a short dev log showcasing the latest stages of the gameplay. Will I be able to make the deadline of Thanksgiving (November 28th, 2019)? Only the game-dev-gods can tell...
T-4 DAYS... 👉 Follow Tweet_Dungeon On Twitter To Play When The Game Launches! 👈