Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by geeth1234 · Sep 15, 2017 at 07:17 AM · structureroguelikemap-generationdungeon

Implementing a dungeon rogue-like floor.

Wall of text, sorry.

Ok, so what I'm trying to create is a single floor that is very similar to the floors in games like Binding of Isaac or Enter the Gungeon. The way that I wish to do this is by using pre-made rooms and attaching them together randomly in order to create a floor, while including one starting room and one boss room. All of the tutorials I've seen online use randomly generated, not pre-made rooms, which is why I'm asking here.

Here is the overall structure of the code that I thought of using to make a floor:

1) First create the pre-made rooms and corridors by arranging sprites to simulate walls and things and add tags to everything for the rooms (for example, all the enemies, walls, etc. for room1 will have the tag "Room1").

2) When game starts, create a list of random rooms that will be used for the floor (containing around 15-ish rooms). This list must include "Room1" and "BossRoom".

3) The code will now add room1 by enabling all objects with the tag "Room1". Remove "Room1" from the list (to ensure that room1 isn't used again).

4) Randomly open some exits of the room. For every exit opened, attach a corridor and a random room from the list by enabling all objects with the room tag and shifting the position of the objects accordingly. (Since the number of corridors in a floor will be one minus the number of rooms on a floor, I can use a count variable to make sure that there aren't too many opened exits).

5) Check for overlap between rooms/corridors. If there is, delete the last room and repeat step 4 until no overlaps are found. Delete the added rooms from the list.

6) Repeat steps 4 and 5 until the list of rooms is empty.

I have even started created some of the code, but I'm wondering if I'm working "harder, not smarter." Is there an easier or more efficient way to do what I'm trying to accomplish? Does this method have any problems that might bite me in the butt later?

//////////////////

TLDR: Is the procedure above an efficient way to implement a rogue-like dungeon floor?

Other questions: How would I make it so that the boss room isn't too close to the starting room? What if I wanted to make the boss room always be in the center of the floor; how would I code that (this sounded easy in my mind, but since the center of the floor is relative to all of the other rooms, not the actual center position, the center would change based on how the rooms are organized in the end)?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

68 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Performance: Multiple asset references vs. One public asset reference 2 Answers

Array variables structure question 1 Answer

Best structure for a perk system? 0 Answers

Errors in Procedurally Generated Dungeon 0 Answers

2D Roguelike - Not sure how to fix overlapping sprites 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges