Venomalia / UniversalDynamicInput

a custom button pack for dolphin that supports over 150 games!
Creative Commons Zero v1.0 Universal
131 stars 15 forks source link

Script to autogenerate mirrored and rotated assets #217

Closed Avasam closed 6 months ago

Avasam commented 6 months ago

My goals with this PR:

  1. Automate the generation of alternate assets *
  2. Prevent forgetting to create alternate assets (see #198)
  3. Set a precedent, this script can be extended to generate the "Two Palettes" assets for #171

*Note that this could be made as part of a GitHub Action to ensure we don't forget to run the script, and that manual changes in generated assets are cleared up. You could even automatically apply changes on PR (like an autofixer) using https://pre-commit.ci/ .

I went with Python because:

  1. Wanting to keep this project free of compilation (all scripts are runtime). Performance is not that critical (the script runs in about 8s on my Ryzen 5 2600).
  2. My other options were powershell and node (JS), Python already has great, easy to use C-binding libraries for image manipulation. It ended up easier and faster than the alternatives I could come up with.
Venomalia commented 6 months ago

First of all, thank you for your work.

Python would also be my preferred language for this. The "Two Palettes" are used by many games, I want to make a generic style out of it to support these games as well.

Avasam commented 6 months ago

The "Two Palettes" are used by many games, I want to make a generic style out of it to support these games as well.

Would you like me to do it in this PR as well? Or maybe first come up with a canonical name and representation in the file-system? I know Pitfall is split in "RG" and "BA", but are there games using a different split?


Is the script name and location good for you? Would you like a GitHub action and/or pre-commit.ci config that checks/autogenerates these? Or maybe later.


From Discord:

Avasam 💻🧙 — 12/26/2023 7:59 PM This makes me notice that _Rotated assets are strangely lower rez than the original assets?? Venomalia — Today at 3:56 PM If you mean the quality, it depends very much on the filter and the API that is used. but it's not a big difference. Avasam 💻🧙 — Today at 10:18 PM I mean the current existing _Rotated assets in the main branch are half the width and height than their non-rotated counterpart.

For instance: image

Venomalia commented 6 months ago

Name and location are good, you don't have to make any changes to the PR, I'm happy as it is.

I have to admit I'm not super familiar with GitHub action when it comes to scripts, but I don't mind setting it up as an action.

I know Pitfall is split in "RG" and "BA", but are there games using a different split?

Yes, this is used in exactly the same way in several games. My TextureExtraction Tool and Bigheads Custom Texture Tool PS can now also split and recombine these textures. sZ4wCPe

The "Two Palettes" are used by many games, I want to make a generic style out of it to support these games as well.

Would you like me to do it in this PR as well? Or maybe first come up with a canonical name and representation in the file-system?

I think Seperart would be better because we also need a new template for the creator tool. I wanted to think about the name but the way you did it in Pitfall is perfectly ok.

The current existing _Rotated assets in the main branch are half the width and height than their non-rotated counterpart.

That's only because they are rarely used to save unnecessary storage space.