msikma / pokesprite

Database project of box and inventory sprites from the Pokémon core series games
https://msikma.github.io/pokesprite/
MIT License
972 stars 167 forks source link

refactor: renamed icons for better veekun/pokedex compatibility #40

Closed route1rodent closed 6 years ago

route1rodent commented 6 years ago

Related to #39 There are still many identifiers from the DB that cannot be found as icons (mainly items), but they are mainly aliases of their main icon, which is ok. I added support for most of them via pkmn.json, but some of them are tricky to configure because their duplicated is not the main icon, is one of the other forms.

There was no way to tweak that, so I did something like this, for future reference:

"battle-bond": {
  "is_duplicate": true,
  "is_duplicate_from": "ash"
}

but it is still not supported in the generated CSS/spritesheet, causing for example pkmn-greninja form-battle-bond to have the regular Greninja icon instead of the Ash one. It would be great if the generator could support that is_duplicate_from property or similar.

Here is the list of DB identifiers that are problematic in that sense:

Pokemon

Items

Items are more tricky to match because they are grouped by category, so the icon files themselves don't contain the DB name unless the folder name is added as a suffix or prefix (e.g. ball/beast.png -> beast-ball).

Here is a list of item names from the DB that are not found as icons, they are aliases or they don't have an official icon:

I also generated a page in my project, to see the full list and what is it matching or what not: https://capsulemonsters.github.io/pokedex

route1rodent commented 6 years ago

By the way @msikma I didn't re-generate the build because I don't have the necessary tools (like tools/closure-compiler.jar). Could you take care of that?

Let me know if there are any other required config or code changes.

msikma commented 6 years ago

👍

Will get to work on this when I'm able to. Thanks for your help!

msikma commented 6 years ago

Just wanted to let you know that things are busy and I'm traveling soon, so I'll probably be able to look at this no sooner than April. When I do I'll make sure to look at it properly and do all the necessary testing though.

msikma commented 6 years ago

Update: I haven't forgotten about this! 😄

Tomorrow I'm going to look into this.

route1rodent commented 6 years ago

@msikma haha it's ok, it's holidays :)

msikma commented 6 years ago

I'm working on this now.

My first thought is that the is_duplicate_from is a good idea, and in fact it can just replace is_duplicate completely. So I'm going to turn all is_duplicate: true into is_duplicate_from: '.' with the period being code for "the standard icon" in my program.

I've got a question regarding Meowstic. To my knowledge, this is a simple gender difference, like many other Pokémon. But according to your list, it should be a form? I'm curious why that is, because as far as I can tell there's nothing different about Meowstic compared to other Pokémon that have gender differences, like for example Hippopotas. Maybe you could clarify that for me so I know what to do. Is Meowstic an exception that requires meowstic-female to be a form identifier?

(Right now the code does not actually permit "female" + "right" to be true at the same time, so I was thinking of changing some code here anyway, even though no icon currently needs both values.)

Regarding items: I see you've left them basically the same except for some renaming. That's fine. Your list raises a few questions:

Here is a list of item names from the DB that are not found as icons, they are aliases or they don't have an official icon:

I have some of these. Like bridge-mail-d is mail/bridge-m.png. Or the rm keys. Some of them I don't have, like data-card-01 although I do have data-card. I think these need to be clarified. Do I need to rename or map the ones I do have? What about the ones I don't have? Should I try to find them or do we use placeholders?

msikma commented 6 years ago

Made some changes. is_duplicate is gone now, replaced by is_duplicate_from. (Although maybe I'll rename that to is_duplicate_of later... but no big deal for now.) I also changed the code so that it makes use of this new value correctly. So now the Alolan forms are correctly referenced in the build.

screen shot 2018-04-06 at 00 40 11

That's one problem taken care of at least. Let me know your thoughts regarding my questions above.

route1rodent commented 6 years ago

Hey thanks for your feedback

About Meowstic, they are more than a cosmetic difference (different abilities and different moveset) https://www.serebii.net/pokedex-sm/678.shtml https://www.smogon.com/dex/sm/pokemon/meowstic-f/

I don't know how to solve it code or file-wise. In my opinion it makes more sense to have the file as meowstic-female together with meowstic and the current female as an alias/duplicate of that form.

For the items, most of them excepting the HM/TMs and the mega- ornaments have an existing image under another similar name, like n-solarizer--merge, n-solarizer--split both are duplicates of n-solarizer.

About is_duplicate_of I find it more appropriate too.

msikma commented 6 years ago

Right, so they are basically more than a cosmetic difference. I understand. I'll work on this a little bit more. I'll make it so that you can access them through pkmn-meowstic gender-female, pkmn-meowstic-female. Currently there are actually no selectors for "male" since we only need one, I assume that's still OK. edit: actually, I'll make sure pkmn-meowstic-male also works. I'll just leave my own gender-female selector alone. For this project's purposes it's fine not to have gender-male, and I think not having it doesn't really matter for anyone else.

The thing about the images is that I don't have a database for them. If there are duplicates, we can either copy the files, or make a JSON file that specifies which duplicates there are. I'm fine with either. Actually, maybe duplicating the files is better—data duplication is seldom a good thing, but it would make it really easy to find the icons if you were looking in the icon directory directly. Having a different filename than you'd expect, which can only be found by looking at a JSON file, is more confusing. So I'm thinking we will need to duplicate and rename some of the items.

route1rodent commented 6 years ago

@msikma Duplication of individual files doesn't hurt if they don't end up duplicated in the final spritesheet image. If you have a mechanism to avoid that then that's great.

The thing about the images is that I don't have a database for them.

Do you mean the item icons? I can generate from the DB a JSON for you in the same format as the pkm.json. Would that make sense? Then you'll be able to re-use the pkm code also for the items (excepting that they don't have right or female variants)

route1rodent commented 6 years ago

I added the items.json file https://github.com/capsulemonsters/msikma-pokesprite/blob/feature/veekunCompatibility/data/items.json

but I didn't clean it up (duplicates, items that don't have any official icon like the mega accessories, etc)

It's generated with this script: GeneratePokespriteItemsJsonCommand.php

msikma commented 6 years ago

Sorry for being absent for so long. I'll put some work in this in the coming week, hopefully then we can finish it.

msikma commented 6 years ago

I'm (finally) working on this again! I'll need a little bit more help. There's some stuff missing and some stuff inconsistent between the Veekun database and my files. This is mostly because I haven't retrieved the USUM icons yet. Everything is just SM at the moment. Maybe I can get these icons from your repository somewhere—else I'll go and ask around on IRC.

Here's the full details:


My mega items have different names, and I'm missing some. These are the icons in the database:

The files I have:


For travel-trunk, I've got two icons: travel-trunk--gold.png and travel-trunk--silver.png. The database should contain both of these, right?


These appear to be typoed in the database:

I've got the following icons, how should we resolve this? Renaming the files is easier, I'm guessing?

I also have xtransceiver--blue, but I assume I should rename this to just xtransceiver?


There are a few for which I've got partial icons:


Missing:


The wonder launcher icons seem to be a bit problematic. I can see that the database contains e.g. x-sp-atk-6, dire-hit-2, ability-urge etc. But...the wonder launcher also has its own versions of regular items, such as revive. And I can only find one revive in the database, presumably for the regular item. This seems wrong - I think the database is missing wonder launcher icons.

On my end, I'm missing all the other data cards. I've only got data-card.png in the key-items directory, but the database wants 27 of them.

Furthermore there's 100 TMs and 8 HMs. All I have is 4 HMs and all TMs by their type (poison, fighting, etc). What should we do about those?


Finally, I've got some legacy icons that the database does not have, but that I would like to keep around for compatibility. Probably doesn't matter, I'll just keep them and they will simply not be linked to any item ID.

There's also the body-style icons that don't refer to any items but are used in the Pokédex. We can just ignore those too I think.


That's it. So maybe you could help me by giving me your thoughts on the things I mentioned.

Sorry for taking so long with this, stuff just kept coming up constantly. 🙂

If I can get all this sorted out, I can finish the work by updating the JSON file that you generated and link everything to the correct icon files, and then modifying the code to make use of the items file in creating the sprite sheet. That should be easy and quick to do.

route1rodent commented 6 years ago

hey sorry for the delay, I am also busy with life and work hehe. Regarding the missing icons:

msikma commented 6 years ago

Thanks for the write-up. I'll go finish the last few things then.

msikma commented 6 years ago

Sorry for leaving this alone for yet another month. Really need to finish working on this now.

I tried to figure out a way to bind the items to my icons, with the requirement that it's easy to match a database ID to an icon, without leaving out icons that cannot be matched to an item. In some format that's simple and straightforward to understand and use in the script.

In the end I'm thinking this is probably a better format: https://gist.github.com/msikma/cfb582269852a426778fce4999d116d0

The idea being that you can match a database ID to an array of two items: set name, and filename. (Or null if the item does not have an associated icon, e.g. the tm01 etc. items.) This is done by looking at the 'items' section.

The actual icon data still follows the set/filename structure and can be seen in the 'icons' section of the JSON file. If an icon is linked to an item from the database, there will be an item array with its information.

It's a little roundabout to get an item's information this way, but it's space-efficient. It's not entirely done yet because like I mentioned before, I've got a few conflicts to solve. Right now the "revive" item is linked to the wonder launcher's "revive" icon, instead of from the medicine set, for example.

I should also note I'm planning to rewrite this script in JS sometime. The code is very old. Making a new codebase would make everything much easier, and then I can also finally modernize the JS for making the icons appear... and make a ReactJS component.

msikma commented 6 years ago

I've finished generating the JSON file with the items, just need to finish updating the script to utilize it.

msikma commented 6 years ago

This took me way too long. Sorry about that. I'm planning to rewrite this repo at some point and make it 100x simpler.

Thanks for your efforts in unifying these various projects.

I hope that the icon format I've used is acceptable for other projects, if not let me know and I'll change it.