L4D2 Дизайн уровня/Запросы директора

Материал из Valve Developer Community
Перейти к: навигация, поиск
English (en)Русский (ru)中文 (zh)
Править

logic_director_query это новый объект, специфичный для L4D2, который при срабатывании возвращает значение, соответствующее тому, насколько 'сердит' A.I. Директор в этот момент.Чем лучше игроки выживают, тем злее будет директор, и тем более агрессивно игра будет в спавне инфицированных.

Вы можете воспользоваться этим, чтобы ваши карты стали более динамичными и отвечали требованиям уровня игрока. Простым примером может быть создание нескольких путей через область различной длины / сложности, а затем использование запроса Director для открытия и закрытия соответствующих путей. В режиме versus система автоматически повторяет решение, когда команды меняются, что обеспечивает равномерный игровой контекст.

Вызов запроса

Давайте посмотрим, как это работает.

A solid to trigger the query.

Директор постоянно обновляет свое внутреннее состояние, но для целей редактирования карт вы должны явно запросить его с помощью какого-либо триггера. Запрос дает нам значения гнев Директора и позволяет нашей игровой логике правильно реагировать.

В этом примере давайте отменим запрос, как только выжившие достигнут определенной точки на карте. Идите вперед и поставьте триггерный объем в коридоре.Запросить директора так близко к самому началу первой карты не всегда полезно, так как оставшиеся в живых будут в полном здравии, и директор всегда будет самым злым. Но для учебных целей это будет сделано.

Поместите твердое тело, затем выберите его и выберите Tools > Tie to entity в строке меню. Измените класс сущности на "trigger_once" и присвойте ему материал "tools/toolstrigger"

Filter what can activate the trigger.

Мы хотим, чтобы этот триггер реагировал только для оставшихся в живых, поэтому нам нужно отфильтровать его выход. Для этого давайте разместим новый объект класса "filter_activator_team" и назовите его "filter_survivor".

Выберите уровень триггера и свойства, установите его имя фильтра на "filter_survivor". Теперь триггер будет активироватся только выжившими, а не зараженными.

A new info_director_query is born.

Затем, давайте переместимся по другому концу коридора к лестнице, ведущей в безопасную комнату. Поместите новый объект класса "logic_director_query". Для имени используйте "director_query_zombie".

В разделе Properties установите значение Min. Anger Range до 0 и Max Anger Range до 9. Директор сам отслеживает гнев между 0 и 50, но для наших целей мы хотим разделить его на 10 случаев. Эти настройки переназначают значения, возвращаемые запросом Director, в шкалу от 0 до 10.

Noise директора - очень важная часть геймплея. Немного непредсказуемости необходимо что бы держать игроков в напряжений. Для учебных целей, давайте установим Noise на "Pure". Это отключает случайность в системе гнева. Обычно вы не захотите этого делать, поскольку он устраняет элемент процедурного сюрприза, делая игровой процесс скучным и предсказуемым.

Firing the query.

Идем дальше и выбираем уровень триггера в начале карты и добавляем вывод "OnStartTouch", который будет нацелен на "director_query_zombie" с вводом "HowAngry".

Нажмите F9, чтобы запустить карту. Как только он загрузится, выйдите в коридор, чтобы вызвать гнев, а затем сразу же поднимите консоль. Запрос директора будет выглядеть примерно так:

TRUE Anger: 50.00  Processed Anger:  50  Out Anger:   9

Таким образом, наш запрос теперь атаковать игроков. Во время работы над нашей картой нам нужно будет установить sv_cheats в 1, что позволит нам вручную вызвать запрос Director с консоли. Для нас это будет выглядеть:

ent_fire director_query_zombie howangry

Реагирование на запрос

It's raining Zombies.

Теперь, когда у нас есть информация от Директора, нам нужно что-то сделать с ней, и как правило это будет своего рода изменением в мире. Давайте запустим зараженного, но его тип будет зависеть от гнева.

Поместите новый объект класса commentary_zombie_spawner прямо над director_query.

Case properties

Затем давайте создадим новый объект logic_case с именем "zombie_case" и поместим значения свойств для каждого из условий, на которые мы хотим ответить. В этом примере мы установили его, чтобы иметь возможность реагировать на 10 различных условий.

Case outputs

Как только Properties настроены, мы переходим к Outputs и сигнализируем спавнеру зомби делать разные вещи в зависимости от случая.

Теперь вернитесь к объекту logic_query_director и перейдите к Outputs. Выберите OutAnger как ваш выход, "zombie_case" в качестве вашей цели и InValue в качестве вашего ввода. Это скажет вашему logic_query_director отправить точное значение его переназначенных значений гнева в logic_case. logic_case примет этот номер и будет соответствовать ему в случаях, которые вы установили.

Если случай не соответствует свойству, он ничего не сделает. Итак, в этом примере, если гнев Директора равен 5 или ниже, он ничего не сделает.

Выше 6, случай сигнализирует, что спавнер породит волну зомби, либо boomer, либо charger, либо tank, в зависимости от уровня гнева.

Другие виды использования

Когда вы разрабатываете свои карты, вы захотите тщательно настроить свою логику карты, чтобы каждый сценарий, отвечающий режиму, был 'FUN FOR PLAYERS'. Если ваша установка слишком предсказуема, игроки смогут ее предвидеть, и это не весело. Если это так случайно, что неясно, насколько хорошо они делают, есть некоторая корреляция с тем, что происходит, тогда у них не будет мотивации делать то, что вы просите их делать.

Сколько случайности вы должны использовать? От чего это зависит. Зона развлечений отличается для каждого сценария, и достижение этого редко происходит прямо. Рекомендуется, чтобы вы планировали несколько итераций наблюдения игроков, улучшая поведение, наблюдая снова.

Вот пример, который может оказаться полезным при разработке и отладке ваших карт:

Откройте файл:

sdk_content\mapsrc\Your_First_L4D_Level_Tutorial\tutorial07_complete.vmf
Anger Debugging

Здесь у нас есть логический таймер, с помощью которого info_query запускает запрос через регулярные промежутки времени. logic_case оценивает гнев и включает соответствующий номер func_brush. Это дает численное считывание значения гнева непосредственно игрокам на основе запроса Директора.

Конечно, вместо цифр вы можете делать более тонкие вещи. Люди часто предполагают, что корреляция равна причинности. Вы можете использовать это в своих интересах для развлечений и острых ощущений.(И, в конце концов, возможно, даже прибыль.)

Вот еще один пример, который вы должны проверить:

sdk_content/Deadline2/mapsrc/l4d_deadline01.vmf

Первая карта кампании с добавочным примером Deadline2 использует это, чтобы выбирать альтернативные пути, один короткий и прямой, один менее прямой и перекрученный.Существует также спавнер, который может размещаться на пути к выжившим, в зависимости от гнева, boomer или witch, ни один из перечисленных не имеет хорошего отношения к ограниченному пространству.



logic_director_query is a new L4D2-specific entity that, when triggered, returns a value that corresponds with how "angry" the A.I. Director is at that moment. The better survivors are doing, the angrier the Director will be, and the more aggressive the game will be in spawning infected.

You can take advantage of this to make your maps more dynamic and responsive to player skill level. A simple example would be to create multiple paths through an area of varying length/difficulty, then using a Director query to open and close the appropriate paths. In versus, the system will automatically repeat the decision when teams swap, thus providing for an even playing context.

Firing a query

Let's look at how this works.

A solid to trigger the query.

The Director is constantly updating its state internally, but for map-editing purposes, you must explicitly query it with some kind of trigger. The query gives us a snapshot of the Director's anger value and allows our game logic setup to respond accordingly.

For this example, let's fire off the query once the survivors reach a certain point in the map. Go ahead and place a trigger volume in the hallway. Querying the Director so close to the very beginning of a first map is not always useful, since survivors will be at full health and the Director will always be at its most angry. But for learning purposes, this will do.

Place a solid, then select it and choose Tools > Tie to entity from the menu bar. Change the entity class to "trigger_once" and assign it the material "tools/toolstrigger"

Filter what can activate the trigger.

We'll want this trigger to happen for survivors only, so we'll need to filter its output. To do so, let's place a new entity of class "filter_activator_team" and name it "filter_survivor".

Select the trigger volume and under properties, set its filter name to "filter_survivor" The trigger will now only be activated by survivors, and not by infected.
A new info_director_query is born.

Next, let's move down the other end of the hallway to the ladder leading up to the safe room. Place a new entity of class "logic_director_query". For a name, use "director_query_zombie".

Under Properties, set the Min. Anger Range to 0, and the Max Anger Range to 9. The Director itself keeps track of anger between 0 and 50, but for our purposes we will want to divide it into 10 cases. These settings remap the values that the Director query reports back to a scale between 0 and 10.

Noise in the anger value is a very important part of gameplay. A little bit of unpredictability is necessary to keep players on their toes. For tutorial purposes, let's set Noise to "Pure". This effectively turns off the built-in in randomness in the anger system. You typically will not want to do this, as it removes the element of procedural surprise, making gameplay boring and predictable.

Firing the query.

Go ahead and select the trigger volume at the start of the map and add an output "OnStartTouch" which will target "director_query_zombie" with an input of "HowAngry".

Hit F9 to run the map. Once it loads, step into the hallway to trigger the volume and then immediately bring up the console. The Director query will have spit out something like the following:

TRUE Anger: 50.00  Processed Anger:  50  Out Anger:   9

So your query is now firing for players. While working on your map, you will want to set sv_cheats to 1, thus allowing you to manually trigger the Director query from the console. For us that would be:

ent_fire director_query_zombie howangry

Reacting to the query

It's raining Zombies.

Now that we can have information about the Director, we need to do something with it, and that will typically be some kind of change in the world. Let's spawn an infected, but have the type vary depending on the anger.

Place a new entity of class commentary_zombie_spawner just above the director_query.
Case properties

Next, let's create a new logic_case entity named "zombie_case" and put in property values for each of the conditions we want to respond to. In this example, we've set it up to be able to respond to 10 different conditions.

Case outputs

Once the Properties are set up, we move on to the Outputs and signal the zombie spawner to do different things depending on the case.

Now, go back to your logic_query_director entity and go to Outputs there. Choose OutAnger as your output, "zombie_case" as your target, and InValue as your input. This will tell your logic_query_director to send the exact value of its remapped anger values to the logic_case. The logic_case will take this number and will correspond it to the cases you have set up.

If the case doesn't match the property, it won't do anything. So in this example, if the Director anger is 5 or below, it won't do anything.

Above 6, the case signals the spawner to force spawn a zombie, which will be either a common infected, a boomer, a charger, or a tank, depending on what the anger level was.

Other uses

When you're developing your maps, you'll want to carefully tune your map logic so that each Director-responsive scenario is FUN FOR PLAYERS. If your setup is too predictable, players will be able to anticipate it, and that's not fun. If it's so random that it's not clear that how well they are doing has some correlation with what happens, then they will not be motivated to do what you're asking them to do.

How much randomness should you use? It depends. The fun zone is different for each scenario, and achieving it seldom happens straight off. It is recommended that you plan for several iterations of observing players, tweaking the behavior, observing again.

Here's an example that you may find useful in developing and debugging your maps:

Open the file:

sdk_content\mapsrc\Your_First_L4D_Level_Tutorial\tutorial07_complete.vmf
Anger Debugging

Here we have a logic timer that has the info_query fire off a query at regular intervals. The logic_case evaluates the anger and enables the appropriate func_brush number. This gives a numerical readout of the anger value directly to players based on the Director query.

Of course, instead of numbers, you can do more subtle things. People often assume that correlation equals causality. You can use this to your advantage for entertainment and thrills. (And eventually perhaps even profit.)

Here's another example you should check out:

sdk_content/Deadline2/mapsrc/l4d_deadline01.vmf

The first map of Deadline2 example add-on campaign uses this to select alternate paths, one short and direct, one less direct and kinked. There is also a spawner that may place in the survivors path, depending on anger, a boomer or a witch, neither of which is good to have in a tight constrained space.