Tool to stitch Foxhole hex maps and generate map tiles.
Project description
Foxhole Hexes
Tool to help stitch and tile the Foxhole game map. Assemble all the individual hex maps into one master map, and then cut the map up into tiles that can be rendered on a map like Leaflet
Install
From PyPI:
pip install foxhole-hexes
From source:
pip install -e .
How to run
hex2tile
Usage: hex2tile [OPTIONS]
Options:
--hexes FILE Path to config JSON with format: {<hex_id>: { 'name':
<hex_name>, 'file': <hex_png>, 'q': <q>, 'p': <p> } } q
and r are axial hexagon coordinates (legacy key 'p' is
still accepted) [required]
--out DIRECTORY Output directory for tiles (creates z/x/y.png).
--max-zoom INTEGER Max zoom level (master resolution uses ppu =
2^maxZoom). [default: 5]
--min-zoom INTEGER Min zoom level [default: 0]
--tile-size INTEGER Tile size in pixels (typically 256). [default: 256]
--hex-size INTEGER Width of the hex map (corner to corner) in pixels.
[default: 1024]
--write-master FILE Optional path to write the assembled master PNG for
debugging.
-v, --verbose More logging.
--help Show this message and exit.
Example:
hex2tile --hexes hexes.json --out tiles --max-zoom 5 --min-zoom 2 --write-master master.png
Module form:
python -m foxhole_hexes.hex2tile --hexes hexes.json --out tiles --max-zoom 5 --min-zoom 2 --write-master master.png
tga2png
Usage: tga2png [OPTIONS]
Convert TGA icons to PNG using Pillow.
Options:
--from DIRECTORY Source directory containing .tga files.
[required]
--to DIRECTORY Destination directory for .png files (created
if missing). [required]
--recursive / --no-recursive Search for .tga files recursively under the
source directory. [default: no-recursive]
--overwrite / --no-overwrite Overwrite existing .png files in the
destination directory. [default: no-
overwrite]
-h, --help Show this message and exit.
Example
tga2png --from ../warapi/Images/Maps --to png/
Module form:
python -m foxhole_hexes.tga2png --from ../warapi/Images/Maps --to png/
Hexes
The map layout is configured in a json file.
{
"TempestIslandHex": {
"name": "Tempest Island", "file": "pngs/MapTempestIslandHex.png", "q": -2, "p": 4
},
"GreatMarchHex": {
"name": "Great March", "file": "pngs/MapGreatMarchHex.png", "q": 2, "p": 0
},
"DeadLandsHex": {
"name": "DeadLandsHex", "file": "pngs/MapDeadLandsHex.png", "q": 0, "p": 0
},
...
The position of each hex is defined by the q,p coordinates. This axial coordinate system is based on this diagram.
Learn more about hexagon math here:
- https://math.stackexchange.com/questions/2254655/hexagon-grid-coordinate-system
- https://www.redblobgames.com/grids/hexagons/
I may have gotten some of the theory and conventions wrong in the code, but the results seem to work.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file foxhole_hexes-1.0.2.tar.gz.
File metadata
- Download URL: foxhole_hexes-1.0.2.tar.gz
- Upload date:
- Size: 712.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee3e9e11c59a4dceb65a711859d6b23fa477986393f0e3e4c8a1cbc5bb913d8d
|
|
| MD5 |
5d2f88b19e335ad0b5bf38b18a7cfc47
|
|
| BLAKE2b-256 |
099c35642146bbe6a91978a75ccb0b1722edfbb77376e3f28379729e4c271d2a
|
Provenance
The following attestation bundles were made for foxhole_hexes-1.0.2.tar.gz:
Publisher:
publish.yml on notbadjon/foxhole-hexes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
foxhole_hexes-1.0.2.tar.gz -
Subject digest:
ee3e9e11c59a4dceb65a711859d6b23fa477986393f0e3e4c8a1cbc5bb913d8d - Sigstore transparency entry: 931882017
- Sigstore integration time:
-
Permalink:
notbadjon/foxhole-hexes@e2480d1d79000fdff586efb1cf88bedb8b353d24 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/notbadjon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e2480d1d79000fdff586efb1cf88bedb8b353d24 -
Trigger Event:
release
-
Statement type:
File details
Details for the file foxhole_hexes-1.0.2-py3-none-any.whl.
File metadata
- Download URL: foxhole_hexes-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee57f92eb80a36c55fa291c37713a1f13edf9eb0fd12aadd80287a705c6c578
|
|
| MD5 |
417e656c7da6eb6c26db1f9bfdeeb137
|
|
| BLAKE2b-256 |
41b8d83e760e92f29096f28f2c77893fd5ee10ad0fa67b06a807e7f2acb5545a
|
Provenance
The following attestation bundles were made for foxhole_hexes-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on notbadjon/foxhole-hexes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
foxhole_hexes-1.0.2-py3-none-any.whl -
Subject digest:
aee57f92eb80a36c55fa291c37713a1f13edf9eb0fd12aadd80287a705c6c578 - Sigstore transparency entry: 931882036
- Sigstore integration time:
-
Permalink:
notbadjon/foxhole-hexes@e2480d1d79000fdff586efb1cf88bedb8b353d24 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/notbadjon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e2480d1d79000fdff586efb1cf88bedb8b353d24 -
Trigger Event:
release
-
Statement type: