AI Navigation into games is complex problem if you want it to be done right and realistic. Like for the AI system mentionned in he previous post, despite i tend to “revinvent the wheel”, i tried to make an effort by using public tools. Unfortunately, i had to write my own, and this it the story i’ll tell you now :
In an old school Dungeon Crawler, you can avoid writting a complexe AI navigation system : the square based architecture make everything easy to handle, and most games of this style process that way. But that’s the other games. For The Dungeon Kingdom, the AI has to be smart, and the navigation system efficient ! Ah..and i forgot to mention, everything need to be dynamic ! I did check the available tools & plugins for Unity, but most are simple A* system using a static graph or build by hand into the tool, wich is the opposite of what i needed for The Dungeon Kingdom…! So instead of spending ages seeking for the pearl, i wrote one !
So i created a bunch of scripts to automatically generating the navigation graph at runtime. In The Dungeon Kingdom, the game is building the navigation graph when playing.
One feature i added is a crowd factor to the waypoints, so the creatures, depending their size, can push the pathfinder to temporaly disable the waypoint from the graph for the others navigating agents.
Another feature: the graph has informations about locomotion type and state of the links : for example some of waypoint can require a monster to be a fly type of creature to reach it. About states, some access can be dynamically disabled, or like when you open a door (wich is automatially detected by the dynamic navigation graph building) an access to a waypoint can be restored / added. Same for pit. Actually, there’s no difference between a door or a pit for the pathfinder, it uses the same flexible system.
Note that despite the “Case by Case” system, and square based arthictecture “ala Dungeon Master”, in The Dungeon Kingdom the navigation system is totally universal and would work for any kind of environment. There’s no “Square” design limitation : the waypoints can be linked to any amounts neighbors, and those waypoints can follow any typology. And to finish, the waypoints links states are bi-directionals. Let’s see on the screen shot why it’s important :
The wire lines are drawn by the debug mode inside the tool, it shows the generated navigation graph. The blues lines are waypoints, green are opened links to any locomotion type. Yellow lines are links opened to flyers only (here because the pit is closed). Red is closed link.
Next time we’ll talk a bit about render optimizations and graphics options, or we may post a new in game video… So keep an eye on the website.