The Various Types Of Types Of Types

Jun
22

The Various Types Of Types Of Types

Spread the love

If you were to look at my code base, one of the most common words you would see is “Type”. Everything is a type, and many things are many combinations of types. For example, a monster is a type, and so is a Grrbl. However there are many sub-type difference between two distinct monsters and two distinct Grrbls.

Ready for orders!

So on the surface level we have the base class type: Grrbl or Monster (there are many others for this game, but you get the idea). Then there is the race type for Monsters: Orc, Zombie, Skeleton etc. Then there is the class type: Warrior, Occultist etc. And then there is their gear types: Maces, Clubs, Toiletries etc. (yes we have some interesting weaponry in Grrbls). And then there is the specific type of a sub type e.g. the specific type of the sword.

It can be easy to get lost in how many types there are but I have found by design my code to mirror real life logic, it makes things usefully simple. If I design it right, everything has logical type properties such that I can explain to anyone in plain English what is going on. Let’s take a Grrbl Pilot wearing his pilot hat and pilot gear and describe him in English:

Base Type: Unit (this is a unit object, as opposed to say it being a treasure or something else)

Base Unit Type: Grrbl

Base Class Type: Pilot

Base Armor Type: Pilot Armor

Actual Armor Type: Brown Pilot Vest

Base Helmet Type: Pilot Helmet

Actual Helmet Type: Brown Pilot Hat

I have found that breaking things down into their logical parts makes keeping things organized a lot easier. If you happen to be a programmer, this might sound a lot like OOP (object-oriented-programming) and you are correct. What I like about looking at things according to types though, is that instead of treating things as objects (which can get messy) by thing in terms of types and types of types, it’s made coding things a lot easier for me to handle as I scale.

Here’s a snapshot of a list of classes I have which all have sub types within them. This will grow a lot more over time of course, but here’s what’s there right now:

Got questions? ASK!

Are you working on a game or an application? What are some types in your project?

About Anthony

I'm the guy making Grrbls.

Leave a comment

Pixlyst News