Hello everyone, I hope you all had a great holiday and happy new year! You may have noticed that I disappeared yet again! But I have some exciting news: I am officially employed as a Front-End Developer and am in the process of moving into my new apartment! I’ll be working in a new gaming startup to help build a fun new kind of game that will be released on mobile! So far the monetization techniques we’re using don’t get in the way of gameplay, so that’s great! The team is very small, consisting of roughly 8 people including me, so I’m sure it will be a very nice experience.
Onto Streets of Peril: I have been doing A LOT of refactoring to the game engine, and I finally have a very flexible base class for all objects that appear in levels. I have already properly converted Item Containers, Weapons, and Items to inherit from it, so I’m making progress slowly but surely. This new base class was inspired by the Unity engine’s GameObject class.
One of the biggest changes was separating the movement planes. Previously, a Move() method would handle movements in the X and Z direction, THEN handle height in the Y direction immediately afterwards. This forced me to always call Move() even if the object wasn’t moving in the X or Z directions to prevent it from being stuck in the air. With the new base class, the ObjectMove() method only handles movements in the X and Z directions and a method called ObjectFall() handles height in the Y direction and is called after the object performs its specific logic. This allows all objects to be affected by gravity in the same way, and I don’t have to write a single line of code to have this behavior present in a derived object.
Next, the base class implements most things far more efficiently! For example, I no longer check through every single solid object in the level each frame to determine if an object is grounded. Instead, I have a reference to the solid object the object landed on; I check if the object is still on it, and if not set the reference to null. If the object isn’t on a solid, the reference is null, which tells me object can’t be on a solid and allows me to simply check if the object’s height is the same as the tile it’s on.
Lastly, there’s SO much more flexibility thanks to this base class! By simply modifying values or calling methods, I can modify object behaviors and disable an object’s gravity, make it immune to Status Effects, stop it from Updating or Drawing, enable/disable collisions with walls, solid objects, or camera boundaries, and SO much more! It took a long time to write it, and I’m extremely satisfied with the results to say the least.
I could talk all day about the new base class; I’m just happy I finally have a solid foundation for my world objects. The knowledge I gained from writing it will also greatly help me with my new career since I’m one of the developers. I’m not exactly sure how much time I’ll be able to dedicate to Streets of Peril once I start my job, but I will definitely work on it as much as I can.
Until next time!