Spline Tools for MapMagic
To use this addon a full version of MapMagic is required.
While MapMagic itself can generate infinite maps, this addon can only be used if a finite map is required. It allows to limit the map size by creating an island/continent or generating mountains at the borders that cannot be passed.
Limiting the world to a defined size allows to generate stuff that crosses multiple chunks and requires knowledge of the neighbors.
- Bounded Shape
- Path Flatten
- Path Carve
- Flatten Stamp
- Flatten Stamp Objects
- Heights Cache
- Connections V2 (Unstable)
- Combine Edges
- Split Edges
- Rivers (Unstable)
- Cut Water Crossings (Unstable)
- Bounded Scatter
- Bounded Scatter V2 (Unstable)
- Manual Scatter
- Extract Nodes
- Path Scatter
- Radius Scatter
It is assumed that a basic setup of MapMagic is already up and running.
First the main script
Map Magic - Spline Tools must be added to your scene. You can add it to the same gameobject that already holds MapMagic, but you are free to add it to any other gameobject. If you use MapMagic's
Copy Components To Terrain feature, it is recommended to use a dedicated gameobject for SplineTools since running multiple instances is discouraged.
The Main Script
The script in the inspector looks like this:
- Log Level - Useful for debugging purposes. Enabling Debug logging may slow down generation.
- Space - Select the Coordinate space (World vs. MapMagic) to display values in SplineTools' generators. Note that the values of the standard MapMagic generators are not affected by this.
- Height Cache Size (Memory) - Size of the height map cache in memory in MegaBytes.
- Height Cache Size (Disk) - Size of the height map cache on disk in MegaBytes. A value of 0 will disable disk caching.
- Spill to Disk Threshold (ms) - Memory-cached height maps that took longer than this to generate will be spilled to disk once the memory cache limit is reached. All other cached height maps will be discarded and re-computed on demand.
- Cache (Sub)Directory - Where to persist the disk-cached height maps.
- Clear, Rebuild - Reset and/or rebuild the state of the Cache and WorldGraph.
- Show Coord - Show the exact coordinate on terrain under the mouse cursor position.
- Refresh Integrations - Trigger a scan for integratable assets in the project.
Please note that MapMagic's
Generate Changed and
Force Generate All will NOT reset the WorldGraphs or the cache. Every time you make changes to generators that affect the creation of nodes or edges, you must use the
Clear & Rebuild buttons of this script. Some generators may also cache the height input, so you have to at least clear the height cache in order to see the effect of changes.
All possible integrations will be automatically detected. It is possible to use the button
Refresh Integrations to force a detection, if a compatible asset has been imported or removed but the automatic detection did not work.
- River Auto Material, required for the R.A.M River and R.A.M Lake outputs for Unity <= 2018.2
- River Auto Material 2019, required for the R.A.M River and R.A.M Lake outputs for Unity 2018.3+
Here is a short overview of the most important components:
When integrating SplineTools into a MapMagic Graph, it is recommended to use the height-related generators in an overall order similiar to this:
- Basic height generation
- Scatter global POI
- Flatten global POI
- Generate global connections
- Flatten paths
- Scatter local POI
- Flatten local POI
- Generate local connections
- Flatten local connections
- Erosion (with flattened connections masked out)
The generator order for textures is not that critical, but keeping it close to the height generator order will most likely be what you want.
FAQ / Common Issues
Flying / displaced edges
There are multiple possibilities:
- Stale graph: Make sure your graph is not stale by using the
Clear & Rebuildbutton.
- Usage of HeightsCache with unspupported input: Since most of MapMagic's generators need special handling to be scaled down in some way, the usage of unhandled generators will lead to wrong results. Use the Preview output to check if the normal and the low-resolution terrain match.
- Usage of HeightsCache with very low resolution: With too low resolution the details will get lost.
- Using the wrong height input for ConnectionsGenerator: Different connection steps may require different height input to e.g. consider already flattened areas.
Usage of splines with biomes is currently unsupported.
Compilation failes because the wrong version of R.A.M is detected after upgrade/downgrade
Go to the Player Settings and remove the entries
ST_RAM_2019 from the Scripting Define Symbols. After this the correct new R.A.M version should be detected.
Migration to 0.6.0
Since a full reinstall is required for version 0.6.0, all SplineTools nodes in you MapMagic graphs will disappear unless you prepare them for migration.
If you want migrate your graphs, save your scene in text format (before upgrading), open it with a text editor and replace all occurrences of
ArctiumStudios.SplineTools.. This will preserve the overall graph, but most of the values will still be reset to their defaults.
'Unstable' support for MapMagic 2 is built-in.