MarkovJunior is a probabilistic programming language where programs are combinations of rewrite rules and inference is performed via constraint propagation, developed by Maxim Gumin.
This fork is based on fork MarkovJunior-docs by Andrew Kay which adds documentation and a few explanatory comments, which may be useful to others reading the code.
This fork uses PriorityQueue implementation from .NET Platform.
This is slightly modified version of MarkovJunior and MarkovJunior-docs repositories to provide MarkovJunior algorithm as API library for Unity. It can be built as DLL and put to Unity project, or as alternative folder MarkovJuniorUnity
could be just dropped somewhere in Unity project. Library can also be used with Godot by building MarkovJuniorLibGodot
and referencing it.
It does not have any GUI or behaviors to interact with world and it will not place objects automatically.
For input it accepts textures, .vox files, xmls. It returns either Texture2D
either byte[]
containing .vox file contents.
Also it has nodes to use together with Map Graph asset by Insane Scatterbrain.
There is ability to pass "tileset" and "folder" tags as well as ".vox" files, but it is not tested yet - could be buggy.
Nodes for Map Graph does not support tilesets, 3D models and some config parameters. And copy-pasting dowsn't copy XML.
Probably some other bugs
/MarkovJuniorLib
- base MarkovJunior library based on .Net Standard 2.0. It could be used as is without Unity or Godot/MarkovJuniorLibGodot
- MarkovJunior library adapted to be build for Godot/MarkovJuniorLibUnity
- MarkovJunior library adapted to be build for Unity/MarkovJuniorUnity
- MarkovJunior library adapted to be placed into/Assets
folder of Unity project/Stuff
- MarkovJunior models taken from initial MarkovJunior repository that are supported.
You can find latest package in releases.
If you do not use Map Graph, just do not import folder MapGraphExt
or remove it after import.
Copy MarkovJuniorUnity
folder to your project's Assets
folder.
If you do not use Map Graph, just remove folder MapGraphExt
Might be needed if you use older Unity version and having compilation errors.
Build solution separately (will need to update dependency to UnityEngine.dll) and put DLL to Assets
folder of your Unity project.
More info can be found on official Unity docs.
If you need Map Graph nodes as well, copy folder Unity/MapGraphExt
to your Unity project
Check documentation at MarkovJunior, developed by Maxim Gumin, as well as unofficial technical notes by Dan Ogles and code documentation by Andrew Kay.
Since this repository forked from https://github.com/kaya3/MarkovJunior-docs, you can check it as well.
Also, clone locally original MarkovJunior repository, build it and run and then look at results and compare with model XMLs.
You need to own asset Map Graph asset by Insane Scatterbrain to use MarkovJunior-unity-lib with it.
- Install MarkovJunior-unity-lib (see Install to Unity section) to your project that already has Map Graph installed
- Create new Map Graph or open existing one (but better to create new one just in case)
- Add "Markov Junior" node. It will have pre-defined cave XML
- Attach input port "Size". It could be square like 50x50 or rectangle like 10x20 or 300x123
- Run graph. Result will look like in Example 1
In order to use MarkovJunior-unity-lib with asset textures (like in Example 3), ensure that these settings match:
- Non-Power of 2 is set to None
- Read/Write is checked
- Generate mipmaps is unchecked
- Compression is set to None
These samples require Map Graph asset. Samples are included with unitypackage in releases.
Basic example
Input image is generated using default colors with Map Graph and then passed to MarkovJunior runner. Also black color 'B' is overridden with dark magenta.
In this example used modified voronoi.xml
<sequence values="BYE">
<all steps="2">
<rule in="EB" out="*E"/>
<rule in="YB" out="*Y"/>
</all>
</sequence>
Demonstrates how to use texture sample named "Flowers" in WFC node. XML is taken from WaveFlowers.xml, image taken from Flowers.png.
Used texture import settings should follow the rules in section Using asset textures
Demonstrates one of the coolest examples of MarkovJunior use - dungeon generation. XML is taken from DungeonGrowth.xml, images are taken from DungeonGrowth.
Used texture import settings should follow the rules in section Using asset textures
Demonstrates how to use random seed from graph runner. XML is taken from BlueNoise.xml.