Welcome to Part Seven of our Developer Tools tutorial for Dying Light. This time we’ll show you how to add AI characters that will react to the player and move around the map. Let’s start with the NavMesh, which is crucial for every AI. The NavMesh is the multicolored area with white borders which the AI can move around in and react to as designed. If you want to check the NavMesh of your AI, open the NavMesh window from the toolbar, as seen here. In the new window, click ‘Load’ to display the NavMesh. All changes in the AI’s walkable terrain like adding an objects into the map, require recalculation of the NavMesh. So let’s try it out and change something in AI’s navigateable terrain. Now you need to recalculate the NavMesh.
You can do it by clicking the ‘Build & Save’ button. After recalculating, display the new NavMesh by choosing ‘Load’ button again. Conveniently, you can ensure the NavMesh will be up to date each time you want to play the map by enabling that option in the ‘Build and Save All’ window. To do so, first click the wall icon and open the window. In the NavMesh section, make sure the ‘Build’ box is checked and confirm by clicking ‘Start’. From now on the NavMesh will be automatically recalculated when you press ‘Play’ on the toolbar. Ok, so we don’t need the NavMesh anymore. Let’s hide it by clicking ‘Unload’. Now we can move on to spawners, that is places where our AI enemies will show up. Remember to place spawners within the NavMesh. Otherwise the AI may behave in unpredictable and incorrect ways. There’re two main types of spawners in the editor.
The first type is for spawning individual enemies or their smaller groups, while the other spawns large groups of Biters. Let’s start with the first type. Open the ‘Assets’ window, go to section ‘Object types’, and find a spawner. When you have it, place it on the map. The spawner, like any object on the map, has its attributes. To view or change them, open the ‘Attributes’ window with the toolbar icon or with a double-click on the spawner. In the new window under the ‘Fields’ tab you can for example: Choose the type of AI that spawns, for example Biters, Toads, Virals.
You can set the beahavior such as making enemies attack you immediately after spawning. You can also determine how the AI moves outside its spawner area. Or you can determine how many AI enemies are spawned in the spawner. The other spawner type is called the Crowd Spawner. Let’s put it on the map right now. The Crowd Spawner allows you to mark out a specific area for spawning a group of Biters in one go. Spawners can be scaled which changes the area available to all respective AI. Among many attributes of the Crowd Spawner, you can change things like: Setting the difficulty of the spawner meaning the number of zombies that fill up that space. You can adjust the density of the crowd also. So let’s see how our AI works in action. And that concludes this episode of our guide. Thanks you for watching and have fun spawning hordes of zombies.
As found on Youtube