AkeemAllen / WikiGen

Desktop Application to generate wikis for Pokemon Rom Hacks and Fan Games
5 stars 1 forks source link

Pokemon Move Data repository #7

Open AkeemAllen opened 8 months ago

AkeemAllen commented 8 months ago

As the WikiGen maintainer, I want to create a repository that contains all of the moves for all pokemon based on generation. It is currently too difficult to parse the version groups through pokeAPI.

AkeemAllen commented 7 months ago

Things to consider

Below is a list of considerations I need to make in order to create this repository. There will be tradeoffs and limitations to consider.

Data format and Conversion

This whole problem exists because of the structure of version groups from pokeAPI. I need to convert the data into a format I can work more easily with.

Current format

"moves": [
    {
      "move": {
        "name": "swords-dance",
        "url": "https://pokeapi.co/api/v2/move/14/"
      },
      "version_group_details": [
        {
          "level_learned_at": 0,
          "move_learn_method": {
            "name": "machine",
            "url": "https://pokeapi.co/api/v2/move-learn-method/4/"
          },
          "version_group": {
            "name": "yellow",
            "url": "https://pokeapi.co/api/v2/version-group/2/"
          }
        },
      ]
   }
]

The nested nature of version group details makes it difficult to parse and select move details based on version.

Desired format with example Pokemon and moves

"Bulbasaur": {
    "red-blue": {
        "swords-dance": {
            "level_learned_at": 0,
            "learn_method": "machine"
        }
    },
    "emerald": {
        "swords-dance": {
            "level_learned_at": 10,
            "learn_method": "level-up"
        }
    }
}

This makes it much easier to select all of the desired moves from a single version.

File Size (Sheer amount of repeat data)

I have to find a way to store this large amount of data this will generate. Storing it all in a single file isn't reasonable. The file would end up being over 2 million lines at minimum.

The best workaround I can think of is to store the moveset for each pokemon in separate files. Eg. venusaur-moves.json would look like below

"red-blue": {
        "swords-dance": {
            "level_learned_at": 0,
            "learn_method": "machine"
        }
    },
    "emerald": {
        "swords-dance": {
            "level_learned_at": 10,
            "learn_method": "level-up"
        }
    }

Of course, there's the drawback of needing multiple files (potentially over 1000, one for each pokemon), but this avoids needing to do any other computation.

Versioning application to moveset and moves.

As a first draft, I'll force Pokemon movesets and all moves in general to use the same version selected from the start. This way I don't need to consider what happens if the version is changed for the moves or the movesets. This can be considered at a later date.

Missing/empty version group

Some moves might not have data set for a particular version. Eg. headbutt on venusaur doesn't have data for the red-blue or emerald versions.

A kind of fallback will need to be created.