Home

Awesome

Procedural Toolkit 0.2.4-preview

Procedural Toolkit is a procedural generation library for the Unity game engine.

Warning: This is a programming toolkit, editor support is limited.

Donate Donate | GitHub | Asset Store | Issues | Support email

Installation instructions

Requires Unity 2022.3 LTS or later. Tested on Windows, WebGL, Android and iOS.

There are several ways to install Procedural Toolkit:

Package Manager

The best way is to install this library as a Git package using the Package Manager. First, make sure that you to have Git installed and available in your system's PATH.

Then you can add the package using the link below, notice the upm branch at the end of the line:

https://github.com/Syomus/ProceduralToolkit.git#upm

If you don't want to use Git, you can download this library as an archive and install it as a local package.

Asset Store or .unitypackage

The other way is to import a package from the Asset Store or the Releases page. If you have any previous versions of the toolkit installed, it is highly recommended to delete them before importing a newer version.

Getting started

After installation you can import ProceduralToolkit namespace and start building your own PCG systems:

using UnityEngine;
using ProceduralToolkit;

public class ReadmeExample : MonoBehaviour
{
    private void Update()
    {
        Debug.Log(string.Format("<color=#{0}>{0}</color>", RandomE.colorHSV.ToHtmlStringRGB()));
    }
}

If you are using Assembly Definitions, you will also need to add ProceduralToolkit as a reference.

I have a problem with Procedural Toolkit

First, please search the open issues and closed issues to see if your issue hasn't already been reported. If it does exist, add a :thumbsup: to the issue to indicate this is also an issue for you, and add a comment if there is extra information you can contribute.

If you can't find a matching issue, open a new issue, choose the right template and provide us with enough information to investigate further. Alternatively, you can send a message to the support email.

Contributing

See CONTRIBUTING for a full guide on how you can help.

If you're looking for something to work on, check out the help wanted label.

If you just want to show your appreciation, you can send a donation through PayPal or Ko-fi.

Toolkit structure

Runtime/

Runtime/Buildings/

Runtime/Geometry/

See this wiki page for a matrix of available algorithms.

Runtime/Geometry/StraightSkeleton/

Classes used in straight skeleton generation.

Runtime/ClipperLib/

The Clipper library. Use PathClipper and PathOffsetter for seamless interoperability with Unity.

Runtime/LibTessDotNet/

The LibTessDotNet library. The recommended use is through the wrapper class Tessellator.

Runtime/FastNoiseLib/

The FastNoise library.

Shaders/

Depending on the installation type, the shader library can be used like this:

#include "Packages/com.syomus.proceduraltoolkit/Shaders/SDF.cginc"

Or like this:

#include "Assets/ProceduralToolkit/Shaders/SDF.cginc"

Editor/

Tests/

Tests for the library

Samples

Buildings

A fully procedural building generator, creates an entire mesh from scratch and paints it's vertices. Keep in mind that the generated mesh has no uv map so using it with Standard shader is pointless.

Chairs

A fully procedural chair generator, creates an entire mesh from scratch and paints it's vertices.

Low Poly Terrain

A simple low poly terrain generator based on fractal noise. Doesn't support chunking or anything like that, just an example of how you can use a noise function in a plane generation algorithm.

Signed Distance Functions

A collection of shaders showing how you can utilise functions from the shader library.

Cellular Automata

A demonstration of CellularAutomaton from the main library, draws the automaton simulation on a texture. Note that some of the rulesets need noise value different from the default setting.

Mazes

A generic maze generator, draws the maze generation process on a texture.

Noise

An example demonstrating various noise types from the FastNoise library.

Breakout

A Breakout clone with procedurally generated levels.

Characters

A simple 2D character generator. Sprites made by <a href="http://kenney.nl/">Kenney</a>.

Primitives

A demonstration of some of the available MeshDraft primitives.

Drawing

Three identical shapes made with three different methods: DebugE, GLE and GizmosE.

Clipper

A simple example demonstrating the api's of PathClipper and PathOffsetter.

Tessellator

An example showing the usage of Tesselator.

StraightSkeleton

An StraightSkeletonGenerator example showing how you can generate a straight skeleton from a polygon and use the result.

Common

UI prefabs and the skybox material used in examples.

License

MIT