Reworking object math for big results

After applying the clang-format and beautifying the code yesterday, I couldn’t resist so I ended up reworking the way I store basic 3D object parameters and how they are used to calculate everything. The main point was that I originally used matrices everywhere to avoid having to deal with casting values or overthinking how to optimise for memory/usage. However, it was inefficient and made things harder to debug. This was an issue as I wanted to figure out how to solve the incorrect collision I was seeing when various projectiles where going through their targets instead of destroying them.

Therefore, I replaced these global 4X4 matrices used all over the place with translation vectors and rotation matrix (3X3). I was rewarded quite nicely for it because, after changing the type of values for the translation component of the base spatial object class, collision handling started working as expected!

Animated gif showing a full gameplay loop and accurate collision handling - You don't get hit when you shouldn't anymore!

Redesigning the way we store position solved collision problems

This game is now fair! No more getting hit when you shouldn't!

Time spent for this Time spent so far
6 h 101 h

Projectile and early game logic

Finally working on game logic, with objects interacting together!

Projectiles, just like the other objects in the engine, do not need to be created/destroyed in memory every time we want to use them. Rather they get enabled/disabled, to save execution performance. Additionally, I created a health and a life-time component which when attached to an object become responsible to handle their disabling. Based either on receiving collision messages (you have been hit, so your life is diminishing) or a specific duration (it’s been X seconds, so you disappear).

Time spent for this Time spent so far
4 h 45 h
[Read More]

Adding movements, getting first bugs

Now I can start working on the engine itself!

Animated gif showing moving player vehicle and spawned enemies - Movement, no camera tracking, broken mini map

Added support for player vehicle movement and "enemy" models, but cameras don't follow and minimap camera is now broken

One step forward, two steps backwards...

It does feel good to start seeing stuff move around. The broken rendering on the minimap is strange but I haven’t looked at it yet, so probably nothing to be worried about?

Time spent for this Time spent so far
5 h 25 h