CryENGINE Game Programming with C C and Lua 1st Edition Lundgren instant download
CryENGINE Game Programming with C C and Lua 1st Edition Lundgren instant download
https://ebookgate.com/product/cryengine-game-programming-with-c-
c-and-lua-1st-edition-lundgren/
https://ebookgate.com/product/learning-game-ai-programming-with-
lua-1st-edition-david-young/
https://ebookgate.com/product/programming-with-c-3rd-edition-bl-
juneja/
https://ebookgate.com/product/programming-with-ansi-c-2nd-ed-
edition-trivedi/
https://ebookgate.com/product/linear-programming-with-matlab-1st-
edition-michael-c-ferris/
Fundamentals of Computer Programming with C The
Bulgarian C Book 1st Edition Svetlin Nakov
https://ebookgate.com/product/fundamentals-of-computer-
programming-with-c-the-bulgarian-c-book-1st-edition-svetlin-
nakov/
https://ebookgate.com/product/learn-2d-game-development-
with-c-1st-edition-jebediah-pavleas/
https://ebookgate.com/product/programming-windows-store-apps-
with-c-1st-edition-matthew-baxter-reynolds/
https://ebookgate.com/product/an-introduction-to-programming-
with-c-6th-edition-diane-zak/
https://ebookgate.com/product/object-oriented-programming-
with-c-2-e-second-edition-sahay/
CryENGINE Game Programming with C++, C#,
and Lua
Table of Contents
CryENGINE Game Programming with C++, C#, and Lua
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Introduction and Setup
Installing Visual Studio Express 2012
Choosing your CryENGINE installation type
Downloading the book's CryENGINE sample installation
What just happened?
Using a custom or newer CryENGINE installation
Verifying that the build is functional
Integrating CryMono (C# support)
Compiling the CryMono project
Loading and initializing CryMono via the CryGame.dll library
Including the CryMono interface folder
Initializing CryMono at start up
Registering flow nodes
Registering your CryDev account
What just happened?
Running the sample application
Editor
Starting the Editor
Launcher
Starting the Launcher
Dedicated server
Compiling the CryGame project (C++)
What just happened?
The CE Game Programming Sample solution breakdown
CryGame
CryAction
CryCommon
The CryENGINE folder structure
PAK files
File query priority
Attaching the debugger
What just happened?
Summary
2. Visual Scripting with Flowgraph
Concept of flowgraphs
Opening the Flowgraph Editor
A tour of the Flowgraph Editor
Components
Terminology
Component categories
Flowgraph types
AI Actions
UI Actions
Material FX
FG Modules
Entities
Prefabs
Creating a flowgraph
The flowgraph entity
Spawning FlowgraphEntity
Attaching a new flowgraph
Adding nodes into flowgraphs
Input and output ports
Port types
Target entities
Linking flownodes
Testing our flowgraph
The stock flownode overview
Building a clock
Listening for player input
Executing on a loop
Flowgraph modules
Creating a module
Calling a module
Module parameters/ports
Custom flownodes
Creating a custom node in C++
Organizing nodes
Creating a new node file
Breaking down of code
The node functions overview
Implementing GetConfiguration
Creating ports
Assigning arrays to the node configuration
Flownode configuration flags
Implementing ProcessEvent
Creating a custom node in C#
Adding inputs
Adding outputs
Implementing Activate
Target entities
Summary
3. Creating and Utilizing Custom Entities
Introducing the entity system
Entity classes
Entities
entityId
EntityGUID
Game objects
The entity pool system
Creating a custom entity
Creating an entity using Lua
Common Lua entity callbacks
Creating an entity in C#
Adding Editor properties
Property folders
Creating an entity in C++
Creating a custom entity class
Implementing a property handler
Entity flownodes
Creating an entity flownode in Lua
Creating an entity flownode using C#
Creating an entity flownode in C++
Registering the entity node
The final code
Game objects
Game object extensions
Creating a game object extension in C++
Activating our extension
Summary
4. Game Rules
Introduction to game rules
IGameRules interface – game rules
Scripting – game modes
Loading a level
Implementing the game rules interface
Registering the game object extension
Creating custom game modes
Scripting
Lua scripting
Invoking methods
Invoking methods with parameters
Getting values returned from Lua
Getting table values
CryMono scripting
Calling methods
Return values
Properties
Fields
Creating a basic game mode in C#
Defining our intention
Creating the actor
Spawning the actor
Handling disconnections
Assigning the player to a team
Implementing Headquarters
Adding the end game event
Creating the Headquarters entity
Detour – trigger bounds and entity areas
Populating the level
Summary
5. Creating Custom Actors
Introducing the actor system
Channel identifiers
Actor spawning
Removing actors
The view system
Linking views to game objects
Creating custom actors
Creating actors in C#
The CryMono class hierarchy
Using native and CryMono actors alongside each other
C++ actor registration
C# declaration
Creating actors in C++
Registering actors
Camera handling
Implementing IGameObjectView
Creating a top-down camera
View rotation
Player inputs
The hardware mouse
Action maps
Listening for action map events
IActionListener
Enabling action map sections
Animated characters
Movement requests
Adding a movement request
The Mannequin animation system
The Mannequin Editor
Preview setup
Creating contexts
Creating fragments
Adding options
Creating and using tags
Appending tags to Options
Saving
Starting fragments
Acquiring the fragment identifier
Queuing the fragment
Setting tags
Forcing actions into requerying options
Debugging Mannequin
Setting up Mannequin for a custom entity
Initializing Mannequin
Loading the controller definition
Setting the active context
Summary
6. Artificial Intelligence
The Artificial Intelligence (AI) system
Scripting
AI actors
Goal pipes
Creating custom pipes
Selecting pipes
Signals
AI behaviors
Sample
IAIObject
Creating custom AI
Registering an AI actor implementation
In C#
In C++
Creating the AI entity definition
AI behaviors and characters
Understanding and using behavior selection trees
Variables
Signal variables
Leaves / behavior queries
Character
NavigationType
Creating custom behaviors
Listening to signals
AI base definition breakdown
The AISample_x table
The Properties table
The AIMovementAbility table
The CreateAI function
The RegisterAI function
Summary
7. The User Interface
Flash movie clips and UI graphs
Elements
XML Breakdown
Actions
Creating a main menu
Creating menu elements
Exposing ActionScript assets
Functions
Events
Variables
Arrays
Exposing MovieClip instances to flowgraph
Creating the UI actions
Creating the state control graph
Creating the MainMenu action
Adding buttons
End result
Engine ActionScript callbacks
Creating UI game event systems
Implementing IUIGameEventSystem
Receiving events
Dispatching events
Dispatching the event
Summary
8. Multiplayer and Networking
The networking system
Network identifiers
Net channels
Net nubs
Setting up a multiplayer game
Starting the server
Dedicated server
Launcher
Connecting to a server via the console
Debugging networked games
Networking using game object extensions
Remote Method Invocation (RMI)
RMI structure
Parameters
Attach type
Server/client separation
Function definition
RMI example
Network aspect serialization
Aspects
Compression policies
Creating a new compression policy
Exposing Lua entities to the network
Net.Expose
Function implementation
Invoking RMIs
On the server
On all clients
On all other clients
Binding our entity to the network
Summary
9. Physics Programming
CryPhysics
Physicalized entity types
Introducing physical entity identifiers
Drawing entity proxies
Entity types
Helper types
Physical entity actions, parameters, and status
Parameters
Actions
Status
Physicalized entity type details
Common parameters
Common actions
Common statuses
Static
Rigid
Wheeled vehicle
Unique parameters
Unique statuses
Unique actions
Living
Unique parameters
Unique statuses
Unique actions
Particle
Unique parameters
Articulated
Unique parameters
Rope
Unique parameters
Soft
Unique parameters
Unique actions
Ray world intersections
The ray_hit struct
Commonly used member variables
Origin and direction
Object types and ray flags
Object types
Ray flags
Allowing multiple ray hits
Creating a physicalized entity
In C++
In C#
Simulating explosions
Summary
10. Rendering Programming
The renderer details
Shaders
Shader permutations
Shader cache
PAK files
Render nodes
Rendering breakdown
Pre update
Post update
Rendering new viewports using render contexts
Rendering
Using the I3DEngine::RenderWorld function
I3DEngine::RenderWorld flags
Shaders
The shader description
Texture slots
Shader flags
Material flags
Engine flags
Runtime flags
Samplers
Using texture slots with samplers
Obtaining a texture
Manipulating static objects at runtime
Modifying materials at runtime
Cloning a material
Material parameters
Shader parameters
Example – Dynamic alpha-test for vegetation
Summary
11. Effects and Sound
Introducing effects
Material effects
Surface types
Adding or modifying surface types
Particle effects
Sound effects
FMOD Designer
Creating and triggering material effects
Automated playback based on physical interactions
Adding new surface types
Effect definitions
Triggering custom events
Animation-based events and effects
Spawning particle emitters
Exporting sounds by using FMod
Adding sounds to the project
Playing sounds
Using SoundSpots
Programmatically playing sound
Sound flags
Sound semantics
Summary
12. Debugging and Profiling
Debugging the game logic
Logging to the console and files
Log verbosity
Global log functions
The persistent debug
C++
C#
CryAssert
Profiling
Profile usages
Profiling in C++
Profiling in C#
The console
Console variables
Registering a CVar
In C++
In C#
Flags
Console variable groups
Cfg structure
System specifications
Console commands
Registering a console command in C#
Arguments
Creating a Console Command in C++
Summary
Index
CryENGINE Game Programming with C++, C#,
and Lua
CryENGINE Game Programming with C++, C#,
and Lua
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher, except
in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held
liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.
Livery Place
35 Livery Street
ISBN 978-1-84969-590-9
www.packtpub.com
Filip Lundgren
Ruan Pearce-Authers
Reviewers
Terry Evans
Chris Parthemos
Hendrik Polczynski
Ross Rothenstine
Acquisition Editor
Sam Wood
Arun Nadar
Technical Editors
Anusri Ramchandran
Project Coordinator
Kranti Berde
Proofreaders
Dirk Manuel
Lindsey Thomas
Indexer
Rekha Nair
Graphics
Ronak Dhruv
Abhinash Sahu
Production Coordinators
Aditi Gajjar
Adonia Jones
Cover Work
Adonia Jones
About the Authors
Filip Lundgren is a Technical Director at Poppermost Production AB where he works on SNOW, the
first free-to-play open-world skiing title. Filip has been working with CryENGINE since 2007 with
the release of Crysis 1 SDK, and has developed community tools such as CryMono and the
CryENGINE toolbox.
Writing the book was a great experience and has involved the help of many CryENGINE community
members. Many thanks to the CryDev community and our reviewers for valuable input that helped
shape the book to what it is now.
Ruan Pearce-Authers is a game programmer currently working for Crytek GmbH. In 2009, he began
managing Crytek's development community, and providing technical support for CryENGINE users.
Prior to this, he was active in the Crysis modding community himself, and followed this up by
producing sample projects and additional tools for the Free SDK. He co-developed the CryMono
engine extension to bring support for .NET to the CryENGINE, and the Tanks game sample written
exclusively in C#. At present, Ruan works as part of the development team for Crytek's award-
winning entrance, into the free-to-play market, Warface, in Frankfurt.
I'd like to thank my family, my friends in the industry with whom I've worked on some amazing side
projects, and my wonderful girlfriend, Iulia, for supporting me constantly throughout the authoring of
this book.
About the Reviewers
Terry Evans is a software developer with a degree from the University of Utah. He has a diverse
background as a result of developing solutions in Unix, Linux, Windows, OS/2, Mac OS X, iOS, and
Android, but has always enjoyed developing games the most during his career. He is the founder and
currently lead developer for Entrada Interactive, which is developing a post-apocalyptic, multiplayer,
survival game titled Miscreated using CryENGINE 3. Visit MiscreatedGame.com for more
information on his latest venture.
Chris Parthemos is a recent entrant into the world of game development, but he has worked in
developing content for AAA games for major studios. His educational background includes a Masters
in Interactive Development from the Guildhall at Southern Methodist University, with a focus in
Design and Scripting.
Hendrik Polczynski is a Software Developer from Germany. He has been working on software for
over 10 years. He likes to take on a variety of different areas from industry automation to web, UI,
and game development. You can find his open source projects at github.com/hendrikp or on his
YouTube channel. Hendrik is maintaining a handful of open source projects around the CryDev
community and the CryENGINE 3 FreeSDK. When Hendrik is not working, he is studying for his
B.Sc. degree in Computer Science and Media Application, or helping out with the development of
Miscreated by Entrada Interactive, which is a post-apocalyptic, survival-based MMORPG unlike
anything you've played before.
Ross Rothenstine is an industry software engineer by day and hobbyist game programmer by night.
He has a staunch reputation at his college for turning any major course project into a playable game
by the end of it. He has a focus on Game Engine architecture and how complex subsystems come
about in an elegant manner to make extensible, robust, and most importantly, fun to design games. This
means quite a bit of time, reading, and coffee.
I would like to thank the authors of this book, as the content within it is pure, simple, and most of all,
needed. In my days of wanting to learn CryENGINE programming, and reading the documents and
code by hand, I had wished that a book like this would come about someday.
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files
available? You can upgrade to the eBook version at www.PacktPub.com and as a print book
customer, you are entitled to a discount on the eBook copy. Get in touch with us at
<[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range
of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library.
Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today
and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
The process of developing and maintaining games has changed very rapidly in the last few years. It
has become more and more common for game developers to license third-party game engines, such as
CryENGINE, in order to focus fully on the game itself.
As the first game engine to ship with a pure What You See Is What You Play (WYSIWYP)
philosophy in mind, CryENGINE focuses on productivity and iteration by allowing developers to
jump directly into their games, previewing changes as they happen, and not waiting for levels and
assets to build.
For a programmer, CryENGINE is the ideal toolset. Development can be done in C++ using the
generous API, allowing developers to jump straight into the code and write high-performing code that
is not limited to obscure scripting languages. Got an idea? Fire up Visual Studio and get right to
work.
What this book covers
Chapter 1, Introduction and Setup, covers getting up to speed with a brief overview of the engine,
detailing its strengths, the possibilities it provides, and a step-by-step guide to set up your
environment.
Chapter 2, Visual Scripting with Flowgraph, introduces you to the visual scripting tool, giving an
easy passage to create game logic in an accessible visual manner.
Chapter 3, Creating and Utilizing Custom Entities, covers the entity system and how to use it to your
advantage. Populate your game world with entities that range from simple physicalized objects to
complex weather simulation managers.
Chapter 4, Game Rules, provides you with an in-depth look into the game rules system, giving you a
standardized template for overarching game and session logic. It also teaches how to implement your
own custom game modes in a variety of languages.
Chapter 5, Creating Custom Actors, details the creation of custom actor classes for both player-
controlled entities and the basis of artificial intelligence.
Chapter 6, Artificial Intelligence, covers the process of creating a living and breathing world by
using the built-in artificial intelligence solution.
Chapter 7, The User Interface, details the process of using Flash and Autodesk Scaleform to spice up
your interface with everything from simple on-screen bitmaps to rendering interactive flash elements
in the game world.
Chapter 8, Multiplayer and Networking, covers the work behind taking the engine online, and
learning how to synchronize the game world across the network.
Chapter 9, Physics Programming, covers the inner workings of the physics system, and the process
of creating physical interactions for everything from the largest of vehicles to the smallest particle
effect.
Chapter 10, Rendering Programming, helps you to learn how the rendering system works, and how
to use it to create and expand everything from render nodes to multiple viewports.
Chapter 11, Effects and Sound, details the workings of the FMod sound engine in use by
CryENGINE, allowing you to implement convincing sound for your project.
Chapter 12, Debugging and Profiling, covers common ways of debugging your game, and the basics
of using the console.
What you need for this book
CryENGINE 3 Free SDK v3.5.4
CryMono v0.7 for CryENGINE 3.5.4
Visual Studio Express 2012
Notepad++
FMod
Who this book is for
This book has been written for developers with a basic working knowledge of using CryENGINE and
its Editor, and in some cases will assume the reader knows about very basic features such as loading
a level in the Editor, and placing an entity. If you have never worked with CryENGINE before, we
recommend either playing around with the CryENGINE Free SDK on your own, or purchasing
CryENGINE 3 Game Development: Beginner's Guide, by Sean Tracy and Paul Reindell.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of
information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "The GFx element determines which Flash file should be
loaded for the element."
New terms and important words are shown in bold. Words that you see on the screen, in menus or
dialog boxes for example, appear in the text like this: "Once started, the UI graph with the specified
name will be activated, assuming it contains a UI:Action:Start node as shown:"
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what
you liked or may have disliked. Reader feedback is important for us to develop titles that you really
get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the
book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to
a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the
most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you
find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if
you would report this to us. By doing so, you can save other readers from frustration and help us
improve subsequent versions of this book. If you find any errata, please report them by visiting
http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form
link, and entering the details of your errata. Once your errata are verified, your submission will be
accepted and the errata will be uploaded on our website, or added to any list of existing errata, under
the Errata section of that title. Any existing errata can be viewed by selecting your title from
http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take
the protection of our copyright and licenses very seriously. If you come across any illegal copies of
our works, in any form, on the Internet, please provide us with the location address or website name
immediately so that we can pursue a remedy.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <[email protected]> if you are having a problem with any aspect of
the book, and we will do our best to address it.
Chapter 1. Introduction and Setup
CryENGINE is known as one of the most extensible engines available due to its ability to portray a
vast variety of impressive visuals and gameplay. This makes it an invaluable tool at the hand of a
programmer, where the only limit is one's creativity.
We have created a stripped-down sample installation for the book, which is recommended for users
who are just starting out with the engine. To download it, see the following Downloading the book's
CryENGINE sample installation section.
If you would rather use another build of CryENGINE, such as the latest Free SDK release, please see
the Using a custom or newer CryENGINE installation section later in this chapter. This section will
cover integrating CryMono on your own.
Downloading the book's CryENGINE sample
installation
For this book, we will be using a custom CryENGINE sample as a base for learning the workings of
the engine. Most exercises in the book depend on this sample; however, the working knowledge you
get from this can be applied to the default CryENGINE Free SDK (available at
http://www.crydev.net).
A good way to check this is by starting the Editor and Launcher applications and checking whether the
engine behaves as expected.
Integrating CryMono (C# support)
If you're interested in using the sample code and chapter contents written with C# in mind, you'll need
to integrate the third-party CryMono plugin into your CryENGINE installation.
Note
Note that CryMono is integrated by default in the sample we created specifically for this book.
To begin integrating CryMono, open the Code folder present in the engine root folder. We'll be
placing the source files here, inside a subfolder called CryMono/.
To download the source code, visit https://github.com/inkdev/CryMono and click on Download Zip
(or Clone in Desktop if you prefer using your Git revision control client).
Once downloaded, copy the contents into the Code/CryMono folder we mentioned earlier. If the
folder does not exist, create it first.
When the files have been successfully moved, your folder structure should look similar to this:
Before we compile, we'll need to modify the engine's SSystemGlobalEnvironment struct (this is
exposed using the global gEnv pointer).
To do so, open ISystem.h in the Code/CryEngine/CryCommon/ folder. Find the struct's definition
by searching for the struct SSystemGlobalEnvironment.
Then add the following code to the very end of the struct's members and functions:
struct IMonoScriptSystem*
pMonoScriptSystem;
Note
Modifying interfaces is not recommended if you do not have full engine source, as other engine
modules have been compiled with the default interfaces in mind. However, appending to the end of
this struct is mostly harmless.
Once done, open up the instance of Visual Studio where you opened CryMono.sln and start
compiling.
Note
The automated post-build step in the project should automatically move the compiled files to your
build's Bin32 folder following a successful compilation pass.
To verify that CryMono was compiled successfully, search for CryMono.dll in your Bin32 folder.
Loading and initializing CryMono via the CryGame.dll library
Now that we have the CryMono binaries present in our Bin32 folder, we'll just have to load it during
game startup. This is done via the CryGame project, via the CGameStartup class.
To start, open your CryEngine or CryGame solution file (.sln) present in Code/Solutions/.
Including the CryMono interface folder
Before we modify the game startup code, we'll need to tell the compiler where to find the CryMono
interfaces.
Start by right-clicking on the CryGame project in Visual Studio's Solution Explorer and select
Properties. This should bring up the following CryGame Property Pages window:
Now, click on C/C++ and select General. This will bring up a screen of general compiler settings,
which we'll use to add an additional include folder as shown in the following screenshot:
Now all we have to do is add ..\..\CryMono\MonoDll\Headers to the Additional Include
Directories menu. This will tell the compiler to search CryMono's Headers folder when the
#include macro is used, allowing us to find the CryMono C++ interfaces.
Open GameStartup.h in the CryGame project and add the following to the bottom of the class
declaration:
static HMODULE
m_cryMonoDll;
Then open GameStartup.cpp and add the following before the CGameStartup constructor:
HMODULE CGameStartup::m_cryMonoDll = 0;
Now navigate to the CGameStartup destructor and add the following code:
if(m_cryMonoDll)
{
CryFreeLibrary(m_cryMonoDll);
m_cryMonoDll = 0;
}
Now navigate to the CGameStartup::Init function declaration, and add the following prior to the
REGISTER_COMMAND("g_loadMod", RequestLoadMod,VF_NULL,""); snippet:
m_cryMonoDll = CryLoadLibrary("CryMono.dll");
if(!m_cryMonoDll)
{
CryFatalError("Could not locate CryMono DLL! %i", GetLastError());
return false;
}
auto InitMonoFunc =
(IMonoScriptSystem::TEntryFunction)CryGetProcAddress(m_cryMonoDll,
"InitCryMono");
if(!InitMonoFunc)
{
CryFatalError("Specified CryMono DLL is not valid!");
return false;
}
InitMonoFunc(gEnv->pSystem, m_pFramework);
Now all we have to do is compile CryGame in order to have CryMono loaded and initialized at
startup.
Registering flow nodes
Due to a recent change in the flow system, flow nodes have to be registered at a certain point during
game startup. To make sure that our C# nodes are registered, we'll need to call
IMonoScriptSysetm::RegisterFlownodes from IGame::RegisterGameFlowNodes.
To do this, open Game.cpp and add the following inside the CGame::RegisterGameFlowNodes
function:
GetMonoScriptSystem()->RegisterFlownodes();
Now, after compiling, all managed flow nodes should appear in the Flowgraph Editor.
Other documents randomly have
different content
"Now," said Stark. "What of Delgaun and Berild?"
Fianna said softly, "Their truth, too, is simple. They took Kynon's idea
of empire, and stretched it further. It was Delgaun's idea to bring the
strangers in. They would use Kynon and the tribes until the victory
was won. Then they would do away with Kynon and rule themselves
—with the outlanders and their ships and their powerful weapons to
oppress Low-Canaller and Drylander alike.
"That way, they could rape a world. More outland vultures would
come, drawn by the smell of loot. The Martian men would fight as
long as there was the hope of plunder—after that, they would be
slaves to hold the empire. Their masters would grow fat on tribute
from the City-States and from the men of Earth who have built here,
or who wish to build. An evil plan—but profitable."
Stark thought about Knighton and Walsh of Terra, Themis of Mercury,
Arrod of Callisto Colony. He thought of others like them, and what
they would do, with their talons hooked in the heart of Mars. He
thought of Delgaun's yellow eyes.
He thought of Berild, and he was sick with loathing.
Fianna came close to him, speaking in a different tone that had care
and anxiety only for him.
"I have told you this, because I know what Berild plans. Tonight—oh,
tonight is a black and evil time, and death waits in Sinharat! It is very
close to me, I know. And you must follow your own heart, Eric John
Stark. I cannot tell you more."
He kissed her again, because she was sweet and very brave. Then
she led him on through the dark labyrinth, to where Berild was
waiting, with her dangerous beauty and all the evil of the ages in her
soul.
X
They came out of the darkness so suddenly that Stark blinked in the
unaccustomed light of torches set in great silver sconces on the walls.
The floor had been artificially smoothed, but otherwise this crypt was
as the eroding action of the sea had shaped it out of the coral reef. It
was not large, and it was like a cavern in a fairy tale, walled and
roofed with the fantastic wreathing shapes of the rose-red coral. At
one end there was a golden coffer set with flaming jewels.
Berild was there. Her wonderful hair was dressed and shining, and
her body was clothed all in white, her arms and shoulders warm
bronze from the kiss of the desert sun.
Kynon was there, also. He stood motionless and silent, and he did not
so much as turn his head when Fianna and Stark came in. His eyes
were wide open and blank as a blind man's.
"I have been waiting," said Berild, "and the time is short."
She seemed angry and impatient, and Stark said, "Freka is dead. It
was necessary to hide his body."
She nodded and turned to the girl. "Go now, Fianna."
Fianna bent her head and went away. She did not look at Stark. It
was as though she had no interest in anything that happened.
Stark looked at Kynon, who had not moved or spoken.
"He is safe enough," said Berild, answering Stark's unspoken
question. "I drugged his wine so that his mind was opened to mine,
and he is my creature as long as I will it."
Hypnosis, Stark thought. His nerves were beginning to do strange
things. He wished desperately that he were back in the cell facing
Freka's sword, which at least would deal with him openly and without
guile or subterfuge.
Berild set her hands on Stark's shoulders, and smiled as she had
done that night by the ancient well.
"I offer you three things tonight, wild man," she said. Her eyes
challenged him, and the scent of her hair was sweet and maddening.
"Your life—and power—and myself."
Stark let his hands slip lightly down from her shoulders to her waist.
"And how will you do this thing?" he asked.
"Easily," she said, and laughed. She was very proud, and sure of her
strength, and glad to be alive. "Oh, very easily. You guessed the truth
about me—I am of the Twice-Born, the Ramas. I hold the secret of
the Sending-on of Minds, which this great ox Kynon pretended to
have. I can give you life now—and forever. Remember, wild man—
forever!"
He bent his dark face to hers, so that their lips touched, and
murmured, "Would I have you forever, Berild?"
"Until you tire of me—or I of you." She kissed him, and then added
mockingly, "Delgaun has had me for a thousand years, and I am
weary of him. So very weary!"
"A thousand years is a long time," said Stark, "and I am not
Delgaun."
"No. You're a beast, a savage, a most magnificent cold-eyed animal,
and that is why I love you." She touched the muscle of his breast,
and then his throat, and added, "It's a pity there will never be
another body like this one. We must keep it as long as we can."
"What is your plan?" Stark asked her.
"Simply this. I will place your mind in Kynon's body. You will be
Kynon, with all his power. You will be able then to keep Delgaun in
check—later, you can destroy him, but not until after the battle is
won, for we need the men of Valkis and Jekkara. You can keep your
own body safe from him, and at the worst, if by some chance he
should succeed in slaying the man he believes to be you, you will still
be alive."
"And after the battle," said Stark softly. "What then, Berild?"
"We will rule together." She held his palms against hers. "You have
strong hands, wild man. Would you not like to hold a world between
them—and me?"
She looked up at him, her eyes suddenly shrewd and probing. "Or do
you still believe the nonsense you talked to Kynon, about the tribes?"
XI
He was lying on his face, his cheek pressed against the cool coral. He
opened his eyes, his mind groping for the shreds of some
remembered terror. He saw, vaguely at first and then with terrible
clarity as his vision became clear, a man lying close beside him.
A tall man, very strongly built, with skin burned almost to blackness
by exposure. A man who looked at him with eyes that were
startlingly light in his dark face....
His own eyes. His own face.
He cried out and struggled to his feet, trembling, staggering, and his
body felt strange to him. He looked down upon the strangeness of
another man's limbs, the alien shaping of flesh and sinew upon alien
bones.
The face of the dark giant who lay upon the coral mocked him. It
watched, but did not see. The eyes were blank, empty, without soul
or intelligence.
The mind of Eric John Stark fought, in its alien prison, for sanity.
Berild's voice spoke to him. Her hand was on his shoulder—Kynon's
shoulder....
"All is well, wild man. Do not fear. Kynon's mind is in your body, still
sleeping at my command. And you are Kynon now."
It was not an easy thing to accept, but he knew that it was so, and
he knew that he had wished it to be so. It was easier to be calm after
he turned his back on the other.
Berild took him in her arms and held him until he had stopped
shuddering, oddly like a mother with a frightened child. Then she
kissed him, smiling, and said,
"The first time is hard. I can remember—and that was very long
ago." She shook him gently. "Now come. We'll take your body to a
place of safety. And then I must tell you all of Kynon's plans for those
outside."
She spoke to the thing that lay upon the coral, saying, "Get up," and
it rose obediently and followed where Berild led, to a tiny barred
niche in a side passage. It made no protest when it was left, locked
safely in.
"Only I can give it back to you," said Berild softly. "Remember that."
Stark said, "I will remember."
He went with Berild to Kynon's quarters in the palace. He sat among
Kynon's possessions, clothed in Kynon's flesh, and learned how
Kynon's mind had planned to loose a red tide upon the peaceful cities
of the Border.
Only a small part of his mind was attentive to this. The rest of it was
concerned with the redness of Berild's hair and the warmth of her
lips, and with the heady knowledge that it was possible to be alive
and young forever.
Never to lose the pride of strength, never to know the dimming sight
and failing mind of age. To go on, like a child in an endless
playground, with no fear of tomorrow.
It was nearly dawn.
Berild rose. She had told him much, but not the things Fianna had
told him, of the secret treachery she had planned with Delgaun. She
helped Stark to clothe Kynon's body in the harness of war, with the
longsword and the shield and the shining spear. Then she set her lips
to his so that his borrowed heart threatened to choke him with its
pounding, and her eyes were wondrously bright and beautiful.
"It is time," she whispered.
She walked beside him, as he had seen her beside Kynon in Valkis,
stepping like a queen.
They came out of the palace, onto the steps where Luhar had died.
There were beasts waiting, trapped for war, and an escort of tall
chiefs, with pipers and drummers and link-boys to light the way.
Stark mounted Kynon's beast. It sensed the wrongness in him,
hissing and rearing, but he held it down, and imperiously raised his
hand.
Throbbing drums and skirling pipes, tossing flames where the link-
boys ran with the torches, a clash of metal and a cheer, and Kynon of
Shun rode down through the streets of Sinharat to the coral cliffs,
with the red-haired woman at his side.
They were waiting.
The men of Kesh and the men of Shun were gathered below the
cliffs, waiting. Stark led the way, as Berild had told him to, onto a
ledge of coral above them. Delgaun was there, with the outlanders
and a handful of Valkisians. He looked tired and ill-tempered. Stark
knew that he had been busy for hours with last-minute preparations.
The first pale rays of dawn broke across the desert. A vast ringing cry
went up from the gathered armies. After that there was silence, a
taut expectant hush.
There was no fear in Stark now. He was past that. Fear was too small
an emotion for what was about to be.
He saw Delgaun's golden eyes, hot with a cruel excitement. He saw
Berild's secret triumph in her smile. He looked down upon the
warriors, and let the magnificent voice of Kynon ring out across the
soundless air.
"There will be no war," he said. "You have been betrayed."
In the moment that was left to him, he confessed the lie of the Rama
crowns. And then Berild, who was behind him now, had moved like a
red-haired fury to drive her dagger into his heart.
In his own body, Stark might have escaped the blow. But the reflexes
of Kynon were not as his. They were swift enough to postpone death
—the blade bit deep, but not where Berild had wished it. He turned
and caught her by the wrists, and said to Delgaun,
"She has betrayed you, too. Freka lies in a coral pit—and I am not
Kynon."
Berild tore away from him. She spurred her beast toward the
Valkisian. She would have broken past him, through the escort, and
up the cliffs to safety in the tunnels under Sinharat. But Delgaun was
too quick.
She would have broken past him, but Delgaun was too quick.
One hand caught in the masses of her hair. She was dragged
screaming from the saddle, and even then her screams were not of
fear, but of fury. She clawed at Delgaun, and he fell with her to the
ground.
The tall chieftains of the escort came forward, but they were dazed,
and confused by the anger that was rising in them. Delgaun's wiry
body arched. He flung the woman over the ledge, and what
happened to her after that Stark did not see, nor wish to see.
He was shouting again to the barbarians, the tale of Delgaun's
treachery.
Behind him on the ledge there was turmoil where Delgaun ran on
foot between the beasts, and the outlanders made their try for safety.
Below him in the desert, where there had been silence, a great deep
muttering was growing, like the first growling of a storm, and the
ranks of spears rippled like wheat before the wind.
And Stark felt the slow running out of Kynon's blood inside him,
where Berild's dagger stood out from his back.
They had headed Delgaun away from the path up the cliff. The two
loose mounts had been caught and held. They had tried to catch
Delgaun, but he was light and fast and slipped away from them. Now
he broke back, toward Kynon's great beast.
Knock the dying man from the saddle, charge through the milling
chieftains, who were hampered by their own numbers in that narrow
space....
He leaped. And the arms of Kynon, driven by the will of Eric John
Stark, encircled him and held him and would not let him go.
The two men crashed to the ledge. Stark let out one harsh cry of
agony, and then was still, his hands locked around the Valkisian's
throat, his eyes intent and strange.
Men came up, and he gasped, "He is mine," and they let him be.
Delgaun did not die easily. He managed to get his dagger out, and
gashed the other's side until the naked ribs showed through. But
once again Stark's mind was free in some dark immensity of its own.
He was living again the dream he had in Valkis, and this was the end
of the dream. N'Chaka had a grip at last on the demon with yellow
eyes that hungered for his life, and he would not let go.
The yellow eyes widened. They blazed, and then they slowly dimmed
until the last flicker of life was gone. The strength went out of
N'Chaka's hands. He fell forward, over his prey.
Below, on the sand, Berild lay, and her outspread hair was as red as
blood in the fiery dawn.
The men of Kesh and the men of Shun flowed in a resistless tide up
over the coral cliffs. The chieftains and the pipers and the link-boys
joined them, hunting the outlanders and the wolves of Valkis through
the streets of Sinharat.
Unnoticed, a dark-haired girl ran down the path to the ledge. She
bent over the body of Kynon, pressing her hand to its heart. Tears
ran down and mingled with the blood.
A low, faint moan came from the man's lips. Weeping like a child,
Fianna drew a tiny vial from her girdle and poured three drops of pale
liquid on the unresponsive tongue.
XII
He had come a long way. He had been down in the deep black
valleys of the Place of Darkness, and the iron frost was in his bones.
He had climbed the bitter mountains where no creature of the
Twilight Belt might go and live.
There was light, now. He had been lost and wandering, but he had
won back to the light. His tribe, his people would be waiting for him.
But he knew that he would never see them.
He remembered, then, with the old terrible loneliness, that they were
not truly his people. They had raised him, but they were not of his
blood.
And he remembered also that they were dead, slain by the miners
who had needed all the water of the valley for themselves. Slain by
the miners who had taken N'Chaka and put him in a cage.
With a start of terror, he thought he was again in that cage, with the
leering bearded faces peering in at him. But in the blinding dazzle of
light he could see no bars.
There was only one face. The anxious, pitying face of a girl.
Fianna.
His brain began to clear. Memory returned bit by bit, the fragments
fitting themselves gradually into place.
Kynon. Delgaun. Berild. Sinharat, the Ever-Living.
He remembered now with perfect clarity that he was dying, and it
seemed a terrible thing to die in the body of another man. For the
first time, fully, he felt the separation from his own flesh. It seemed a
blasphemous thing, more terrible than death.
Fianna was weeping. She stroked his hair, and whispered, "I am so
glad. I was afraid—afraid you would never wake."
He was touched, because he knew that she loved him and would be
sad. He lifted his hand to touch her face, to comfort her.
He saw the fingers of that hand, dark against her cheek. Dark....
His own fingers. His own hand.
He was not on the ledge. He was back in the coral crypt beneath the
palace. The light that had dazzled his eyes was not the sun, but only
the flare of torches.
He sat up, his heart pounding wildly.
Kynon of Shun lay beside him on the coral. He was quite dead, his
head encircled by a crown of fire, his side open to the white bone
where Delgaun's blade had struck.
The wound that Kynon himself had never felt.
The golden coffer was open. The second crown lay near Fianna, with
the rod beside it.
Stark looked at her, deep into her eyes. Very softly he said, "I would
not have dreamed it."
"You will understand, now—many things," she said. "And I was glad
of my power today, because I could truly give you life!"
She rose, and he saw that she was very tired. Her voice was dull, as
though it counted over old things that no longer mattered.
"You see why I was afraid. If they had ever suspected that I, too,
was of the Twice-Born ... Berild or Delgaun, each alone, I might have
destroyed, but I could not destroy both of them. And if I had, there
was still Kynon. You did what I could not, Eric John Stark."
"Why were you against them, Fianna? How were you proof against
the poison that made them what they were?"
She answered angrily, "Because I am weary of evil, of scheming for
power and shedding the blood of men as though they were sheep! I
am no better than Berild was. I, too, have lived a long time, and my
hands are not clean. But perhaps, by what you helped me do, I have
made up a little for my sins."
She paused, her thoughts turned darkly inward, and it was strange to
see the shadow of age touching her sweet young face. Then she
said, very slowly, like an old, old woman speaking,
"I am weary of living. No matter where I go, I am a stranger. You can
understand that, though not so well as I. There is an end to pleasure,
and after that only loneliness is left.
"I have remembered that I was human once. That is why I set myself
against their plan of empire. After all these ages I have come round
full circle to the starting point, and things seem to me now as they
seemed then, before I was tempted by the Sending-on of Minds.
"It is a wicked thing!" she cried suddenly. "Against nature and the
gods, and it has never brought anything but evil!"
She caught up the rod and held it in her hands.
"This is the last," she said. "Cities die, and nations perish, and
material things, even such as these, are destroyed. One by one the
Twice-Born have perished also, through accident or swift disease or
murder, as Berild would have slain Delgaun. Now only this, and I, are
left."
Quite suddenly, she flung the rod against the coral, and it broke in a
cloudy flame and a tinkling of crystal shards. Then, one by one, she
broke the crowns.
She stood still for a long moment. Then she whispered, "Now only I
am left."
Again there was silence, and Stark was shaken by the magnitude of
the thing that she had done. Her slim girl's body somehow took on
the stature of a goddess.
After a while he went to her and said awkwardly, "I have not thanked
you, Fianna. You brought me here, you saved me...."
"Kiss me once, then," she answered, and raised her lips to his. "For I
love you, Eric John Stark—and that is the pity of it. Because I am not
for you, nor for any man."
He kissed her, very tenderly, and there was the bitter taste of tears
on her soft lips.
"Now come," she whispered, and took his hand.
She led him back through the labyrinth, into the palace, and then out
again into the streets of Sinharat. Stark saw that it was sunset, and
that the city was deserted. The tribes of Kesh and Shun had broken
camp and gone.
There was a beast ready for him, supplied with food and water.
Fianna asked him where he wished to go, and pointed the way to
Tarak.
"And you?" he asked. "Where will you go, little one?"
"I have not thought." She lifted her head, and the wind played with
her dark hair. She did not smile, and yet suddenly Stark knew that
she was happy.
"I am free of a great burden," she whispered. "I shall stay here for a
while, and think, and after that I shall know what to do. But
whatever it is there will be no evil in it, and in the end I shall rest."
He mounted, and she looked up at him, with a look that wrung his
heart although it was not sad.
"Go now," she said, "and the gods go with you."
"And with you." He bent and kissed her once again, and then rode
away, down to the coral cliffs.
Far out on the desert he turned and looked back, once, at the white
towers of Sinharat rising against the larger moon.
*** END OF THE PROJECT GUTENBERG EBOOK QUEEN OF THE
MARTIAN CATACOMBS ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
ebookgate.com