Skip to content

AtlantiaKing/ProceduralWorlds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProceduralWorlds

Procedural Worlds is a dynamic link library that can be used to generate different types of worlds in any project that uses C++ or C#.

All world types that can currently be made:

  • Infinite worlds
  • Circular-shaped worlds
  • Square-shaped worlds

A preset has been added to the library to generate a heightmap, but you can create a custom one as well.

As an example of what this library can do:
You can use this noise, generated by only a few lines of code (see below) using this library, to generate an island like this in mere minutes!
ProceduralWorldsExample

Example code:

C++

// Create a new generator
that::Generator gen{};

// Use the default preset to set up the heightmap
that::preset::Presets::CreateDefaultTerrain(gen, seed, mapZoom);

// Set up the size and shape of the generator
gen.SetSize(mapSize);
gen.SetShape(std::make_unique<that::shape::SquarePeak>(angularity, smoothPower));

C#

// Create a new generator
that.Generator gen = new that.Generator();

// Use the default preset to set up the heightmap
that.preset.Presets.CreateDefaultTerrain(gen, _seed, _zoom);

// Set up the size and shape of the generator
gen.SetSize(_size);
gen.SetShape(new that.shape.SquarePeak(_angularity, _smoothPower);

Full examples

Full fledged examples can be found in the SDLWorld project (C++) and in the examples folder (Unity C#)

Installation

Download the latest version of the C# or C++ library here.

C++

The C++ zip file contains

  • an include folder with all the headers necessary to use the library.
  • a lib folder that contains the x64 and x86 .lib and .dll files necessary to use the library.

C#

The C# zip file contains

  • a lib folder that contains the x64 and x86 .dll file necessary to use the library.
  • a src folder that contains all the C# equivalent code that hooks into the library ready to use.

Usage

Check out the documentation here.

Github project structure

This project contains two source directories:

  • src
    This is the C++ source of the project.
    This solution contains of two projects:

    • ProceduralWorlds library
      A dynamic link library that can be used to generate different kinds of worlds.
      The dll is usable in both C++ and in C#.
    • SDLWorld
      A test project that uses SDL to draw a world generated by the ProceduralWorlds library.
  • csharpsrc
    This is the C# wrapper around the ProceduralWorlds dll

About

A library that can be used for different kinds of procedural world generation

Topics

Resources

Stars

Watchers

Forks