Расширенная настройка ИИ

Материал из CryWiki Russia

Перейти к: навигация, поиск

Содержание

Intro

Despite CryENGINE 2's overwhelming graphics capabilities, eye candy does not a level make; as much as Crysis was about being a graphical technical demonstration, it is still remembered for its linear yet strongly choice-orientated gameplay. This tutorial, targeted at any level designers using Sandbox 2, aims to provide more information on the set up of the AI included in the game; specifically, making sure your AI setup is extensible and will survive the many design iterations that your level will inevitably undergo. This tutorial assumes you have rudimentary knowledge of certain level design principles such as triggers and flowgraph scripting.

Using the Entity:BroadcastEvent node to your advantage

Entity:BroadcastEvent is an iterative flowgraph node that is capable of selecting a multitude of entities (on the basis of their names containing a certain string) and then performing an entity event. How does this aid in level design? Instead of manually adding all entities to a given flowgraph for whatever purpose, you can simply set up all your entities with certain names (which you should be doing anyway for organisation's sake!) and then execute one flowgraph node. This means that if you decide to, say, change the amount of enemies in the future, you can simply add them with certain names and not worry about rescripting them. Let’s look at an example of this now in a real level design scenario.

Spawning AI

For the purposes of this tutorial we are only going to apply the effect to two alien troopers, but this will work on much larger groups of AI if necessary.

Naming Conventions

Firstly, we need to set our AI up with names that are guaranteed to be unique. I personally use a fairly long string that corresponds to the event in the level. For this particular occasion I have used CrashSiteAI as the prefix to the entity names (the actual troopers are CrashSiteAI1 and CrashSiteAI2 respectively).

Disabling on Game Start

What will happen with these AI? Well, I want to disable them until the point where the player triggers a certain event which in this instance is entering a proximity trigger. Firstly, let's take a look at the necessary setup to disable the AI on game start. The flowgraph looks like this:

EAIS DisableFG.jpg

We want to call the Disable event for the troopers. You can view a full list of entity events by either viewing the Input/Output section of the entity in the rollup bar, or by adding the entity to a flowgraph and looking at the different options available.

Enabling on Trigger Entry

Now we need to call the Enable event when the player enters the trigger. The flowgraph is made in a very similar fashion.

EAIS EnableFG.jpg

More to come in the future on extensible AI setup, I hope this has helped some people understand flexible design more and that your projects benefit at least slightly. :)

EAIS cover.jpg