Skip to content

Commit

Permalink
Implemented GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-e committed Dec 24, 2024
1 parent 28800b2 commit 4685a72
Show file tree
Hide file tree
Showing 95 changed files with 49,423 additions and 299 deletions.
1 change: 0 additions & 1 deletion .envrc

This file was deleted.

50 changes: 48 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Environment files
.env
.envrc
/.direnv

# Build artifacts
/target
**/*.rs.bk

# Lock files
Cargo.lock
export.json
parsed_osm_data.txt

# IDE/editor files
.idea/
/.vscode/
/*.swp
*.iml
*.suo
*.ntvs*
*.njsproj
*.sln
*.ps1

# System files
.DS_Store
Thumbs.db
*.tmp
*.log

# Generated files
/export.json
/parsed_osm_data.txt
/gen/
/build/
*.rmeta
*.dSYM

# Tauri specific
flake/
capabilities/
gen/

# Miscellaneous
*.bak
*.old
*.orig

# Ignore all in flake directory except specific files
/flake/*
!/flake/flake.nix
!/flake/flake.lock
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "arnis"
version = "2.0.0"
version = "2.1.0"
edition = "2021"
description = "Arnis - Generate real life cities in Minecraft"
homepage = "https://github.com/louis-e/arnis"
Expand All @@ -11,9 +11,13 @@ readme = "README.md"
[profile.release]
lto = true

[build-dependencies]
tauri-build = { version = "2", features = [] }

[dependencies]
clap = { version = "4.1", features = ["derive"] }
colored = "2.1.0"
dirs = "4.0.0"
fastanvil = "0.31.0"
fastnbt = "2.5.0"
fnv = "1.0.7"
Expand All @@ -24,6 +28,11 @@ nalgebra = "0.33.0"
once_cell = "1.19.0"
rand = "0.8.5"
reqwest = { version = "0.12.7", features = ["blocking", "json"] }
rfd = "0.15.0"
semver = "1.0.23"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tauri = { version = "2", features = [] }
tauri-plugin-dialog = "2.0.0"
tauri-plugin-shell = "2"
tokio = { version = "1.42.0", features = ["full"] }
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img width="456" height="125" src="https://github.com/louis-e/arnis/blob/main/gitassets/logo.png?raw=true">
</p>

# Arnis [![CI Build Status](https://github.com/louis-e/arnis/actions/workflows/ci-build.yml/badge.svg)](https://github.com/louis-e/arnis/actions)
# Arnis [![CI Build Status](https://github.com/louis-e/arnis/actions/workflows/ci-build.yml/badge.svg)](https://github.com/louis-e/arnis/actions) [<img alt="GitHub Release" src="https://img.shields.io/github/v/release/louis-e/arnis" />](https://github.com/louis-e/arnis/releases) [<img alt="GitHub Downloads (all assets, all releases" src="https://img.shields.io/github/downloads/louis-e/arnis/total" />](https://github.com/louis-e/arnis/releases)

This open source project written in Rust generates any chosen location from the real world in Minecraft Java Edition with a high level of detail.

Expand All @@ -13,6 +13,28 @@ By leveraging geospatial data from OpenStreetMap and utilizing the powerful capa

Arnis is designed to handle large-scale data and generate rich, immersive environments that bring real-world cities, landmarks, and natural features into the Minecraft universe. Whether you're looking to replicate your hometown, explore urban environments, or simply build something unique and realistic, Arnis offers a comprehensive toolset to achieve your vision.

## :keyboard: Usage
<img width="60%" src="https://github.com/louis-e/arnis/blob/main/gitassets/gui.png?raw=true"><br>
Download the [latest release](https://github.com/louis-e/arnis/releases/) or [compile](#trophy-open-source) the project on your own.

Make sure to generate a new flat world in advance in Minecraft. Then choose your area in Arnis using the rectangle tool and select your Minecraft world - then simply click on 'Start Generation'!
The world will always be generated starting from the coordinates 0 0 0.

<details>

<summary>Alternatively you can also run Arnis the old fashioned way in the command line.</summary>

```arnis.exe --path="C:/YOUR_PATH/.minecraft/saves/worldname" --bbox="min_lng,min_lat,max_lng,max_lat"```

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.

<img width="60%" src="https://github.com/louis-e/arnis/blob/main/gitassets/bbox-finder.png?raw=true"><br>
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. Try starting with a small area since large areas take a lot of computing power and time to process.<br>

<i>Note: This might not be working right now since the console gets suppressed.</i>

</details>

## :floppy_disk: How it works
![CLI Generation](https://github.com/louis-e/arnis/blob/main/gitassets/cli.gif?raw=true)

Expand All @@ -26,19 +48,6 @@ The raw data obtained from the API *[(see FAQ)](#question-faq)* includes each el
5. Generate Ground Layer: A ground layer is generated based on the provided scale factors to provide a base for the entire Minecraft world. This step ensures all areas have an appropriate foundation (e.g., grass and dirt layers).
6. Save the Minecraft World: All the modified chunks are saved back to the Minecraft region files.

## :keyboard: Usage
Get the [latest release](https://github.com/louis-e/arnis/releases/) or [compile](#trophy-open-source) the project on your own.
#### Run: ```arnis.exe --path="C:/YOUR_PATH/.minecraft/saves/worldname" --bbox="min_lng,min_lat,max_lng,max_lat"```

### How to find your bbox coordinates
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](https://github.com/louis-e/arnis/blob/main/gitassets/bbox-finder.png?raw=true)
The world will always be generated starting from the coordinates 0 0 0. Try starting with a small area since large areas take a lot of computing power and time to process.

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.

## :question: FAQ
- *Wasn't this written in Python before?*<br>
Yes! Arnis was initially developed in Python, which benefited from Python's open-source friendliness and ease of readability. This is why we strive for clear, well-documented code in the Rust port of this project to find the right balance. I decided to port the project to Rust to learn more about it and push the algorithm's performance further. We were nearing the limits of optimization in Python, and Rust's capabilities allow for even better performance and efficiency. The old Python implementation is still available in the python-legacy branch.
Expand All @@ -51,7 +60,6 @@ The project is named after the smallest city in Germany, Arnis[^2]. The city's s

## :memo: ToDo and Known Bugs
Feel free to choose an item from the To-Do or Known Bugs list, or bring your own idea to the table. Bug reports shall be raised as a Github issue. Contributions are highly welcome and appreciated!
- [ ] Design and implement a GUI
- [ ] Memory optimization
- [ ] Fix Github Action Workflow for releasing Linux & MacOS Binary
- [ ] Evaluate and implement multithreaded region saving
Expand All @@ -67,6 +75,7 @@ Feel free to choose an item from the To-Do or Known Bugs list, or bring your own
- [ ] Evaluate and implement elevation
- [ ] Generate a few big cities using high performance hardware and make them available to download
- [ ] Implement memory mapped storing of chunks to reduce memory usage
- [x] Design and implement a GUI
- [x] Fix faulty empty chunks ([https://github.com/owengage/fastnbt/issues/120](https://github.com/owengage/fastnbt/issues/120)) (workaround found)

## :trophy: Open Source
Expand All @@ -81,6 +90,7 @@ Feel free to choose an item from the To-Do or Known Bugs list, or bring your own
This project is open source and welcomes contributions from everyone! Whether you're interested in fixing bugs, improving performance, adding new features, or enhancing documentation, your input is valuable. Simply fork the repository, make your changes, and submit a pull request. We encourage discussions and suggestions to ensure the project remains modular, optimized, and easy to use for the community. You can use the parameter --debug to get a more detailed output of the processed values, which can be helpful for debugging and development. Contributions of all levels are appreciated, and your efforts help improve this tool for everyone.

Build and run it using: ```cargo run --release -- --path="C:/YOUR_PATH/.minecraft/saves/worldname" --bbox="min_lng,min_lat,max_lng,max_lat"```<br>
For the GUI: ```cargo run --release```<br>

After your pull request was merged, I will take care of regularly creating update releases which will include your changes.

Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
Loading

0 comments on commit 4685a72

Please sign in to comment.