louis-e / arnis

Arnis - Generate cities from real life in Minecraft
GNU General Public License v3.0
260 stars 18 forks source link
algorithm minecraft openstreetmap osm overpass-api python

Arnis Testing

This open source project generates any chosen location from the real world in Minecraft, allowing users to explore and build in a virtual world that mirrors the real one.

Where did you find this project?

:desktop_computer: Example

Minecraft World Demo Minecraft World Demo Before After

:floppy_disk: How it works

CLI Generation

The raw data obtained from the API (see FAQ) includes each element (buildings, walls, fountains, farmlands, etc.) with its respective corner coordinates (nodes) and descriptive tags. When you run the script, the following steps are performed automatically to generate a Minecraft world:

Processing Pipeline

  1. Scraping Data from API: The script fetches geospatial data from the Overpass Turbo API.
  2. Determine Coordinate Extremes: Identifies the highest and lowest latitude and longitude values from the dataset.
  3. Standardize Coordinate Lengths: Ensures all coordinates are of uniform length and removes the decimal separator.
  4. Normalize Data: Adjusts all coordinates to start from zero by subtracting the previously determined lowest values.
  5. Parse Data: Transforms the raw data into a standardized structure.
  6. Sort elements by priority: Enables a layering system with prioritized elements.
  7. Optimize Array Size: Focuses on the outermost buildings to reduce array size.
  8. Generate Minecraft World: Iterates through the array to create the Minecraft world, including 3D structures like forests, houses, and rivers.

:keyboard: Usage

python3 arnis.py --bbox="min_lng,min_lat,max_lng,max_lat" --path="C:/Users/username/AppData/Roaming/.minecraft/saves/worldname"

Use http://bboxfinder.com/ to draw a rectangle of your wanted area. Then copy the four box coordinates as shown below and use them as the input for the --bbox parameter. How to find area The world will always be generated starting from the coordinates 0 0 0.

Manually generate a new Minecraft world (preferably a flat world) before running the script. The --bbox parameter specifies the bounding box coordinates in the format: min_lng,min_lat,max_lng,max_lat. Use --path to specify the location of the Minecraft world. With the --timeout parameter you can set the timeout for the floodfill algorithm in seconds (default: 2). You can optionally use the parameter --debug to see processed value outputs during runtime.

Experimental City/State/Country Input Method

The following method is experimental and may not perform as expected. Support is limited.

python3 arnis.py --city="CityName" --state="StateName" --country="CountryName" --path="C:/Users/username/AppData/Roaming/.minecraft/saves/worldname"

Docker image (experimental)

If you want to run this project containerized, you can use the Dockerfile provided in this repository. It will automatically scrape the latest source code from the repository. After running the container, you have to manually copy the generated region files from the container to the host machine in order to use them. When running the Docker image, set the --path parameter to /home.

docker build -t arnis .
docker run arnis --city="Arnis" --state="Schleswig Holstein" --country="Deutschland" --path="/home"
docker cp CONTAINER_ID:/home/region DESTINATION_PATH

:cd: Requirements

:question: FAQ

:memo: ToDo

Feel free to choose an item from the To-Do or Known Bugs list, or bring your own idea to the table. Contributions from everyone are welcome and encouraged to help improve this project.

:bug: Known Bugs

:trophy: Hall of Fame Contributors

This section is dedicated to recognizing and celebrating the outstanding contributions of individuals who have significantly enhanced this project. Your work and dedication are deeply appreciated!

Contributors:

:star: Star History

Star History Chart

:copyright: License Information

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).[^3]

Copyright (c) 2022-2024 louis-e

[^3]: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For the full license text, see the LICENSE file.