ArnoldSmith86 / virtualtabletop

a virtual surface in the browser on which you can play board, dice and card games
https://virtualtabletop.io
GNU General Public License v3.0
166 stars 30 forks source link

categories for game-icons.net in the symbol picker #2318

Closed ArnoldSmith86 closed 6 days ago

ArnoldSmith86 commented 2 weeks ago

I did not get an answer to https://github.com/game-icons/icons/issues/954 and now I started to use ChatGPT to split the icons into categories strictly by looking at their name. This resulted in a new repository where I keep the scripts and history: https://github.com/ArnoldSmith86/gameicons-metadata

This PR makes the icon picker a lot more useful for game-icons.net icons by splitting them into (not very good) categories and adding a few tags (for example making the icon "hound" appear when searching for "dog"):

image

This is mainly just a change to assets/fonts/symbols.json but it contains two code changes:

  1. The preview of the icons is rendered using a big PNG containing all icons. To get the correct location in that PNG, the code relied on the icons being in the correct order in assets/fonts/symbols.json. That is no longer the case so now the index is the first entry in the keywords array.
  2. Basically unrelated to everything else, it no longer searches the author name. So searching for "dog" no longer includes the icon "heavenly-dog/defensive-wall".

All of this is clearly far from perfect but IMO still a substantial improvement over the status quo. Feel free to follow the instructions on https://github.com/ArnoldSmith86/gameicons-metadata?tab=readme-ov-file#tool to improve the categories.


I'm gonna leave this here for any future PRs:

{
    sed -n '0,/Game-icons/p' ../virtualtabletop/assets/fonts/symbols.json | head -n -1
    tail -n +2 symbols.json | head -n -2
    echo '  },'
    sed -n '/Material/,$p' ../virtualtabletop/assets/fonts/symbols.json
} > new.json
mv new.json ../virtualtabletop/assets/fonts/symbols.json
rm symbols.json

After calling https://github.com/ArnoldSmith86/gameicons-metadata/blob/master/generate-symbols-json.py, it can be used to update assets/fonts/symbols.json.


PR-SERVER-BOT: You can play around with it here: https://test.virtualtabletop.io/PR-2318/pr-test (or any other room on that server)

RaphaelAlvez commented 2 weeks ago

It takes a while because ChatGPT can only process a few hundred at a time and there is a usage limit.

Feels like something we could all help with if you share the how to do it

ArnoldSmith86 commented 2 weeks ago

Feels like something we could all help with if you share the how to do it

I was writing... But please do..

Just commit to the list-categories.txt. I'll rerun the python script every now and then.

ArnoldSmith86 commented 2 weeks ago

Now there are "only" 55 categories.

ArnoldSmith86 commented 2 weeks ago

image

An approach like that looks promising for further improvements.

ArnoldSmith86 commented 1 week ago

I updated the PR description now that the tools are in their own repository.

IMO, this is ready to be reviewed and merged. None of the data is perfect but this is a nice first step. And I wanna do other stuff now. :grin: