asrbic / Procedural_Ore_Generator

Other
15 stars 5 forks source link

Procedural Ore Generator for Space Engineers

Description

This program will randomly generate ore patches in PlanetDataFiles for existing planets in Space Engineers. The type, size, shape, denity etc of these ores can be configured for each planet. Ore templates can also be created at the global level and overwritten where needed. Optionally, the ids and other settings for each ore can also be populated in the PlanetGeneratorDefinitions.sbc file.

How to use

Requires 64-bit Java version 1.8 or later.

  1. Locate the PlanetDataFiles directory containing the planet data directories for the planets you want to use as a base
    • eg C:\\Program Files (x86)\\Steam\\steamapps\\common\\SpaceEngineers\\Content\\Data\\PlanetDataFiles\\
  2. Modify settings in config.json to suit your needs
    • planetDataPath should equal the path from step 1
    • The "name" for each planet config should be exactly the same as its corresponding directory name in the PlanetDataFiles from step 1
    • planetGeneratorDefinitionsPath (or planetGeneratorDefinitionsPathArray) should be the location of PlanetGeneratorDefinitions.sbc you want to use as a base
      • This is in the Data directory above the directory from step 1
    • All settings will cascade from oreTemplates -> all ores, global -> each planet then each planet -> its ores. Settings will not be overwritten if already set. This can minimise the amount of config you need to write.
      • eg. "id": 1, "type": "Iron_02" in an ore template will set all ores on all planets which have the id 1 to have the default type Iron_02
      • eg. "depth": 12 at the top level will set the default depth of all ores to 12
    • Be very careful with the "" {} [] , characters. Make sure brackets are always closed and all elements but the last have a comma at the end of the line
  3. Run the program with run.bat
    • You might want to run with "makeColouredMaps": true until you get the output you want. Then run again with "makeColouredMaps": false or manually remove all of the coloured images from each planet directory
    • Writing/compressing pngs can take a surprisingly long time
  4. Copy the contents of the PlanetDataFiles directory from step 1. to a new directory in the Space Engineers mod directory (C:\Users\<username>\AppData\Roaming\SpaceEngineers\Mods\)
    • Space Engineers will not load a mod if it touches a planet but does not contain the heightmaps (front.png etc), even if they are present elsewhere.
  5. Copy the outputs of the generator tool, PlanetDataFiles and PlanetGeneratorDefinition.sbc, to the Space Engineers mod direcory from the step above, overwriting any files.
    • There may be multiple .sbc files output. All should be copied.
  6. Add the directory you created to the mod list of a game in Space Engineers and test. You do not need to create a new world.
  7. Select the directory containing your mod in the mod list and click Publish in the bottom right to upload it to the Steam Workshop
    • The program will print out a formatted table detailing the count of tiles generated for each type of ore (Everything between [table]...[/table]). You can paste this directly into the steam item description.

tl;dr: run.bat

Configuration Options

Generator Shapes

  1. Random: Will randomly select one of the below for each patch. Excludes 7. because it doesn't quite look natural.
  2. Gaussain random: Will randomly select tiles with a strong tendency towards the centre of the patch. This typically leads to a dense centre with some isolated ore tiles around it.
  3. Snake: Works a bit like the game snake. One of 4 random directions (up, down, left, right) will be chosen. From this new tile, a random direction is chosen again. Repeat. This is the simplest algorithm and leads to shapes most like vanilla.
  4. Step Gaussian lines: Will randomly select tiles with a strong tendency towards the centre of the patch. A line is then drawn to it by stepping up, down, left or right. This is probably my favourite.
  5. Fuzzy linearly interpolated Gaussian lines: Will randomly select tiles with a strong tendency towards the centre of the patch and draw a line from the current tile to it. Leads to some intersting shapes but patches are often smaller than specified.
  6. Circles: Draws circles shapes which tend to be more sparse the further from the centre the tile is. If density is 1.0, the circle will be solid and not sparse at all.
  7. Sparse diamonds: Doesn't look natural, probably don't use. Ignores density.