Code Monkey home page Code Monkey logo

Comments (2)

barrybecker4 avatar barrybecker4 commented on June 7, 2024

How to add corridors

When doing the BSP to create the rooms, build a kd-tree. Each node of the tree will contain all its child rooms.
We will guarantee that all rooms in a subtree are connected.
Proof

Leaves are connected because they contain only 1 room.
The partition one level up from leaves contains at most 2 rooms.

  • If there are 2 rooms, connect them directly using a straight corridor
    At each successive parent level, ensure that there is at least one corridor that connects rooms in adjacent child partitions.
  • in top/left partition, find all rooms closest to the bottom/right side
  • in bottom/right partition, find all rooms closest to the top/left side
  • for these 2 sets find rooms that are as close to adjacent in the vertical/horizontal direction. Depending on a "connected" parameter add between 1 and a maximum number of connections. In some cases, there may not be any rooms that are adjacent in the vertical/horizontal direction. In those cases, create a right-angled corridor based on room centers.

Add option to have extra hallway between partitions that allow connecting many rooms to that perpendicular hallway.

from bb4-simulations.

barrybecker4 avatar barrybecker4 commented on June 7, 2024

This simulator has been added. Support for multiple biomes is a future feature.

from bb4-simulations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.