Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tilesets: add tools to automatically create tilesheets #34299

Merged
merged 3 commits into from
Oct 11, 2019

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented Sep 28, 2019

Summary

SUMMARY: Infrastructure "tilesets: add tools to automatically create tilesheets"

Purpose of change

Fixes #31417

Creating and especially maintaining tilesets, because all the tilesheets share a common, sequential index. Adding a new tile to the middle of a tilesheet requires updating all the indexes for every tile that follows.

Simplify the process through automation scripts.

Describe the solution

Add two new scripts: one decomposes an existing tilesheet into individual tile files with arbitrary names and corresponding tile_entry files, and the second composes the tile files and tile_entry files into tilesheets with dynamically generated indices.

Additional context

Sample automatically generated tilesheet from ChestHole16:
tree_32x40

@mlangsdorf mlangsdorf changed the title tilesets: add tools to automatically create tilesheets [WIP] tilesets: add tools to automatically create tilesheets Sep 28, 2019
@mlangsdorf mlangsdorf requested a review from I-am-Erk September 28, 2019 12:24
@mlangsdorf mlangsdorf added [Python] Code made in Python Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA SDL: Tiles / Sound Tiles visual interface and sounds. labels Sep 28, 2019
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/abandoned-32x32-msx-dead-people-tileset/18775/404

@mlangsdorf mlangsdorf changed the title [WIP] tilesets: add tools to automatically create tilesheets [WIP] [DO NOT MERGE] tilesets: add tools to automatically create tilesheets Sep 28, 2019
@mlangsdorf mlangsdorf force-pushed the gfx_compositor branch 2 times, most recently from e03e87b to 7f2fef3 Compare September 28, 2019 23:58
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/abandoned-32x32-msx-dead-people-tileset/18775/411

@mlangsdorf mlangsdorf force-pushed the gfx_compositor branch 2 times, most recently from 7cfe70d to c388407 Compare October 1, 2019 21:28
doc/TILESET.md Outdated Show resolved Hide resolved
@mlangsdorf mlangsdorf force-pushed the gfx_compositor branch 3 times, most recently from bcfe09b to 32b0676 Compare October 3, 2019 22:46
@mlangsdorf mlangsdorf changed the title [WIP] [DO NOT MERGE] tilesets: add tools to automatically create tilesheets tilesets: add tools to automatically create tilesheets Oct 3, 2019
@mlangsdorf
Copy link
Contributor Author

I have a cleaned up DeadPeopleEdition with no MShock derived tiles in it but it needs a lot of clean up.

@I-am-Erk
Copy link
Member

I-am-Erk commented Oct 3, 2019

I am beside myself with glee and nervous about the upcoming JSON I am going to need.

@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/abandoned-32x32-msx-dead-people-tileset/18775/423

@ralreegorganon
Copy link
Contributor

I've been using this to both compose and decompose tilesets, and it works well. I've got some additional enhancements based on using it, but I think given it is supplemental tooling, it should be merged as is.

One question, @mlangsdorf: is the deadpngs.json file just a byproduct that snuck in? I don't see it referenced by the docs nor the scripts, so I'm not sure if it's something that needs to stick around.

@mlangsdorf
Copy link
Contributor Author

deadpngs was the list of pngs that needed to be removed from MSX++DeadPeopleEdition; I'll clean it out. thanks.

please provide any suggestions for improvement; I am not a tileset designer nor a really great Python programmer.

1. Reads all tile entries
2. generates unique png names for each index that is in use
3. replaces all indices with the unique names
4. writes all the tile entries out to folders by png size
5. uses ImageMagick to pull all the image tiles for each
tile entry, using the unique names instead of the indices.

A later commit will add a compositor script that will reverse
this process to create a set of tilesheets from a collection
of arbitrarily named files.
Add a script that generates tilesheet pngs and a tile_config.json
from the pngs_ directories in a specified tileset directory.

1. walk through the directories, reading the tile_entry.json files
and creating lists of the png files.
2. by rows of 16 images, merge all the images with the same
dimensions into a tilesheet while creating dictionaries of image
names to tilesheet indices.
3. go through the tile_entries and change the bg and fg image
names to the tilesheet indices.
4. write the resulting tile_config.json

TODO: write the config file as tile_config.json instead of
test_tile_config.json
Add some minimal tileset documentation.  Add some information on
how tilesheets are indexed.

Describe how tools/gfx_tools/decompose.py and tools/gfx_tools/compose.py
work.

Include some recommendations for setting up composite tilesets.
@kevingranade kevingranade merged commit 8c5d5fa into CleverRaven:master Oct 11, 2019
@mlangsdorf mlangsdorf deleted the gfx_compositor branch October 11, 2019 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Python] Code made in Python Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA SDL: Tiles / Sound Tiles visual interface and sounds.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants