Tuesday 26 September 2023

Landing objects

The project management system was a great idea, one of the best ideas I've had for ages. It's easy to open the project file and check out what modules need fixing and what is the problem in that module.

Lately I've been working on how objects interact with the environment. If you only had a floor it would be easy, but I made it much more difficult with different types of terrain the object can sink or fall into. In this problem I've had success with good old functions (or procedures which they are in C++ I guess.) For some strange reasons it's easier to detach actions from classes and make them into one monolithic function, something like land_object() which is checking what happens if the object falls on ground (terrain), which can happen in several different situations.

If the object doesn't drown it's added into a list of "floaters" and processed per turn until it drowns or something else happens. It's kind of unsafe routine probably going to fail some way, but I have no idea how to implement that better way. What gets me is how I have not thought about object landing before? I'm reading the code and finding several unfinished routines for dropping items on water, but that's it. As usual I didn't follow through it. Now it feels like I'm implementing it the first time.