Thursday, July 2, 2015

Waypoint Handling

Took some time today to work on something that I had been putting off for awhile. Previously, our waypoint handling system was uh... how should I say it... janky? Is that a word? To elaborate, each waypoint was essentially treated just as a separate transform and that was it really. There was no additional logic in the waypoints themselves and they were pretty much just positions at that point to be followed and switched to by the WaypointHandler logic.

This meant that, even if we wanted to do something simple, like perhaps add an optional delay before starting towards the next waypoint, it had to be done on a global basis. Rather, each waypoint belonging to a handler used the exact same delay. With the new system, we can do a lot of different things that we were previously unable to do:

-Each waypoint can have its own delay (Character walks to the edge of an overlook and takes a minute to admire the view before continuing along his way)

-Each waypoint can set an animator bool/trigger (basically allows you to play an animation at the end of a given waypoint and the character will not advance to the next waypoint until it has completed. Imagine you have a bartender who is walking around (actually, drunk herself), and you would like that bartender to pour drinks when she gets to a table of belligerent high-school-aged males on Spring Break (Was that a doubly nested parenthesis??) )

-Each waypoint can change the speed of the character when the waypoint is passed over. (See subsequent example)

-Each waypoint can call a specified method when the waypoint is passed over. (Imagine that you have a little shitty kid running to the end of a path, but he gets tuckered out because he's asthmatic, and there aren't any inhalers in Onich, nor are there really asthma diagnoses, but nevertheless, this kid feels like he is onto something and sets out to tell the world about his breathing woes. Anyhow, we can force him to walk back when he passes over the transition, by calling a custom function AND setting his speed to something lower. Not a contrived example at all, really. Happens all the time.)

There is more we can do on this front, such as using splines/curves to smooth out the turning rates of characters, but for now, it works quite nicely. The only downside now, is that all of the Cephaline NPCs need to be changed. :/

There isn't really much more to say about the world map at this point, which is the unfortunate part of working on assets. I will say that it is looking better than it did yesterday (which, if you recall, it looked pretty awesome). Here is to hoping that it looks even better tomorrow.


No comments: