MightyBOBcnc / nixis

A python program for procedurally generating planet-scale maps for Earth-like, spherical worlds.
MIT License
7 stars 1 forks source link
erosion planet planet-generator procedural-generation procedural-terrain terrain
**⚠ Nixis is still early in development and will undergo many breaking changes. ⚠ The structure is a mess and the files are full of enormous tracts of commented notes and it is most definitely not pep-8 compliant.**

Nixis

A python program for procedurally generating planet-scale maps for Earth-like, spherical worlds.

While there are many existing tools (such as Gaea, TerreSculptor, World Machine, and World Creator) that can create plausibly realistic-looking terrain for small areas (a few kilometers squared) there are few to none that do so for a full-sized spherical planet. In this instance "plausibly realistic-looking" refers to a terrain that incorporates principles of hydraulic erosion and weathering such that it resembles real terrain that has been acted upon by these natural forces over time. Existing tools that apply erosion algorithms on small or flat terrains are not programmed to compensate for the distortion that is introduced by mapping a sphere onto a rectangular image.

What This Project Is

What This Project Is Not

Assumptions and Limitations

Roadmap (in no particular order)

Planned features:


Installation and Use

(Better instructions coming later.)

Nixis is being developed in an Anaconda environment with Python >3.10.x (the oldest version tested against is 3.8.x). You can install the environment from requirements.yaml.

After setting up your environment you can run python nixis.py -h or python nixis.py --help for arguments.

A smart workflow would be to generate a few planets with random seed numbers and a default number of divisions without exporting maps to quickly find a seed that you like, then increase the resolution and divisions with your chosen seed for a more detailed export. Higher levels of subdivision and larger images take longer to process.

Erosion and solar insolation are both still in development so you'll have to set some flags in nixis.py manually (after the section that sets up argparse):

do_erode = False
do_climate = False

Then tinker with the erosion and insolation references further down in nixis.py which you can find by searching for if do_erode: or if do_climate:, and optionally changing the color gradient used for visualization near the bottom of nixis.py by setting this line:

scalars = {"s-mode":"elevation", "scalars":height}

where s-mode choses which gradient to use and scalars defines which values to apply the gradient to. See def make_scalars in gui.py for options (this is also a work in progress). E.G. you might choose "insolation" as the gradient and daily_insolation as the scalars if do_climate is True, or "temperature" and surface_temps.

NOTE: Erosion modifies the existing height array in place so setting the scalars to height will work regardless of if do_erode is False but setting the scalars to any of the temperature or insolation arrays will error if do_climate is False as they won't exist.


options.json

Important settings are stored in the options.json file in the main directory. While most of these should be self-explanatory a few might not be obvious so they are documented here.

{
    "save_folder": "output",        # Name of the folder where exports are saved (this folder is created in the main directory)
    "snapshot_folder": "snapshots", # Name of the folder where snapshots are saved (this folder is created in the save_folder)
    "img_width": 2048,              # Width of exported images (It is recommended that this be 2x the height)
    "img_height": 1024,             # Height of exported images (It is recommended that this be 0.5x the width)
    "img_format": "png",            # Format of exported images (In theory any format supported by Pillow should work)
    "bit_depth": 16,                # (Currently unused) Bit-depth per channel of exported images
    "export_list": {},              # (Currently unused) A dict of which maps should be exported (e.g. height, temperature, biome, etc.)
    "mesh_format": "obj",           # Format of exported 3D mesh files
    "point_format": "ply",          # (Currently unused) Format of exported 3D point clouds
    "settings_format": "json",      # Format of exported world seeds
    "database_format": "sqlite3"    # (Currently unused) Format of exported planet databases
}