Games are made out of Data

These are the building blocks of any great game!

If Games were buildings, the brick would be the different types of data that grow, morph, move around, and inform the UI, and most importantly, the player. Before we get too far, let's lay down the basics of what bricks of data Pokemon games are made up of! This is not an exhaustive list, but as this is a Main Quest, we can get into more niche and complex types of data in the Side Quests.

As a rule of thumb, I'll be using Object Oriented Programming (OOP) principles, as that is still the predominant paradigm in most projects, but will absolutely revisit and branch out using Functional Programming (FP) in some parts, including Side Quests

We're going to outline the basic data structures, or Objects or Structs depending on the programming language, that we'll be working with. I'll be using the term "MVP", which means "Minimum Viable Product", which is a term used to describe the extent you need to go to have a basic, minimalistic Pokemon game. As described before, you only need to go as far as you want with this!

Species

I use the term "Species" or "Breed" to describe the types of Pokemon that exist, and the term "Pokemon" to describe an instance, or creature that is of that type of Species. The Species describes the aspects of the Pokemon, such as its type, when it learns levels, when it evolves, while a Pokemon, which is of a given species, is the monster itself, and can be on your team, it has a level, it battles, and gains experience. If that doesn't make sense, wait until after reading the Pokemon section, as it elaborates a bit further.

Here is a basic Species:

{
    "id": 1,
    "types": ["grass", "poison"],
    "baseStats": {
        "hp": 45,
        "atk": 49,
        "def": 49,
        "specAtk": 65,
        "specDef": 65,
        "speed": 45,
    },
    // ...
}

If ever you see the comment

// ...

in code, that means that there is additional information or code that doesn't pertain to the current discussion that's been omitted for brevity

You won't see any values like Experience, Current HP, or Condition (like sleep, paralyze, freeze, confuse) because Species holds the info about each type of Pokemon as a whole, not a specific Pokemon of that Species. That comes next!

If you're interested to see how much data there is on a single Pokemon, checkout PokeAPI.co's entry for Bulbasaur:

Pokemon

This is a growing, battling monster that has a Species that informs how it grows, which moves it learns, and its current stats (stats increase as you level up)

Let's say you have a team of three Pokemon:

  1. Pikachu

    • Level: 25

    • Type: Electric

    • HP (Health Points): 47/47

    • Known Moves:

      • Thunder Shock

      • Thunder Wave

      • Thunderbolt

      • Tail Whip

  2. Bulbasaur

    • Level: 15

    • Type: Grass, Poison

    • HP: 35/39

    • Known Moves

      • Growl

      • Tackle

      • Vine Whip

      • Leech Seed

  3. Numel:

    • Level: 22

    • Types: Fire, Ground

    • HP: 60/60

    • Known Moves:

      • Tackle

      • Ember

      • Flame Wheel

      • Sandstorm

Your Pokemon have specific levels and individual moves, but their Types (like Poison or Grass) and what moves they can and cannot learn (or be taught) are determined by their Species.

Species have a far bigger impact on Pokemon than I initially thought. The casual Pokemon player may not know it, but there are Abilities (and Hidden Abilities) such as "Levitate", which makes you immune to Ground attacks, or "Blaze" which increases Fire-type moves by 50% when the ability-bearer's HP falls below 30%), Growth Rate (Erratic, Fast, Slow, etc.), Weight, Height, Base Experience, Base Friendship, Catch Rate, EV Yields... we'll get into all of that eventually, just wait!

Trainer

A Trainer is different from a "Player", because ideally, a Player can have multiple accounts. A Trainer has a name, however many Pokemon, a Team of those Pokemon (the 6, or less or more), a collection of items, an amount of money, etc.

Battle

Okay, this is the most complicated structure. And it's the biggest range of complexity, as I've burnt myself out trying to parody every single battle feature in the canonical games, and had a blast making minimalist battles. I'm not going to get too deep into it now, because there are hundreds of different aspects, and I don't think I can cover all of them but will link to brilliant game analyzers who have the in-depth details. Did you know that in the canonical games, if you use the move Defense Curl before doing Roll-Out, it will double the power? But, this effect doesn't carry when you use Baton-Pass? Or that if you use Dig, you gain the state of "Semi-invulnerability", where it can't be hit by moves like Fire-Punch or Tackle, but still can't dodge Swift or Bide in Generation 1 but won't be hit by them after Generation 2? But if the attacker used Lock-On or Mind Reader, they can be hit on the next turn, even if they're underground, unless it's Sandstorm or Hail's recurring damage But if they're hit by Earthquake or Magnitude, they will be hit with twice as much damage? But Confusion or Paralysis affects the user that turn, Dig will be disrupted? See what I mean? Complex. But remember! We won't be making it that complex. I'll leave it to you, the programmer of this game to determine how deep you get. Please let me know how it goes because I haven't implemented a fully canonical battle mechanic that uses every in-game effect yet.

Okay! I think that's it! Let's move on to actually coding some of this out! We can learn and explore as we write code together. I'm going to start by making a CLI App in Node.js with Typescript. No Database, REST API - just JSON files, some logic, and the least amount of dependencies and complexities we can get away with. Then, I'll introduce our first Side Quests that involve caching, using a CLI library to spice up our interface, and more!

The code we build in this next chapter will follow us throughout the whole project of Main Quests. If you build an app with the right modularity, it should be able to plug into a CLI, REST API, Monolith, Microservice, or whatever existing or future tech we come up with.

Last updated