William Hutchins
Backback

Pokedex website: PHP

This was my first web project, I was inspired by a family member to try out PHP after I saw a project they were working on in it. I knew the strengths and weaknesses of the language and just wanted to have a go.

Due to this being my first project I didn't know much of how to structure a website and just did what felt right, these are the two main goals I went into the project with:

Starting the project

The first main hurdle was getting the data for the website which I went about through an unorthodox way, I knew about the PokéAPI project but I wanted to use a local database so I passed on that, I then found the veekun data but didn't see a way to use it and finally settled after decompiling an android app that I used called PokeInfo by Bruno Sousa. In the end it turns out that this was the veekun sqlite database which was also thesame source that PokéAPI uses for their database which I could have also used. regardless, I now had a database that I could use.

Building the website

So at first it all went very smoothly, I had managed to implement a version selector that will default to 4 in case of error, and this was where I reached the first hurdle; In the newer games the fairy typing was retroactively added to older Pokémon. This is not bad in of itself however in some cases it was used to replace the normal type and in others it was added as a second type. This means I needed to work out an algorithm to determine which were previously 1 type and which were already 2 types.

Luckily there was a simple algorithm that would work for every Pokémon affected:

  1. If the Pokémon has 1 type then ignore.
  2. If the Pokémon has 2 types and the first listed is fairy then keep the typing.
  3. If the Pokémon has 2 types and the second listed is fairy then remove the typing.
  4. Display all remaining fairy typing as normal typing.

The problem

After solving the issue of fairy types I kept building the website and then I reached another roadblock, Pokémon that retroactively got new abilities wasn't data I had access to. So just like the typing I tried to work out an algorithm that could make up for the missing data and this is all I could come up with:

  1. If the ability is newer than the selected game then remove.
  2. Do not display hidden abilities before generation 5.

Now this solution works for most cases however if you look at Torkoal it has Drought in ability slot 2, this was a change made in Pokémon Sun and Moon that they started to give old Pokémon old abilities whereas before they were only given new ones. This means there is no algorithm that you could use to work out what abilities a Pokémon had in a given game using the database I was using.

On top of this there have been many instances that Pokémon have had their stats changed over time but this is completely unaccounted for in the data and with this scenario it is impossible to even give any kind of version specific solutions. After this my desire to continue the project died as the main point of having a version specific Pokédex was impossible at that point.

What did I learn?

Overall, despite the unfortunate ending to the project I learned so much through the whole process that I can't help but be glad that I did it. To start with I learned a ton about web development, how the processes are and why they are by experimenting and figuring it out. Another skill I was new to was SQL, after writing the whole thing I had done some more complex queries and would say I had a decent start in learning the language.

Thanks for reading, here are some links you might find useful: