Skip to content

A map generation and png visualization console application in Python.

License

GPL-3.0, Unlicense licenses found

Licenses found

GPL-3.0
LICENSE
Unlicense
LICENSE_PNG
Notifications You must be signed in to change notification settings

Liam-Ralph/biomegen

BiomeGen

Released July 2025

Version 3.1.0

Updated December 2025


Description

BiomeGen is a C map generation tool that provides output in a png format. Customization options include map dimensions, island abundance, island size, and island abundance relative to water. Generates water, land, and various biomes. Uses multiprocessing in C for increased efficiency. Includes automated runs and another C program to create multiple images or test generation speed.


Operating System Support

Version 3.0.0 and above

  • Linux supported, tested with Linux Mint 22.2 and antiX 23.2
  • MacOS and BSD OSs should be supported, but haven't been tested
  • Windows is not currently supported, but WSL should work

Python Versions (v2.1.6 and below)

  • Any OS with Python 3.10+ should work (Linux Mint, antiX, and Windows tested)

License

This project is licensed under the GNU General Public License v3.0 (GNU GPLv3), as detailed in LICENSE, with the following exceptions:

  • result.png, the project's output, which is licensed under The Unlicense, as detailed in LICENSE_PNG. This includes the result.png included on Github.
  • Any image output generated by this program is yours. You are free to copy, edit, distribute, sell it, and use it any way you want. Credit is appreciated, but not required.

Compilation

This project requires the math.h library for autorun.c, and the math.h and png.h libraries for main.c. Autorun should compile with gcc autorun.c -o autorun -lm -Wall. If the gcc command is available on your system, autorun should be able to properly compile main.c. It uses the command gcc -D_GNU_SOURCE main.c -o main -lm -lpng -Wall. The main executable must be named "main" or "main.exe" on Windows. The -D_GNU_SOURCE flag shouldn't be required on most Linux distros. Installing the png library may be required. On Debian-based systems, I used sudo apt install libpng-dev. On Windows with MinGW, I used pacman -S mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-zlib.


Automation

This project includes the ability to run in an automated mode. There are two ways to do this:

  1. Add arguments when running the main C file. With a command like ./main 1920 1080 100 120 50 5 8 file_path.png, you can pass arguments that will be used by the C program, skipping over manual inputs. The arguments passed are: map width, map height, map resolution, island abundance, island size, coastline smoothing, cpu processes, and output path. Except for the output path, all of these inputs must be integers. These arguments are not sanitized, meaning they can be outside of the limits imposed for manual inputs, which can break the program (e.g. a negative map width). This option will only print the generation time for the C program.

  2. Use the autorun.c program and autorun_tasks.txt. The C program runs the main C program and handles passing arguments. It gets its instructions from autorun_tasks.txt. Each line represents one task, empty lines and comments will cause errors. Currently, it contains the example task 2:n:n:1920 1080 100 120 50 5 8 file_path.png. The C program will also add statistics, including mean generation time, percentiles, and more. Statistics will be saved to the file autorun_results.csv. The statistics currently there are for comparing versions at this project's website, and can be removed on any clones or forks, but be careful to leave the first line alone.

    • 2 is the number of repetitions, meaning the main C program will be run twice. This must be a positive integer.
    • n is whether to show the times for each repetition (y/n). Yes means each repetition will show the time it took to run upon completion. This can be useful for measuring variation between repetitions, but can take up a lot of space in your terminal for tasks with many repetitions. No will just show a progress bar based on the number of tasks completed. Must be "y" or "n".
    • n is whether to save the png outputs (y/n). Yes means each output will be saved in a separate file, repetition 1 in file_path1.png, repetition 2 in file_path2.png, etc. No means each repetition will overwrite the previous, and file_path.png will be deleted at the end of the program. Must be "y" or "n".
    • 1920 1080 100 120 50 5 8 file_path.png is simply the arguments to be passed to the main C program. The only one that may be edited by the C program is file_path.png, which will be edited if "y" in the second C program argument. Must follow the rules for C arguments in 1. Max 255 characters.

    With this option, you can generated multiple different png files from the same inputs, or test the generation speed of the main C program. This option will also tell you the generation times for each repetition, and the average generation time.


Other Files

  • sample_inputs.txt Includes a number of inputs that can pasted into your terminal (Ctrl + Shift + V usually works for this).

Planned Updates

3.2.0

  • Test more efficiency improvements
    • Only creating one set of worker processes

4.0.0

  • Rewrite land biome generation algorithm
    • Calculate based on prevailing wind direction, rainfall, moutain effects
  • Rewrite coastline smoothing algorithm
    • Achieve something similar in a more efficient manner

About

A map generation and png visualization console application in Python.

Topics

Resources

License

GPL-3.0, Unlicense licenses found

Licenses found

GPL-3.0
LICENSE
Unlicense
LICENSE_PNG

Contributing

Stars

Watchers

Forks

Languages