Giter Site home page Giter Site logo

randommapgenerator's Introduction

Created using Unity 2018.1

About

Create randomly generated dungeons from premade rooms by using only 3 components.

output

How to install

Copy the Assets/Scripts folder to somewhere inside your projects Assets folder. You may rename the folder to whatever you'd like. The prefabs and scenes folder are optional

How to use

Create a game object and add a MapGenerator component to it. Fill out the fields to your needs.

Next you need to create the rooms this generator can use. Create a game object that will be used as the room. Add a Room component and set the Bounds value which is used for the collision testing when trying to place a room. When editing the Bounds you should be able to see a Red rectangle based off it's values in the Scene View. Make sure the Bounds covers the whole room area.

Next your room needs X children with a RoomSpawn component. Move these children around to where the next room should spawn. The spawning works by aligning/connection the RoomSpawn spawns.

Once you have all your rooms created add them to the MapGenerator component. If you want a room to have a higher chance to appear you can add it multiple times.

To start the generation you just need to call the Generate() or Generate(int seed) function from the MapGenerator component.

Script API

Additional info

I was too lazy to add in the hallways, to do this they should be separate meshes from the room and a child of the room (1 hallway per spawn point). Then just create a component that checks if it's related spawn point is connected to a room if it isn't hide it.

randommapgenerator's People

Contributors

quxios avatar

Watchers

 avatar

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.