Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
CryENGINE Game Programming with C++, C#, and Lua
CryENGINE Game Programming with C++, C#, and Lua

CryENGINE Game Programming with C++, C#, and Lua: For developers wanting to create 3D games, CryENGINE offers the intuitive route to success and this book is the complete guide to using it. Learn to use sophisticated tools and build super-real, super-addictive games.

Arrow left icon
Profile Icon Pearce-Authers
Arrow right icon
Mex$179.99 Mex$803.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (6 Ratings)
eBook Nov 2013 276 pages 1st Edition
eBook
Mex$179.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial
Arrow left icon
Profile Icon Pearce-Authers
Arrow right icon
Mex$179.99 Mex$803.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (6 Ratings)
eBook Nov 2013 276 pages 1st Edition
eBook
Mex$179.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial
eBook
Mex$179.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

CryENGINE Game Programming with C++, C#, and Lua

Chapter 2. Visual Scripting with Flowgraph

The CryENGINE flowgraph is a powerful node-based visual scripting system, aiding developers in rapidly prototyping features and creating level specific logic without having to work with complicated codebases.

In this chapter, we will:

  • Discuss the concept of flowgraphs
  • Create new flowgraphs
  • Debug our flowgraph
  • Create a custom flowgraph node (flownode) in Lua, C#, and C++

Concept of flowgraphs

For years, writing code has been the primary, if not the exclusive method of creating behaviors and logic for games. Let's take the example of a level designer, building a combat section for the latest title.

Traditionally, the said designer would have to ask a programmer to create the logic for this scenario. This has several problems:

  • It creates a disconnect between the design and the implementation
  • Programmers are forced into spending time which is really a designer's job
  • The designer has no immediate feedback on how his/her section plays out

This is the problem that CryENGINE's flowgraph, often referred to as FG, solves. It provides a set of flownodes, best thought of as convenient Lego blocks of logic, which the designer can utilize to piece together entire scenarios. No more requests to the game code team; designers can go ahead and realize their ideas instantly! We'll discuss creating the nodes themselves in more detail later, but for now, let...

Opening the Flowgraph Editor

To get started, we need to open up Sandbox. Sandbox contains the Flowgraph Editor as one of its many useful tools, and it can be opened via View | Open View Pane.

Note

You should always have a level loaded when opening the Flowgraph Editor, as flowgraphs are unique to levels. Flick back to Chapter 1, Introduction and Setup, if you've forgotten how to create a new level!

Opening the Flowgraph Editor

You've just accessed your first Sandbox tool! You should be presented with a new window with lots of subsections and features, but don't fret, let's tackle them one by one.

A tour of the Flowgraph Editor

Flowgraphs are saved on the disk as XML files, but can be parsed and edited by the Flowgraph Editor in order to provide a visual interface to the process of creating game logic.

A tour of the Flowgraph Editor

Components

This section of the Editor contains all the flownodes in your project, organized into neat categories. Let's take a quick look inside this, open up the Misc folder. You should be presented with a set of nodes, assigned to categories:

Components

Terminology

  • Graph: This refers to a context containing a set of nodes linked to each other.
  • Node: This is a visual representation of a class that can receive data and events from its input ports, as well as send data via its output ports. It is connected to other nodes in graphs to create logic.
  • Port: This is a visual representation of a function. Nodes can specify multiple input and output ports, and can then send or receive events from them.

Component categories

You may be missing the node marked as Debug here; CryENGINE assigns categories to...

Creating a flowgraph

Now that we have a basic understanding of how the Flowgraph Editor works, let's dive right in and create our first flowgraph! You can close the Flowgraph Editor for the moment.

The flowgraph entity

The flowgraph entity is an extremely lightweight CryENGINE object, designed to be used when you need a flowgraph that isn't applied to any specific entity. Like all entities, it can be found in RollupBar inside Sandbox.

Note

If you're not sure what an entity is, skip this section until you have read Chapter 3, Creating and Utilizing Custom Entities.

The flowgraph entity

Spawning FlowgraphEntity

Select FlowgraphEntity and then either double-click and click again on the viewport, or click and drag it into the level. You should now see a whole new set of options in RollupBar, including entity params, material layers, but mostly important for us, the Entity: FlowgraphEntity section.

Attaching a new flowgraph

Inside the Entity: FlowgraphEntity section, we need to find the Flow Graph subsection...

Concept of flowgraphs


For years, writing code has been the primary, if not the exclusive method of creating behaviors and logic for games. Let's take the example of a level designer, building a combat section for the latest title.

Traditionally, the said designer would have to ask a programmer to create the logic for this scenario. This has several problems:

  • It creates a disconnect between the design and the implementation

  • Programmers are forced into spending time which is really a designer's job

  • The designer has no immediate feedback on how his/her section plays out

This is the problem that CryENGINE's flowgraph, often referred to as FG, solves. It provides a set of flownodes, best thought of as convenient Lego blocks of logic, which the designer can utilize to piece together entire scenarios. No more requests to the game code team; designers can go ahead and realize their ideas instantly! We'll discuss creating the nodes themselves in more detail later, but for now, let's take a look at some...

Opening the Flowgraph Editor


To get started, we need to open up Sandbox. Sandbox contains the Flowgraph Editor as one of its many useful tools, and it can be opened via View | Open View Pane.

Note

You should always have a level loaded when opening the Flowgraph Editor, as flowgraphs are unique to levels. Flick back to Chapter 1, Introduction and Setup, if you've forgotten how to create a new level!

You've just accessed your first Sandbox tool! You should be presented with a new window with lots of subsections and features, but don't fret, let's tackle them one by one.

A tour of the Flowgraph Editor


Flowgraphs are saved on the disk as XML files, but can be parsed and edited by the Flowgraph Editor in order to provide a visual interface to the process of creating game logic.

Components

This section of the Editor contains all the flownodes in your project, organized into neat categories. Let's take a quick look inside this, open up the Misc folder. You should be presented with a set of nodes, assigned to categories:

Terminology

  • Graph: This refers to a context containing a set of nodes linked to each other.

  • Node: This is a visual representation of a class that can receive data and events from its input ports, as well as send data via its output ports. It is connected to other nodes in graphs to create logic.

  • Port: This is a visual representation of a function. Nodes can specify multiple input and output ports, and can then send or receive events from them.

Component categories

You may be missing the node marked as Debug here; CryENGINE assigns categories to nodes...

Creating a flowgraph


Now that we have a basic understanding of how the Flowgraph Editor works, let's dive right in and create our first flowgraph! You can close the Flowgraph Editor for the moment.

The flowgraph entity

The flowgraph entity is an extremely lightweight CryENGINE object, designed to be used when you need a flowgraph that isn't applied to any specific entity. Like all entities, it can be found in RollupBar inside Sandbox.

Note

If you're not sure what an entity is, skip this section until you have read Chapter 3, Creating and Utilizing Custom Entities.

Spawning FlowgraphEntity

Select FlowgraphEntity and then either double-click and click again on the viewport, or click and drag it into the level. You should now see a whole new set of options in RollupBar, including entity params, material layers, but mostly important for us, the Entity: FlowgraphEntity section.

Attaching a new flowgraph

Inside the Entity: FlowgraphEntity section, we need to find the Flow Graph subsection, and then click...

The stock flownode overview


To make something a little more complex, we're going to need an understanding of what nodes the CryENGINE provides for us by default.

Building a clock

One of the most useful nodes we have access to, at least for debugging purposes, is the HUD:DisplayDebugMessage node. It allows you to display information in the game window, optionally with a timeout. With that in mind, let's build a little debug clock based on the time information we learnt about earlier.

The Time:TimeOfDay node outputs the current time in the CryENGINE time format, which is defined as hours plus minutes divided by 60. For example, 1:30 p.m. would be expressed as 13.5 in CryENGINE time. We now know we're going to need some mathematical operations, so it's time to check the Math flownode category.

The first thing we'll do is get the time in hours by rounding the current time down. To do this, place Math:Floor, then connect the CurTime output from our Time:TimeOfDay node to Floor's A input port. Then...

Flowgraph modules


The flowgraph module system allows flowgraphs to be exported as a module that can be triggered from another graph.

By creating modules, we can reuse logic in multiple levels without having to maintain several versions of the same graph. It's also possible to send and receive unique data to and from the modules, allowing dynamic logic in a very modular manner.

Creating a module

To start with creating your own module, open the Flowgraph Editor and select File | New FG Module... | Global:

In the resulting Save dialog box, save the module with a name of your choice. You'll then be shown the default view of a module:

The module contains two nodes by default; Module:Start_MyModule and Module:End_MyModule.

  • Module:Start_MyModule contains three output ports:

    • Start: This is called when the module is loaded

    • Update: This is called when the module should be updated

    • Cancel: This is called when the module should cancel, and it is connected to the Cancel input of Module:End_MyModule by default...

Left arrow icon Right arrow icon

Key benefits

  • Dive into the various CryENGINE subsystems to quickly learn how to master the engine
  • Create your very own game using C++, C#, or Lua in CryENGINE
  • Understand the structure and design of the engine

Description

CryENGINE is a complete 3D game development solution that can run on multiple platforms. It is orientated around giving intuitive tools to the developer. A variety of interactive video games can be created using CryENGINE. CryENGINE is one of the most beginner-friendly engines out there to learn. If you are interested in diving into the various systems and understanding their workings in a way that is easily understood, then this book is for you. This book provides you with the knowledge to tame the powerful but hard-to-master CryENGINE. CryENGINE Game Programming with C++, C#, and Lua dives into the various systems and explains their workings in a way that can be easily understood by developers of all levels. It provides knowledge on the engine along with step-by-step exercises and detailed information on the backend implementation of the subsystems, giving you an excellent foundation to build upon when developing your own CryENGINE games. Written by developers with years of CryENGINE experience, this book breaks down the common confusion that encompasses the CryENGINE engine code, guiding you through a series of chapters aimed towards giving you the ability to create your own games in a rapid yet productive fashion. You will learn everything you need to know in order to create your own CryENGINE-powered games as well as detailed information on how to use the engine to your advantage. By teaching systems such as audio, particle effects, rendering, AI, networking, and more, we'll be exposing the most inner parts of CryENGINE that commonly confuse programmers. If you want to quickly gain the knowledge required to create your own CryENGINE game title, then this book is for you.

Who is this book for?

This book is intended for developers looking to harness the power of CryENGINE, providing a good grounding in how to use the engine to its full potential. The book assumes basic knowledge of the engine and its editor in non-programming areas.

What you will learn

  • Make and modify Flowgraph nodes to give your visual scripting a clear advantage
  • Utilize custom entities, from simple physicalized objects to complex weather simulation managers
  • Control the flow of the game in real-time by creating game rules and modes
  • Create custom actors, in order to create unique elements controllable by human players
  • Use the Artificial Intelligence system to your advantage with custom AI units
  • Design custom User Interfaces to give your player a way to navigate the game s menus and HUDs
  • Implement multiplayer and networking elements for your game, allowing several players to share the experience with each other
  • Master game physics and how to create your own physicalized objects that can interact with the game world
  • Understand the process of using and manipulating the CryENGINE renderer to your advantage, including custom shader authoring
  • Bring your game to life by introducing effects such as particles and sound
  • Debug and profile your game code to get the most out of the computers running your game
  • Implement stock GameDll systems such as vehicles and weapons

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 22, 2013
Length: 276 pages
Edition : 1st
Language : English
ISBN-13 : 9781849695916
Vendor :
Crytek
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 22, 2013
Length: 276 pages
Edition : 1st
Language : English
ISBN-13 : 9781849695916
Vendor :
Crytek
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 3,262.97
CryENGINE 3 Cookbook
Mex$1128.99
CryENGINE 3 Game Development: Beginner's Guide
Mex$1128.99
CryENGINE Game Programming with C++, C#, and Lua
Mex$1004.99
Total Mex$ 3,262.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. Introduction and Setup Chevron down icon Chevron up icon
2. Visual Scripting with Flowgraph Chevron down icon Chevron up icon
3. Creating and Utilizing Custom Entities Chevron down icon Chevron up icon
4. Game Rules Chevron down icon Chevron up icon
5. Creating Custom Actors Chevron down icon Chevron up icon
6. Artificial Intelligence Chevron down icon Chevron up icon
7. The User Interface Chevron down icon Chevron up icon
8. Multiplayer and Networking Chevron down icon Chevron up icon
9. Physics Programming Chevron down icon Chevron up icon
10. Rendering Programming Chevron down icon Chevron up icon
11. Effects and Sound Chevron down icon Chevron up icon
12. Debugging and Profiling Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(6 Ratings)
5 star 33.3%
4 star 50%
3 star 16.7%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Evgeny Adamenkov Mar 09, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As of today, this is the only book about CryEngine that is useful for programmers, rather than designers.
Amazon Verified review Amazon
Ross Rothenstine Feb 05, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Having been a part of the CryDev community for a while, using the SDK and tools for personal and college projects, I can safely say this book would have help me out a lot when I first started.The book covers the portions of programming needed to get a game up and running. Entities, Flow Nodes, Actors, Game Rules, and UI development to say a few portions.While the book is aimed at novices to CryEngine, I would recommend a C++ background before picking up this book.
Amazon Verified review Amazon
Brian Feb 28, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Very informative, and helps you get into the nitty gritty of the engine.It goes into enough detail to understand how the engine handles everything. With the help of this book I was able to enter a competition for getting an art asset in the game engine. I got into the finals, which is awesome.I would highly recommend the book.
Amazon Verified review Amazon
Nick Feb 07, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Both authors, Filip Lundgren (developer for CryMono) and Ruan Pearce-Authers (currently working for Crytek GmbH), have a strong background in working with CryEngine. The book gives a lot of insight into the programming side of the engine, which is mostly missing from the documentation; it’s a great reference for using CryEngine’s subsystems from a programmer’s point of view.The content itself is based on CryEngine 3.5.4, which is one of the latest iterations as of February 2014. There’s also a companion project which is already set up to use CryMono and includes all the code written throughout the chapters. I had some issues running it out of the box but seasoned programmers will have no trouble tackling those problems.The book starts by explaining the building blocks for making your game – how to script your game visually using CryEngine’s flowgraph system and how to create your own custom flow-nodes. It then expands on customizing the entities and game rules in your application. Halfway through the book you’ll already know how to create your level, spawn your actors, control the player camera and add triggers that execute the game logic. This is done in a “learn by example” fashion, which is my personal favorite, especially when the examples are clear and concise as is the case.The second half of the book is dedicated to the major subsystems in the engine – Artificial Intelligence, User Interface, Networking, Physics, Graphics and Sound. At just shy of 300 pages, you can’t expect to gain in-depth knowledge of every little detail in those subsystems from reading the book, but it does give you a comprehensive overview that will get you started. One thing that I did not like was that instead of the example driven style used so far, the book becomes more of a reference in this part, with only one practical example for all the subsystems (namely, “Dynamic alpha testing for vegetation”). The subsystems part of the book does give you a lot of useful information summed up, but I feel that having a few samples would add more value.The last chapter is dedicated to debugging and profiling, covering common ways of detecting and fixing problems in CryEngine.Overall, it’s a great resource for both beginners and intermediate users of CryEngine, although advanced knowledge in general programming is required to understand what’s going on under the hood. That’s why I wouldn't recommend it for novice programmers as they will probably be left frustrated. If you have coding experience and you’re a newcomer to CryEngine who doesn't want to spend hours and hours looking for information, then this book is for you. If you’re already into CryEngine and you find yourself lacking a concise guide for its subsystems it’s worth the read as well.
Amazon Verified review Amazon
Tim Jan 26, 2014
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Overall, this book is a fount of knowledge regarding programming for CryEngine. The authors examples are both functional and useful. However, this book is clearly for people that have an intermediate coding knowledge. Additionally, it is incredibly helpful to have a working knowledge of the CryEngine SDK before starting this book. I will wholeheartedly admit that my personal knowledge of CryEngine is not the best and that did cause me a few issues in understanding certain things being discussed. If anyone is looking at this book to teach them CryEngine from scratch, there are much better references out there for the complete beginner.There are many subjects, particularly the C++ portions of the book, that help to explain things where the online documentation for the CryEngine SDK is lacking. As such, this book is going to go into my reference library and without a doubt get filled bookmarks and plenty of notes. Though it is impossible to fit all the knowledge of CryEngine into a single volume, this book definitely points the reader in the right direction regarding a good amount of subsystems that CryEngine has to offer a developer. Additionally, the discussion of C# and Lua on top of C++ really shows the freedom that CryEngine can give you.There are some minor issues with some of code that is in the book, but as I said before, familiarity with programming is a must and that knowledge will lead you to easily track down those problems. Formatting of code in ebooks always seems to leave a bit to be desired and there were occasions that I had to look at the code multiple times to get everything right.As I mentioned previously, I would only recommend this book to people with a working knowledge of both CryEngine and generally programming. It is well worth the read for those that need to expand an already existing knowledge base of the game engine.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.