Создание Flowgraph

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

(Различия между версиями)
Перейти к: навигация, поиск
Строка 6: Строка 6:
|сложность=Легко
|сложность=Легко
}}
}}
-
The next step after [[Creating a Map|creating a map]] is creating dynamic behaviour, or actions and events in the game. To do this, we can use the flowgraph tool; this is in effect a easy-to-learn simplistic but infinitely powerful scripting tool that can be used to set up all kinds of behaviours, events and actions in game.
+
Следующий шаг после [[Создание Базового Уровня|создания уровня]], это создание динамических действий и событий игры. Для этого можно использовать FlowGraph. Это легко изучаемый, однако бесконечно мощный инструмент создания спкриптов, который можно использовать для создания любых действий и событий в игре.
-
In this tutorial, in order to master some of the basics of the flowgraph, you will learn how to give a weapon to the player when the player is near to an object using the Flowgraph.
+
В этом туториале, чтобы понять некоторые из основ FlowGraph, Вы изучите, как дать оружие игроку, когда игрок находится близко к объекту, с помощью Flowgraph.
-
== Prerequisites ==
+
== Создание триггера ==
-
* [[Creating a Map|A working level]]
+
{{Step|1|Перетащите ProximityTrigger на карту.}}
-
== Creating a Trigger ==
+
Этот объект будет использоваться для запуска нашего скрипта. Чтобы создать ProximityTrigger, перейдите в RollupBar>Entity>Triggers>ProximityTrigger.
-
{{Step|1|Drop a Proximity Trigger onto the map.}}
+
-
This entity will be used to trigger our flowgraph. To spawn a ProximityTrigger, go to Rollup Bar > Create > Entity > Triggers > Proximity Trigger.
+
-
{{Step|2|Select the trigger and click the "Create" button in the Flow Graph section just below the trigger's properties.}}
+
{{Step|2|Выделите Ваш ProximityTrigger и нажмите кнопку "Create" в секции "FlowGraph", находящейся ниже свойств триггера.}}
[[Файл:Create_button.png]]
[[Файл:Create_button.png]]
-
{{Step|3|A new window will pop up asking you to name the new graph. Choose any name you can easily remember. When you're finished, click OK.}}
+
{{Step|3|Появится новое окно, требующее, чтобы Вы назвали новый скрипт. Введите любое название, которое Вы можете легко запомнить. По окончании нажмите OK.}}
After creating and naming the flowgraph, the Flow Graph Editor will pop up. You will notice that the name you gave your flowgraph is now listed below the name of your Proximity Trigger on the left-hand
After creating and naming the flowgraph, the Flow Graph Editor will pop up. You will notice that the name you gave your flowgraph is now listed below the name of your Proximity Trigger on the left-hand
side of the screen in the Flow Graphs window.
side of the screen in the Flow Graphs window.
 +
После создания FlowGraph, появится Редактор FlowGraph. Вы заметите, что имя, которое Вы дали скрипту, теперь упомянуто ниже названия Вашего ProximityTrigger на левой сторона экрана в окне FlowGraph.
[[Файл:editor_window_overview.png]]
[[Файл:editor_window_overview.png]]
-
A brief description of each window:
+
Краткое описание каждой секции окна:
-
;Components:Here you will find a list of all the available Nodes you can use in your Graphs.
+
; Components: Здесь Вы найдете список всех доступных нодов(узлов), которые Вы можете использовать в своих скриптах.
-
;Flow Graphs:Here you will find a list of all Graphs contained in your level.
+
; Flow Graphs: Здесь Вы можете увидеть список всех скриптов, содержавшихся в Вашем уровне.
-
;Entity:Here you will be able to adjust the values of the Input ports for the selected Node. You can also view the description of the selected Node, or adjust the properties of the Graph.
+
; Entity: Здесь Вы можете увидеть описание выбранного нода и значения его входных портов. Также, здесь Вы можете поменять свойства скрипта.
-
;Search:Here you can quickly search through your graphs for different criteria.
+
; Search: Здесь Вы можете быстро найти свои скрипты по различным критериям.
-
;Search Results:Here you can find the results of your searches.
+
; Search Results: Здесь Вы можете увидеть результаты своих поисков.
-
== Creating a Flowgraph Node ==
 
-
There are two ways to create a Node in your graph. By right-clicking anywhere
 
-
in the checkboard window, you can:
 
-
# Select the «Add Graph Default Entity» option to create a node that represents the graph’s default entity.
 
-
# Select the «Add Selected Entity» option to create a node that represents the currently-selected entity in the Editor.
 
 +
== Создание нода в FlowGraph ==
 +
Есть два способа создать нод. Щелкнув правой кнопкой мыши где угодно в рабочей области окне Вы можете:
 +
# Нажать "Add Graph Default Entity", для создания нода объекта, к которому прикреплён скрипт.
 +
# Нажать "Add Selected Entity", для создания нодов выделенных на карте объектов.
-
{{Step|4|With your Proximity Trigger still selected, go to the “Add Selected Entity” option.}}
 
-
[[Файл:add_selected_entity.png]]
 
 +
{{Step|4|Если Ваш ProximityTrigger выделен, нажмите "Add Selected Entity".}}
 +
[[Файл:add_selected_entity.png]]
-
A tiny black spot will appear near where you right-clicked in the checkboard window. Don’t worry, you didn’t burn a pixel out in your LCD. That is actually the Node you just created. It’s not small; you’re just zoomed out really, really far!
+
Крошечная чёрная точка появится рядом с тем местом, где Вы только что щелкали правой кнопкой мыши. Не волнуйтесь, Вы не сожгли пиксел в своем ЖК-мониторе. Это - нод, который Вы только что создали. Он не является микроскопическим; необходимо просто изменить масштаб.
-
{{Step|5|Zoom In by placing the mouse cursor on top of the black spot and scrolling mouse wheel up.}}
+
{{Step|5|Что бы увеличить масштаб переместите курсор к черной точке и прокрутите колёсико мыши вверх.}}
-
Eventually, the window will come into view and you will be able to make out what
+
В конечном счете окно придёт в нормальное состояние, и Вы сможете разобрать, что вы создали.
-
it is.
+
-
The arrows on the node represent ports. The ones on the left are your Input or «Coming In»
+
Стрелки на ноде представляют порты. Слева - "входные" порты, получающие данные. Справа - "выходящие" порты, отдающие результат. Основное правило:
-
ports. The ones on the right are your Output or «Going out» ports. The basic rule
+
# Вы сигнализируете или вызываете Входной Порт.
-
of thumb is:
+
# Нод выполнит своего рода логику.
-
# You signal or call an Input Port.
+
# Результат выполнения вызовет один или более "выходящих" портов.
-
# The Node will execute some sort of logic.
+
# Вы соединяете "выходящий" порт с "входным" портом другого нода, чтобы вызвать его.
-
# The result of the execution will trigger one or more Output Ports.
+
-
# You connect the Output Port to another node’s Input Port to signal it.
+
{{Step|6|Right click anywhere in the checkboard window and place the “Inventory:AddItem” node. You can find this in the “Add Node” menu. (Add Node -> Inventory -> AddItem)}}
{{Step|6|Right click anywhere in the checkboard window and place the “Inventory:AddItem” node. You can find this in the “Add Node” menu. (Add Node -> Inventory -> AddItem)}}

Версия 19:07, 6 февраля 2011

О статье
Авторvloktboky
Редакторыjameszhao00, McGinge,
СложностьЛегко
СовместимостьОригинал


Следующий шаг после создания уровня, это создание динамических действий и событий игры. Для этого можно использовать FlowGraph. Это легко изучаемый, однако бесконечно мощный инструмент создания спкриптов, который можно использовать для создания любых действий и событий в игре. В этом туториале, чтобы понять некоторые из основ FlowGraph, Вы изучите, как дать оружие игроку, когда игрок находится близко к объекту, с помощью Flowgraph.

Содержание

Создание триггера

Шаблон:Step

Этот объект будет использоваться для запуска нашего скрипта. Чтобы создать ProximityTrigger, перейдите в RollupBar>Entity>Triggers>ProximityTrigger.


Шаблон:Step Файл:Create button.png


Шаблон:Step

After creating and naming the flowgraph, the Flow Graph Editor will pop up. You will notice that the name you gave your flowgraph is now listed below the name of your Proximity Trigger on the left-hand side of the screen in the Flow Graphs window. После создания FlowGraph, появится Редактор FlowGraph. Вы заметите, что имя, которое Вы дали скрипту, теперь упомянуто ниже названия Вашего ProximityTrigger на левой сторона экрана в окне FlowGraph.

Файл:Editor window overview.png

Краткое описание каждой секции окна:

Components
Здесь Вы найдете список всех доступных нодов(узлов), которые Вы можете использовать в своих скриптах.
Flow Graphs
Здесь Вы можете увидеть список всех скриптов, содержавшихся в Вашем уровне.
Entity
Здесь Вы можете увидеть описание выбранного нода и значения его входных портов. Также, здесь Вы можете поменять свойства скрипта.
Search
Здесь Вы можете быстро найти свои скрипты по различным критериям.
Search Results
Здесь Вы можете увидеть результаты своих поисков.


Создание нода в FlowGraph

Есть два способа создать нод. Щелкнув правой кнопкой мыши где угодно в рабочей области окне Вы можете:

  1. Нажать "Add Graph Default Entity", для создания нода объекта, к которому прикреплён скрипт.
  2. Нажать "Add Selected Entity", для создания нодов выделенных на карте объектов.


Шаблон:Step Add selected entity.png

Крошечная чёрная точка появится рядом с тем местом, где Вы только что щелкали правой кнопкой мыши. Не волнуйтесь, Вы не сожгли пиксел в своем ЖК-мониторе. Это - нод, который Вы только что создали. Он не является микроскопическим; необходимо просто изменить масштаб.

Шаблон:Step В конечном счете окно придёт в нормальное состояние, и Вы сможете разобрать, что вы создали.

Стрелки на ноде представляют порты. Слева - "входные" порты, получающие данные. Справа - "выходящие" порты, отдающие результат. Основное правило:

  1. Вы сигнализируете или вызываете Входной Порт.
  2. Нод выполнит своего рода логику.
  3. Результат выполнения вызовет один или более "выходящих" портов.
  4. Вы соединяете "выходящий" порт с "входным" портом другого нода, чтобы вызвать его.

Шаблон:Step Add item.png

What we are did here is give the player a Shotgun when they walk into our Proximity Trigger. So we dropped a node that will let us adjust the player’s Inventory.

Adjusting Input Values

Шаблон:Step Файл:Adjust input values.png


This tells the Inventory:AddItem node what weapon we wanted to give to the player. Values in the Inputs window represent the values for the respective Input Port. Almost all Nodes have Input values that let you alter how the Node works. To adjust them is always the same: find them in the Inputs window, and type in or select the value you wish to use.

Creating Links

Once the value has been selected, all we need to do is signal the Inventory:AddItem Node’s add Input Port to give the player the shotgun! We will signal this port from the Proximity Trigger’s Enter Output Port.

Шаблон:Step Файл:Click drag release.png

You should see a curvy line with an arrow connecting the two ports.

Файл:Click drag release result.png

Conclusion

That’s it! You just defined your first Link. To recap, your Graph now has two Nodes: one for the Proximity Trigger in your world, and one that lets you add items to the player’s Inventory. You defined a Link connecting the Proximity Trigger Node’s Enter Input Port to the Inventory:AddItem Node’s add Output Port.

When you walk into the Proximity Trigger in the game, you will be given a shotgun! Try it out, and continue experimenting! There are more things the Flow Graph Editor is capable of doing that were not mentioned in this tutorial.