没有合适的资源?快使用搜索试试~ 我知道了~
ce2_cpp_flownode_tutorial
需积分: 0 1 下载量 4 浏览量
2011-09-29
16:46:25
上传
评论
收藏 430KB PDF 举报
温馨提示
试读
24页
CryEngine 2 逻辑创建教程 英文文档
资源详情
资源评论
资源推荐
Document Author:
Kevin “vloktboky” Kirst
RenEvo Software & Designs
Email: kkirst@gmail.com
Custom Flow Nodes in C++
for
CryENGINE™ 2 SDK
Table of Contents
Introduction .......................................................................................................... 1
Requirements ................................................................................................... 1
Terminology...................................................................................................... 2
Creating a Custom Flow Node ............................................................................. 3
The StopWatch Node ....................................................................................... 3
Declaring the Class....................................................................................... 4
Setting up the Configuration.......................................................................... 5
Handling the Events.................................................................................... 11
Registering with the Flow System ............................................................... 14
Appendix A......................................................................................................... 17
Frequently Asked Questions........................................................................... 17
Appendix B......................................................................................................... 18
MyFlowNodes.cpp .......................................................................................... 18
Example_RaceGraph.xml............................................................................... 21
1
Introduction
The Flow-Graph is an amazing tool for designers and programmers alike. Built
into the Sandbox 2™ for the CryENGINE™ 2 engine, it completely removes the
necessity of understanding either C++ or the Lua scripting language to create
mission or environment interaction logic for your levels.
Coupled with the free Software Development Kit (SDK) for CryENGINE™ 2 is an
already immense library of Nodes and example Graphs available for use with
the Flow-Graph. (I will explain this terminology for you further on.) However, for
those of you who find yourself in need of something unique and original to
achieve the desired effect for your mods or maps, there is hope. Creating a
custom Flow Node is not as difficult as it sounds! In fact, there are two ways to
achieve this:
1. Defining Ports within an entity’s Lua script and placing that entity on your
map.
2. Defining Nodes in C++ and using your custom GameDll.dll with the Editor.
This tutorial will cover Step #2. Be aware that for this to work, you will need to
have your own Mod directory already defined and the C++ Source solution setup
for use. Furthermore, this tutorial makes the assumption that you know how to
program in the C++ language and that you have familiarity with the Flow-Graph
Editor. I will not be covering how to do this. If you need assistance in this area,
please consult the Sandbox manual provided with the SDK.
Requirements
Before continuing on with this tutorial, please ensure you have the following on
your computer and have an understanding on how to use them:
CryENGINE™ 2 SDK
CryENGINE™ 2 SDK C++ Source Solution
Sandbox 2™ with Flow-Graph knowledge
Microsoft™ Visual Studio™ 2005 (8.0)
Custom Mod Directory
Be sure to review the Terminology section below to familiarize
yourself with the Flow-Graph vocabulary, as these words are
used extensively throughout this tutorial!
2
Terminology
Graph
A Graph is a series of Nodes which are Linked together via their Ports. The
Graph is the final result which defines a behavior, such as opening a door and
turning on a light when someone enters a proximity trigger or triggers a remote
button.
Link
A Link is used to connect an Output Port to an Input Port between two Nodes.
This link describes what happens next. “When you push button, open door” can
be defined as a link between the button’s Pushed output port and the door’s
Open input port.
Node
A Node is a container of Output and Input Ports and makes up a Graph. A node
is typically used to represent either an entity or an action (component). In the
behavior “When you push a button, open door,” both the button and the door are
represented as nodes.
Port
A Port is like a doorway for a Node. Links between two different ports embody
the described behavior. There are two different types of ports:
Input – “Walking in” to the door. These ports are represented on the left-
hand side of the node in the Flow-Graph Editor and are connected to the
right side of the link. Input Ports are used to either tell the node to do
something or tell the node how to do something.
Output – “Walking out” of the door. These ports are represented on the
right-hand side of the node in the Flow-Graph Editor and are connect to
the left side of the link. Output Ports are used to continue the flow on to
the next Input Port on another Node. Commonly, you will find yourself with
more than one Output Port to handle the different conclusions the Node
came to from its last action.
Given a node “Soldier” that is used to describe a soldier with health, the node
may have an input port IsDamaged and output ports Yes and No. When you call
the IsDamaged input port via a link, either the Yes or No output ports may be
called depending on the soldier’s health. This creates a Split and can be used to
separate the behavior based on the result. For example, you could link the Yes
output port to a “HealSoldier” node and the No output port to play an Error sound.
Now that you have an understanding of the terminology, let’s continue…
3
Creating a Custom Flow Node
The StopWatch Node
Hopefully we’re all familiar with the concept of a stopwatch.
This wonderful tool aids us in determining the duration of time
between two events. Although you may be asking yourself,
“What purpose would I have for making a stopwatch in
Sandbox?” I feel this is a concept simple enough for our first
component node. And if you ever wanted to know how long it
would take a player to run from point A to point B on your map,
now you can figure that out!
You may have noticed I called this a component node. What I mean by this is no
physical entity will exist in your level that is a “stopwatch.” Instead, this stopwatch
be virtual and have no physical representation in the world.
Our StopWatch Node will have three Input Ports and one Output Port. They are
as followed:
Input Ports
Start – (Void) This will be a functional port that we will call when we want
to start the stopwatch.
Stop – (Void) This will be a functional port that we will call when we want
to end the stopwatch.
Timeout – (Float) This will be a data port that we will use to specify how
long the stopwatch can go before timing out.
Output Ports
Done – (Float) We will signal this port when the stopwatch has stopped.
The duration of time will be sent out through it.
We will use our stopwatch by signaling the Start input port to start the stopwatch
and the Stop input port to stop the stopwatch. The Timeout input port can be
used to specify how long the stopwatch will go before automatically stopping.
Keeping this value at 0 will allow the stopwatch to go on forever. Once the
stopwatch has stopped, the Done output port will be called with the time value,
allowing us to complete our behavior based on the amount of time that has
passed.
Now that we know how this node will function, let’s create it!
剩余23页未读,继续阅读
sagakiss
- 粉丝: 22
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0