Spellcaster Studios

Make it happen…

Playthrough, Part XI

Today I advanced the story a bit more… And would have done much more, if I didn’t hit a silly bug that took me about one hour to figure out, and less than one second to fix…

Actually, today was a terrible day for the pathfinding…

First, in the pirate lair, I had spawned too many objects in one room, and because of that, the pathfinder couldn’t find a route to the target location on the cutscene… After I fixed the prop generator, I got another issue… One of the props was very big, which meant there wasn’t a lot of room to pass. Shouldn’t be a problem to the pathfinder, but I have a small issue with it. The pathfinder generates nav points, and my movement algorithm (the same for the AI and for the player) uses a movement vector approach (at any moment, there is a force applied to the object, and there it has a velocity). The problem is that the pathfinder assumes perfect start/stop times, which means that if you have a certain amount of inertia when on a path, you overshoot it slightly… This usually isn’t an issue, but on occasion (when the path is very thin) it causes the collision detection to step in and stop the object from moving, and that causes more deviations from the path, and the movement system was programmed to reach target points (waypoints), not the path itself, which causes an impossible situation!

screen176

This one I solved by disabling the collision detection while following a path, but I’ll probably have to review this solution, it looks sloppy and can lead to other problems. I probably will have to build in code that detects that the player is unable to move to the target destination and either recomputes the path (probably enough), or that tries to get the closest point on the path before start following it again…

After that one was sorted, I finished the cutscene and moved on to the next, and found another bug… This one was probably present for ages, but I didn’t notice it until now: there was a room on the Skydancer that the navmesh couldn’t reach… For normal play, it’s not important, but on a cutscene when I want to go into the room it’s quite serious, since the pathfinder can’t find a path… But it took me some time to realize this was the issue… What I was seeing was a that the pathfinder was trying to reach a room by going to the wall… And what he was doing was getting as close as possible to the target location, and I automatically add the end point to the pathfinding solution, which caused him to go through the wall… Very silly, really! To fix, I just had to detect there was no path possible and open the door a bit more to allow for the navigation mesh builder to build a bridge there…

So, onwards!

Now listening to “Pristine in Bondage” by “Amaran”

Link of the Day: One excellent reason to have kids: a good reason to build one of these: http://www.neatorama.com/2014/07/21/Awesome-Father-Builds-BattleTech-Treehouse-for-His-Kids/

Comment