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

This issue with collision not working as expected is frustrating, but at least I can work on the game logic and get a success condition etc. I suspect the collision problem is due to mistakes that appear when I multiply the various matrices I have for the object’s positions together. While having everything as 4*4 matrix (including things as simple as player position, which should just be a simple vector) made for faster code writing (no need to bother with converting the data etc). It also means that the memory footprint is higher, and there are more risks for issues such as what we see in that second video. I hope I get back to it later, and simplify all this code, but that is not a trivial task…


See also