Pokenergy Radar Refactoring, animated Pokimon

Added animated pokemon in AR mode, as well as your own Pokemon.

 

My prototype so far consisted on a single scary monolithic 762 lines 25KB JavaScript file. Since I plan to use it for a couple of interesting projects in the future, and there are some parts of it which I’m not certain are behaving correctly, the first step was organising it into something easier to handle.

It was no simple task, but in the end I managed to do a successful first round of refactoring, dividing it into 13 modules.

screen-shot-2016-10-23-at-1-33-01-am

My process was to start distributing the methods from the big class into smaller classes with a single responsibility, then seeing what modules these classes ended up depending with and in case it made sense, add them as a dependency wired at initialisation. Running Cordova in the browser sped up debugging a whole lot.

My main motivation for doing this refactor was being able to implement unit tests into the separate components to make sure they are working ok. Since there are many things going on at the same time, it’s not easy to be sure which one are failing in the equation to provide the player with an adequate experience.

So far the project evolves in two directions: The first one will be completing this Pokemon concept; I’ll be using a simplified battle system instead of the full rules (won’t even be implementing the full Gen 1 rules), but you’ll still be able to take advantage of the different moves they have including the type bonuses and resistances.

The second one will be my own location based monster training game. More info about that one soon 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s