Giter VIP home page Giter VIP logo

proceduralpatterns2d's Introduction

Procedural Patterns to use with Tilemaps

Procedural

Description

This project shows a number of different patterns to use with Tilemaps to create custom maps. All the main functions are within the script MapFunctions.cs.

How to get started:

Within this project there are scenes showing examples of the following algorithms:

  1. Perlin Noise
    1. Basic Generation (for top layer)
    2. Smoothed Generation (for top layer)
    3. Cave Generation
  2. Random Walk
    1. Basic Generation (for top layer)
    2. Smoothed Generation (for top layer)
    3. Cave Generation (4 directional movement)
    4. Custom Cave Generation (8 directional movement)
  3. Cellular Automata
    1. von Neumann Neighbourhood
    2. Moore Neighbourhood
  4. Directional Dungeon

There is also an example of using multiple types of generation for one tilemap. This can be seen in the Multi-Generation Example subfolder.

Layout of each scene

Within each scene there will be an object named LevelGenerator. This object holds the LevelGenerator.cs Script, the exception to this rule is the multi-generation example scene. The object named LevelGenerator in this scene holds a customised version of the LevelGenerator.cs script which allows for multiple types of Map Settings

LevelGenerator

On this game object, you can generate and clear the level in edit mode using the buttons provided

How to create Map Settings

To create a new map setting object, you need to right click in the project view then go Create->Map Settings.

ProjectView

or

You can got to Assets->Create->Map Settings from the toolbar

Toolbar

How to call functions from MapFunctions.cs

The good thing about the MapFunctions.cs script is that you can take it out of this project and put it into any other project. If you want to call functions from the script you would just need to do the following:

int[,] map;
map = MapFunctions.GenerateArray(width, height, empty);
map = MapFunctions.PerlinNoise(map, seed); 
MapFunctions.RenderMap(map, tilemap, tile);

What this code would do is:

  1. Create an int array for a map
  2. Generate the array into the map
  3. Generate perlin noise within the map
  4. Render the map to a tilemap

Software Requirements

Required: Unity 2017.3, or later version

Hardware Requirements

Required: Any Computer (Windows or Mac)

Owner and Responsible Devs

Owners: Ethan Bruins ([email protected])

proceduralpatterns2d's People

Contributors

ethanunity avatar westerveld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.