Jay Gould

Senior Engineer at Haven

Pokemon Battle

A TypeScript based re-make of the classic Game Boy Pokemon game battle system.

The Pokemon battle system was another project I had a huge urge to get stuck in to when I realised how possible and fun it would be to create with a little spare time. I used this as an opportunity to get in deep with WebSockets and serverless back end development.

The system focusses only on the Pokemon battle system where a user lands on the site and is presented with a unique URL which they send to a friend, who then joins on the URL, setting up a battle between the two users. The data is stored in a free, hosted Postgres database from ElephantSQL which is interfaced with using the raw pg node package.

Pokemon battle screenshot

The users select a pokemon each which enters them in to battle. They attack each other in a turn based system, just like the original game, reducing each others HP until a player is left standing and wins. The game even saves each battle and awards XP which is accumulated and used to level up a users Pokemon for future battles.

I chose a really basic setup as I wanted to focus not to be on big, elaborate back end setup (like I did with Cinepicks), but instead focus on the intricacies of the front end WebSockets implementation. The app uses WebSockets for almost every user action, from sending/receiving the battle invite, so each player move and attack in the game.

There were many challenges involved when making this game, most of which I hadn’t foreseen until I was quite far in to development, but it was fun figuring out solutions along the way. These ranged from finding original imagery of characters and stats on how many attack and hit points each character has, to managing serverless connected databases and WebSockets without a back end to reliably use.

More details can be found here in a previous blog post.

© Jay Gould 2023, Built with love and tequila.