After a much enjoyed weekend of walking and dragging large trees off the beach (for later burning) I have returned to the cupboard I laughingly call an office to continue my daily developer slog.
So what has taken almost every minute from 9AM to 6:30PM (with no dinner)? Well it was a single item on my task list, entitled "- Stop enemies entering water". Sounds pretty simple right, add a line of code statement to the tune of "STOP THEM GOING IN WATER" and presto, done, right?
Well....not exactly. I had to write a prototype to scan the height field, produce a series of black and white squares which denotes those areas under water, then run an image scan which detects the boundaries of these shapes, then wipe them out and replace them with a polygon representation of those shapes, then create a DarkAI obstacle based on that data, and finally integrate it through the main engine so the characters understand which areas on the terrain are 'no go' areas.
As you can see in the shot above, the system can accurately create a contour around a feature of the terrain. I can eventually extend this feature to exclude high hills which characters should be allowed to ascent (i.e. near vertical cliff walls). For all my efforts however, when I ran the engine the character just ran straight through my obstacle, and I could not help notice the contour was every so slightly IN the water which means my characters might be taking a dip after all.
In coding it, I have also identified that the system needs to deal with islands inside the water pools, which are like exclusion zones within a DarkAI obstacle polygon, so that's either more polygon math for me or a small task for someone else ;)
Such is development, we build our structures, and soon realize that it's sinking into the swamp. I think a little structural support is required to make sure this feature makes it into the BETA as I rather like the idea that the enemies go AROUND the river, instead of through it!
Managed to cram in 2 miles of walking in place of dinner. I confess to eating a piece of toast if that counts as dinner. Meeting day tommorow which attempts to review our current position, and identify any critical urgent items that absolutely must make the BETA. The good news is that most of the items we announced will be in, which gives me a nice warm feeling inside.