Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 trpitloun · Jul 11, 2014 at 06:32 PM · arraydetectiongenerationdungeon

Preventing circles in dungeon generation?

I've been working on a script the last couple of days, that generates a random dungeon as you walk through it. My current problem is that I cant prevent the tiles from forming a circle and ending the maze. I made a tower tile that takes the dungeon up or down a level, so I was thinking that if I can get the tiles to detect when its about to intersect with another one it can replace the next tile with a tower tile. My problem is that I am having trouble getting it to detect this.

Here I have it make the room and push it into an array.

         var newRoom : Transform = (Instantiate(wallArray[Random.Range(1,5)], transform.position, transform.rotation));
         newRoom.transform.position.z = transform.position.z -= 3;
     
         var newDoorFrame : Transform = (Instantiate(wallDoorFrame, transform.position, transform.rotation));
         newDoorFrame.transform.position.z = transform.position.z -= 3;
     
         var newDoor : Transform = (Instantiate(wallArray[6],newDoorFrame.transform.position, newDoorFrame.transform.rotation));
     
         oldRoomPos =  newRoom.position;
         spawnArray.push(newRoom);

I was thinking that I could use the array to somehow tell it when it needs to change based on the last few tiles that were generated. Like if the array was (LeftCorner,Hall,LeftCorner,LeftCorner) it would make the next tile a tower. Thanks in advance, Tracey PS: I can post all the code, but its pretty lengthy.

Comment
Add comment · Show 4
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
avatar image NoseKills · Jul 11, 2014 at 07:44 PM 0
Share

Does your dungeon have intersections/branches or is it a winding tunnel?

avatar image trpitloun · Jul 11, 2014 at 07:53 PM 0
Share

Its a winding tunnel.

avatar image tanoshimi · Jul 11, 2014 at 08:50 PM 0
Share

Try Prim or $$anonymous$$ruskal's algorithms

 http://en.m.wikipedia.org/wiki/$$anonymous$$aze_generation_algorithm
avatar image trpitloun · Jul 12, 2014 at 01:00 AM 0
Share

I'm not sure how I would go about that.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Rooms being spawned in the wrong places? (Random Generation) 0 Answers

How would I change my procedurally generated map change cells if it detects cells are around it? 0 Answers

why does my code tag objects it's not supposed to? 0 Answers

BSP Tree for dungeons generation, HELP! 1 Answer

Detecting contact on colliders? 0 Answers


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