Or "How to not kill Ponyhead's bandwidth"
The MCG Server needs images in a ponyhead-like format for serving them to the client, this is desirable for other kind of projects as well, so here's a guide on how to extract images from OCTGN image packs for the MLP:CCG OCTGN game definition, which are easily available online.
Requirements
- Go 1.10+ (but earlier versions might work)
- MLP:CCG OCTGN Game definition, install it in OCTGN or get it from GitHub
- MLP:CCG OCTGN Image packs, look them up on the MLP:CCG OCTGN Discord group
- Windows is not needed, all the tools are cross-platform!
Let's do the thing!
1. Create a GUID translation map
This map translates all the GUIDs from the image packs to card IDs, for example:
656...df9/Sets/c0a...e58/Cards/3c7...181.jpg
➞ cn41.jpg
To install it, run this command to retrieve the source code and compile it:
go get git.fromouter.space/mcg/mlp-server-tools/tools/buildmap
If you installed the game definition via OCTGN, you can just run buildmap > cardmap.json
and it should work fine, if it doesn't or if you downloaded the game definition outside OCTGN's folder you need to specify the path to the Game "Sets" sub-folder using -set-path
, like this:
buildmap -set-path path/to/MLP-OCTGN/Sets > cardmap.json
2. Extract image packs with the converted filenames
This time we need a different tool:
go get git.fromouter.space/mcg/mlp-server-tools/tools/genpics
Make sure all the image packs (.o8c
) files are in the same directory with nothing else (at least no other .o8c
files), then run genpics
like this:
genpics -packdir dir/to/imgpacks -mapfile path/to/cardmap.json -out images
This will output all files in a new directory called images
.
If the packs contain files not referenced in the translation map, they will retain their original name (but not path) and placed in a sub-folder called unknown
.
That's it!
If all went accordingly, you should have a folder full of card images, like this: