We both have had our share of late-night D&D campaigns consisting of conjuring incantations and raiding strongholds. We also love the element of delightfully surprising design in art, music, and games. Our concept blends the two in a fun, strategy-based rogue-like game. Influenced by various programming algorithms, such as Bresenham's Line Algorithm of drawing paths and procedural generation, we sought to create a complex and interesting pixel game experience.

What it does

The game is constructed with an "intelligent generation" layout, where rooms are positioned randomly in the map, each one accessible and connected through hallways. The random map construction allows for unique player experiences. In addition, random enemies spawn with different appearances, damage-modifiers, and HPs associated with their type. When the player is in their line of sight, they engage in a grid-like movement toward the player. The player can also pick up items, namely the d8 die and HP potions that boost max health. When a player engages in combat with an enemy (or vice-versa!), the user can make an attack that is modified by the number of d8 die they have picked up in-game. If the player dies in combat, the death sequence plays, and they are spawned in an different, newly-generated dungeon; whereas, if the player defeats the enemy, they resume exploring the current map.

How we built it

We used JS, HTML, CSS, Construct3, audio hardware/software (and math). In the program, we set up nested loops to generate various map objects, such as the rooms, hallways, and walls. A set number of rooms were created with random positioning and sizing. Vertical and horizontal hallways were created using the room coordinates and their midpoints. The walls that initially populated the entire layout are checked to determine whether they overlap with a room or hallway, and if they are, they are removed. For each room, we spawned objects, including the HP potions, dice, and enemies. Our program keeps track of player stats, such as the number of d8 die. This determines the minimum and maximum damage the player can possibly deal to an enemy, and our program "rolls" the d8 die, calculating a random number within that range. The damage modifier, as well as the map, are reset upon death. We entirely created our own art and music!

Challenges we ran into

We hit our first major bump when designing the random map generation itself. Our first instinct was to create a group of arrays, each of which represented a room containing its separate tiles. When a bug with our IDE blocked our progress, we attempted to work with two other solutions, finally settling on the algorithm currently in place. The combat screen gave us some difficulty as well! Quite a few variables had to be shuffled around before we were finally able to squash the bugs.

Accomplishments that we're proud of

We came out of this hackathon with a functional game and programming knowledge. Moreso, we're especially proud of our original assets and hope to publish even more variants soon!

What we learned

We gained some much-needed experience working with a new IDE this project, and though we're grateful for the opportunities it provided, it did not come without a learning curve. Sometimes, even when an idea works well on paper, commands don't execute exactly how you would expect them to. We definitely had to stretch our brains to search for workarounds until one of them finally worked! We'll carry these solutions with us well into the future.

What's next for d8dungeon

We will be hosting this project on our github domain as we continue to develop new versions! Our future plans are to add multiple floors, scaling difficulty, and eventually boss fights. We didn't have the chance to develop a title screen or character select, but all of the assets to do so actually already exist in the project! Stay tuned for updates regarding these features.

Share this project: