All Projects → mkremins → Tracerysharp

mkremins / Tracerysharp

C#/Unity port of Tracery (heavily WIP)

Projects that are alternatives of or similar to Tracerysharp

Texture maker
A texture maker tool for unity.
Stars: ✭ 358 (+1784.21%)
Mutual labels:  procedural-generation, unity, unity3d, unity-editor
Infinity Square Space
Infinity Square/Space. The prototype of the game is open source. Unity Asset.
Stars: ✭ 122 (+542.11%)
Mutual labels:  procedural-generation, unity, unity3d
Rock Generator
C# rock generator
Stars: ✭ 118 (+521.05%)
Mutual labels:  procedural-generation, unity, unity3d
Unity Editor Toolbox
Tools, custom attributes, drawers, hierarchy overlay, and other extensions for the Unity Editor.
Stars: ✭ 273 (+1336.84%)
Mutual labels:  unity, unity3d, unity-editor
Unitypausemenu
This is an open source Unity pause menu created for the game New Horizons, and it's completely free because of how a pause menu is a core component of a game, while the unity asset store was lacking in such an asset (until this was released on the asset store).
Stars: ✭ 160 (+742.11%)
Mutual labels:  unity, unity3d, unity-editor
Unity3d Ai And Procedural Generation Framework
Unity3D AI and Procedural Generation Framework.
Stars: ✭ 58 (+205.26%)
Mutual labels:  procedural-generation, unity, unity3d
Procedural Worlds Editor
Procedural World Editor is a node based procedural terrain generator
Stars: ✭ 218 (+1047.37%)
Mutual labels:  procedural-generation, unity, unity3d
Awesome Unity Open Source On Github
A categorized collection of awesome Unity open source on GitHub (800+)
Stars: ✭ 1,124 (+5815.79%)
Mutual labels:  unity, unity3d, unity-editor
Unity Shadersketches
Sketches made with ShaderLab in Unity.
Stars: ✭ 362 (+1805.26%)
Mutual labels:  procedural-generation, unity, unity3d
Dungeongenerator
A dungeon generator for Unity
Stars: ✭ 324 (+1605.26%)
Mutual labels:  procedural-generation, unity, unity3d
Ma textureatlasser
Texture atlas creator for Unity
Stars: ✭ 116 (+510.53%)
Mutual labels:  unity, unity3d, unity-editor
Actors.unity
🚀Actors is a framework empowering developers to make better games faster on Unity.
Stars: ✭ 437 (+2200%)
Mutual labels:  unity, unity3d, unity-editor
Pb stl
STL import/export for Unity, supporting both ASCII and Binary.
Stars: ✭ 108 (+468.42%)
Mutual labels:  unity, unity3d, unity-editor
Proceduraltoolkit
Procedural generation library for Unity
Stars: ✭ 1,729 (+9000%)
Mutual labels:  procedural-generation, unity, unity3d
Extosc
extOSC is a tool dedicated to simplify creation of applications in Unity with OSC protocol usage.
Stars: ✭ 69 (+263.16%)
Mutual labels:  unity, unity3d, unity-editor
Texturegenerator
3D and 2D Texture generation using the compute shaders within the Unity engine.
Stars: ✭ 142 (+647.37%)
Mutual labels:  procedural-generation, unity, unity3d
Scene View Bookmarks
Unity editor extension to bookmark scene views.
Stars: ✭ 40 (+110.53%)
Mutual labels:  unity, unity3d, unity-editor
Uniuguitoolbar
【Unity】uGUI のオブジェクトを作成できるツールバーのエディタ拡張
Stars: ✭ 44 (+131.58%)
Mutual labels:  unity, unity3d, unity-editor
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+19057.89%)
Mutual labels:  unity, unity3d, unity-editor
Easybuttons
Add buttons to your inspector in Unity super easily with this simple attribute
Stars: ✭ 410 (+2057.89%)
Mutual labels:  unity, unity3d, unity-editor

TracerySharp

A (heavily WIP) C# port of Tracery, a text generation library/language/tool originally designed by Kate Compton. Primarily intended to be used within Unity games.

Installation

You probably shouldn't use this yet! That said, if you really want to, you can "install" TracerySharp today by downloading the Source directory from this repository and dropping it directly into your Unity project's Assets folder.

In the future, I'll be looking into cleaner alternative methods of distributing libraries for use in Unity games.

Usage

Create a Grammar

No matter what you're trying to do, the first step will almost always be to get your hands on a Grammar object. There are a few different ways to do this.

Method 1: Use the GUI editor

In the Unity editor, select a game object to which you'd like to attach a grammar. Then, in the inspector, click Add Component > Scripts > Tracery Grammar. A GUI editor for the grammar will appear. Here, you can add and remove rules, edit existing rules, and test the grammar by viewing examples of generated strings.

Once you're satisfied with your grammar, you can access it in your scripts as follows:

GameObject go = GameObject.Find("foo"); // the GameObject to which you attached the TraceryGrammar script
Grammar grammar = go.GetComponent<TraceryGrammar>().Grammar;

Method 2: Load from JSON

Add the JSON file containing your serialized grammar to the Assets/Resources directory within your Unity project. Then you can access it in your scripts as follows:

TextAsset jsonFile = Resources.Load("grammar") as TextAsset; // assuming the file is at Assets/Resources/grammar.json
Grammar grammar = Grammar.LoadFromJSON(jsonFile);

You can also use Grammar.LoadFromJSON(string jsonString) to load a grammar directly from a JSON string.

Method 3: Write a script

In a C# script, you can create a Grammar object directly using the public constructor. Then you can programmatically populate it with rules using the PushRules method:

Grammar grammar = new Grammar();
grammar.PushRules("origin", new string[]{"Hello, #name#!"});
grammar.PushRules("name", new string[]{"Max", "world"});

...but note that this approach can get unwieldy pretty quickly, especially for more complicated grammars.

Generate strings

Once you've acquired a Grammar object, you can use the Flatten method to generate a fully expanded string from an initial base string. For example:

string expanded = grammar.Flatten("#origin#"); // assuming the grammar has a rule named 'origin'

TracerySharp is still incomplete, but you should be able to use most of the basic syntax described in the Tracery tutorial.

Make TracerySharp deterministic

Much like Tracery itself, you can make TracerySharp deterministic by setting Tracery.Rng to an instance of System.Random constructed with a specified seed:

Tracery.Rng = new System.Random(42); // replace 42 with whatever seed you want

Credits

Tracery was originally designed and developed by Kate Compton.

Max Kreminski ported it to C# for use with Unity.

JSON parsing is done with SimpleJSON. SimpleJSON was originally developed by Bunny83 and later modified by oPless.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].