Gyuri about the pathfinding in The Incredible Adventures of Van Helsing and about Megan Fox in his own life.. Video!
"After creating the battle system in King Arthur 2, including the pathfinding and animation controls, I hit the jackpot and I’m doing the same in The Incredible Adventures of Van Helsing. =) Now I'm going to let you in some secrets of the pathfinding system in The Incredible Adventures of Van Helsing.
The pathfinding in KA2 and VH are completely different. In KA2 I had to use mass simulation. The soldiers didn't use any individual pathfinding, because it was impossible (as you might remember, there were thousands of them). But fortunately it wasn't necessary, because they didn't have to go to any exact positions, they had only guidelines. They didn't follow the player’s instructions individually, they just followed their units, as I've already told you in my previous developer diary post.
In VH only a few hundred creatures try to move at once, but they all have individual destinations, so it is both possible and necessary for them to use individual pathfinding. My additional instruction was that creatures with the same objective had to surround their target quickly, so soldiers had to avoid each other. The gameplay had to be smooth, while at the same time the creatures had to find their way even to very distant points on the map – and this really gave me a headache, because the game couldn’t lag.
So the list of instructions goes like this:
- the creatures have exact targets; they have to reach it – and fast – using the shortest possible way
- the creatures should avoid each other (unless it slows down the game)
- the creatures have to be able to find distant targets (and the hero must do it very quickly, “without hesitation”)
- gamepad controls
- …and we shouldn’t forget my favorite guideline of all times: it must look fabulous! =)
I went straight for my bag of tricks to solve the tasks above, and I succeeded. In case you wondered the most useful trick for this occasion is called multilevel pathfinding! Which basically means that on the first level the creatures try to avoid obstacles by following an ancient and secret formula =). They only calculate a pathway to a temporary target at one time, which hopefully leads them closer to their targets.
Unfortunately we can’t grant multilevel pathfinding to a few hundred all creatures at the same time – we would need a power plant! Which basically sucks, because all creatures should be able to find pathways to distant targets. Fortunately this isn't a big deal: we only grant multilevel pathfinding to a few chosen creatures at the same time, while the others are restricted to the second level. We constantly rotate the lucky ones, so no one could monopolize the opportunity. With this solution I reached the given goal, namely that all creatures will find their way to any reachable destination sooner or later and without reducing the FPS significantly.
To keep the game rapid and smooth, I had to come up with a couple of other tricks as well:
- Moving creatures are not treated as obstacles by the pathfinding, but when a creature collides with another, he gets a new temporary destination to avoid the other one.
- Immobile creatures are treated as obstacles only if they are near: creatures far away can move away by the time our creature reaches them. If they don’t, the pathfinding module will calculate their whereabouts
- Only a few creatures can try pathfinding at the same time. The player won’t even notice those few milliseconds while the AI hesitates, so a little randomization of the time between refreshing the path of the AI's creatures works properly.
Just to mention:
- While the creatures use pathfindings to avoid the obstacles and each other, they push each other with small radius, and the obstacles push them out as well ( collision system ).
- The hero control with gamepad is simple. Without pathfinding method, the hero moves straight to the target, and we entrust everything to the collision system.
That's all for today! Remember that Giggs is still the Top Dog, and Megan Fox, I know that you are reading this, so I LOVE YOU! And the most important thing: Don't shout!!!"



