The following blog post, unless otherwise noted, was written by a member of Gamasutras community. The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.
For theGlobal Game Jamthis year, our team wanted to make a game that behaved like a personality test. It would try to determine if you liked killing enemies, collecting items, running around wildly, or interacting with the games inhabitants. Once the game had a handle on what you preferred, it would tailor itself to your desires. If you liked killing things, more enemies would be spawned. If you spent a lot of time in rooms opening chests, the next rooms you went to would have more in them to explore. It was immediately apparent that a predesigned level wouldnt work, as we wanted the experience to be dynamic and different for each type of player. So, we needed some sort of procedural room generation, and we needed it fast. I was responsible for that feature, and found it so interesting that I wanted to share how I handled it.
Ive played a lot of roguelikes, so the concept of random room generation wasnt totally foreign to me. However, I hadnt seen any that really impressed me. Especially not compared to the random generators that have been made for tabletop games. Some of the better ones generate traps, monsters, and loot in addition to basic rooms and corridors. In particular, the generators available onDonjonssite are worth a look. Not only are they infinitely configurable, but their source code is (kind of) open! For traditional dungeons, they usually generate X number of rooms, and then connect them up with corridors. Theres generally a certain number of large, medium, and small rooms, but everything is calculated at once. This technique is powerful, and with enough tweaking, you can make some really nice looking maps without a lot of effort. Getting this version up and running in our game wasnt difficult. All we had to do was have a large enough grid, randomly drop the rooms in, and then place cubes where the walls should be.
Fig 1. Randomly placed rooms. I didnt bother writing code to create corridors to connect the rooms, because we had realized this wouldnt work for us.
However, this technique wasnt going to work for our game. Since the whole point of the game was to dynamically adjust to the players play style, a complete map generated at runtime didnt make sense. We needed something that was totally dynamic, where levels could be built incrementally as needed. This gave me an opportunity to fix a problem I have with most dungeon generators. Since they were usually designed to be easy to draw on paper/wet-erase maps, rooms are usually defined in chunks of squares, either 5ft or 1m. This means walls are usually that thick, which is unrealistic (most interior walls are only ~6 thick!), and room dimensions would be defined in those increments. I wanted our rooms to be able to exist outside of a strict grid system, and to not waste a lot of space with walls. So, I built a relatively simple system.
Rather than storing a grid, I tracked two different types of objects: rooms and doors. Doors only stored their position and orientation (latitudinal or longitudinal), and the two rooms they connected. Rooms knew their position, size, and kept a list of doors that were connected to them. I had a geometry generator that could spit out walls, floors, and doors into the world, and could combine those primitives into generating rooms of random sizes. The system was designed so that if a newly generated room shared a wall with an existing room, any doors in that shared wall would automatically link to the new room.
Fig 2. First test of the geometry generator, creating rooms of random sizes.
Read more:
Procedural, dynamic room generation
- Zac Taylor aims to bring more energy to Bengals with new addition to locker room - WLWT Cincinnati - November 29th, 2024 [November 29th, 2024]
- Colts release CB from practice squad to make room for OL addition in Week 12 - MSN - November 29th, 2024 [November 29th, 2024]
- Dubai Sets New Standards With Kleindiensts 5,000 Five-Star Room Addition - Travel And Tour World - November 21st, 2024 [November 21st, 2024]
- Texas wide receiver room bolstered with addition of Oregon State's Silas Bolden - HornSports - January 22nd, 2024 [January 22nd, 2024]
- Seattle Kraken vs New York Rangers: Preview, time, and where to watch - Davy Jones Locker Room - February 11th, 2023 [February 11th, 2023]
- Texas and Oklahoma are joining the SEC in 2024. What does that mean for Mizzous football schedules without d - Rock M Nation - February 11th, 2023 [February 11th, 2023]
- Ravens need to get creative' to add proven WR for Lamar Jackson - Baltimore Ravens Blog- ESPN - ESPN - February 11th, 2023 [February 11th, 2023]
- SEC Network Prepares for the Postseason with 30+ Hours of ... - ESPN Press Room - December 22nd, 2022 [December 22nd, 2022]
- Michael Irvin says T.Y. Hilton will improve Cowboys chemistry - The Dallas Morning News - December 22nd, 2022 [December 22nd, 2022]
- Alomere Health in Alexandria gets green light for therapy pool addition - Echo Press - December 28th, 2021 [December 28th, 2021]
- Grading the outside linebacker addition in the 2022 recruiting class - Badgers Wire - December 28th, 2021 [December 28th, 2021]
- 'I don't know if we would have woken up if it wasn't for her': Young Cotulla girl credited with saving family from fire - KENS5.com - December 28th, 2021 [December 28th, 2021]
- The Easiest Side Hustles To Get Started With in 2022 - GOBankingRates - December 28th, 2021 [December 28th, 2021]
- Harmony Hall Village: A Piece of History in White Oak BladenOnline.com - BladenOnline.com - December 28th, 2021 [December 28th, 2021]
- Beardmore: Wait for bids on Rec Center before making final call - Carroll Daily Times Herald - December 28th, 2021 [December 28th, 2021]
- Packers cornerback Chandon Sullivan on Clubhouse Live: 'I'm just so fortunate to be on this team' - Packers News - December 28th, 2021 [December 28th, 2021]
- From a Burger King to a Concert Hall, With Help From Frank Gehry - The New York Times - December 28th, 2021 [December 28th, 2021]
- EVERYONE WANTS A HOME FOR THE HOLIDAYS - Florida Keys Weekly - December 28th, 2021 [December 28th, 2021]
- [Top 5 Medical News in 2021] Korea, the only country to mandate cameras in operating rooms - Korea Biomedical Review - December 28th, 2021 [December 28th, 2021]
- Bengals depleted defense looks to add to impressive run by stopping impressive runs - The Athletic - December 28th, 2021 [December 28th, 2021]
- Franklin Street dining scene to gain 2 new additions: 105 Social and The Vine | ClarksvilleNow.com - Clarksville Now - December 28th, 2021 [December 28th, 2021]
- Triangle Startup Guides growing information lineup adds more info to close 2021 - WRAL TechWire - December 28th, 2021 [December 28th, 2021]
- 5 Unexpected Sources of Retirement Income - The Motley Fool - December 28th, 2021 [December 28th, 2021]
- Celebrate Our Automotive Heroes With Us at Our Upcoming California Cars & Coffee - RoadandTrack.com - December 28th, 2021 [December 28th, 2021]
- New farm-to-table restaurant Chez Baccus sprouting this spring on Fourth Street the Hi-lo - Long Beach Post - December 28th, 2021 [December 28th, 2021]
- Timothy Ubben, investment executive and philanthropist who helped low-income students go to college, dies at 84 - Chicago Tribune - December 28th, 2021 [December 28th, 2021]
- Examining Michigan's WR Room Following The Addition Of Daylen Baldwin - Rivals.com - Michigan - June 16th, 2021 [June 16th, 2021]
- Italian the perfect addition for Tottenham Hotspur midfield - Hotspur HQ - June 16th, 2021 [June 16th, 2021]
- The Pros and Cons of Wet Bathrooms - BobVila.com - June 16th, 2021 [June 16th, 2021]
- Bucs have a good problem in their running back room - Bucs Nation - June 16th, 2021 [June 16th, 2021]
- With 'some plays that didn't go our way,' Tua Tagovailoa opens Miami Dolphins minicamp with five interceptions and film to study - ESPN - June 16th, 2021 [June 16th, 2021]
- New Norwell library officially opens at triple the size of its predecessor - The Patriot Ledger - June 16th, 2021 [June 16th, 2021]
- Houston Methodist uses AI brain ultrasound to reduce open heart surgery complications - Healthcare IT News - June 16th, 2021 [June 16th, 2021]
- Spectrum Health Zeeland expansion project to be completed by end of year - Fox17 - June 16th, 2021 [June 16th, 2021]
- Puzzle Break Leads The Future Of Professional Development In Virtual Escape Rooms - Business Wire - June 16th, 2021 [June 16th, 2021]
- The 21 Best Restaurants in Aspen, Colorado - Eater Denver - June 16th, 2021 [June 16th, 2021]
- Where to Go for an Authentic Dude Ranch Experience in California - AFAR Media - June 16th, 2021 [June 16th, 2021]
- Darius Slayton has more-the-merrier mindset about Giants receiver additions - AL.com - June 16th, 2021 [June 16th, 2021]
- Predicting potential training camp cuts for the Bucs - Bucs Nation - June 16th, 2021 [June 16th, 2021]
- GMDAs flood control room to be functional by this week - Hindustan Times - June 16th, 2021 [June 16th, 2021]
- Many disaster-related hotel stays should have been tax exempt - Newnan Times-Herald - June 16th, 2021 [June 16th, 2021]
- Award-winning Writer David Dennis Jr. Joins The Undefeated as Senior Writer - ESPN Press Room - June 16th, 2021 [June 16th, 2021]
- Harrah's Las Vegas Unveils A $200 Million Renovation, Including Enhanced Accommodations, Casino Floor And More Hospitality Net - Hospitality Net - June 16th, 2021 [June 16th, 2021]
- Utah's Whittingham Ready For The "Complete Rebuild" In Quarterback Room - Sports Illustrated - February 20th, 2021 [February 20th, 2021]
- One Wall Street's Residential Conversion and Addition Continues in the Financial District - New York YIMBY - February 20th, 2021 [February 20th, 2021]
- EL-based non-profit sees growth through pandemic - The Review - February 20th, 2021 [February 20th, 2021]
- West Concord makes the grade in history - PostBulletin.com - February 20th, 2021 [February 20th, 2021]
- Check Out the Secret Room in This Renovated Concord Home - Boston magazine - February 20th, 2021 [February 20th, 2021]
- Green Bay Packers Cut em or Keep em & Prediction: Preston Smith - Dairyland Express - February 20th, 2021 [February 20th, 2021]
- Adrian Phillips plugged some holes and was a valuable addition to Patriots secondary - The Boston Globe - February 20th, 2021 [February 20th, 2021]
- ETHS Foundation to Host WILD FOR ETHS Celebration - Evanston RoundTable - February 20th, 2021 [February 20th, 2021]
- VOICES OF INEQUITY: How unfair school funding looks at the ground level - The Mercury - February 20th, 2021 [February 20th, 2021]
- EMS building project attracts nearly 100 bids - The Monroe Sun - February 20th, 2021 [February 20th, 2021]
- Lund Center Project to Break Ground This Spring - Gustavus Adolphus College News - February 20th, 2021 [February 20th, 2021]
- Adding two County Council members will cost more than $1.9M - BethesdaMagazine.com - February 20th, 2021 [February 20th, 2021]
- ESPN Celebrates Five-Year Anniversary of The Jump on February 18 - ESPN Press Room - February 20th, 2021 [February 20th, 2021]
- BTS: After V and Jimin, J-Hope's heartening addition to ARMY room makes excitement for BE (Essential Edition) - Bollywood Life - February 20th, 2021 [February 20th, 2021]
- Fort Madison toddler was hospitalized the first 946 days of his life. Then a kidney transplant opened his world. - Burlington Hawk Eye - February 20th, 2021 [February 20th, 2021]
- Adrian Salvation Army adds storage space to thrift store - The Daily Telegram - February 20th, 2021 [February 20th, 2021]
- Game Room and Gaming Club Partner in Hosting Their Second Annual Extra Life Gaming Marathon - The Whit Online - February 20th, 2021 [February 20th, 2021]
- [PODCAST] Diversity in ADR and Creating Access to Justice - JD Supra - February 20th, 2021 [February 20th, 2021]
- New to the menu during COVID-19: Virtual eateries - Akron Beacon Journal - February 20th, 2021 [February 20th, 2021]
- Sunstone Hotel Investors Announces The Sale Of The 502-Room Renaissance Los Angeles Airport For $91.5 Million - PRNewswire - December 10th, 2020 [December 10th, 2020]
- Luther Haven renovations on the horizon - Monte News - December 10th, 2020 [December 10th, 2020]
- 'Elf' fans can stay in a hotel suite inspired by Buddy the Elf - CNN - December 10th, 2020 [December 10th, 2020]
- On the record December 9 - Seymour Tribune - December 10th, 2020 [December 10th, 2020]
- Introducing the Forrest Sequoia the First Forrest Lamp from NFL Standout Forrest Lamp and Lamps Plus - Furniture Today - December 10th, 2020 [December 10th, 2020]
- Samsungs 110-inch MicroLED TV brings The Wall to your living room - TechHive - December 10th, 2020 [December 10th, 2020]
- $400,000 Homes in Georgia, Ohio and West Virginia - The New York Times - December 10th, 2020 [December 10th, 2020]
- Two Residents of Rosewood Villa Find Love in an Unexpected Place - whatcomtalk.com - December 10th, 2020 [December 10th, 2020]
- GLADIATOR DIESEL IS A WELCOME ADDITION TO JEEP LINEUP - Osprey Observer - December 10th, 2020 [December 10th, 2020]
- Video chat options for staying connected are more than Zoom - Norton Healthcare - December 10th, 2020 [December 10th, 2020]
- Game Review: "The Haunted Mansion: Call of the Spirits" from Funko Games - LaughingPlace.com - December 10th, 2020 [December 10th, 2020]
- Breaking News - Peacock Orders More Episodes of Timely and Topical Late-Night Series "The Amber Ruffin Show" - The Futon Critic - December 10th, 2020 [December 10th, 2020]
- Home invasion suspect caught after victim whispers call for help to 911 - WCVB Boston - December 10th, 2020 [December 10th, 2020]
- Newly Upgraded The Domain Hotel Offers Modern Accommodations For Work Or Play In The Heart Of Silicon Valley - Hospitality Net - December 10th, 2020 [December 10th, 2020]
- 49ers film room: Are the criticisms of Shanahan fair? Looking at the Rams game for answers - Niners Nation - December 4th, 2020 [December 4th, 2020]
- Take in the many benefits of houseplants - Valley News - December 4th, 2020 [December 4th, 2020]
- Is There Still Room for Zoom Stock to Boom? - Motley Fool - December 4th, 2020 [December 4th, 2020]
- Career and College Promise in NC: Room for growth - EdNC - December 4th, 2020 [December 4th, 2020]