You are previewing CryENGINE Game Programming with C++, C#, and Lua.
O'Reilly logo
CryENGINE Game Programming with C++, C#, and Lua

Book Description

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.

  • 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

  • In Detail

    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.

    Table of Contents

    1. CryENGINE Game Programming with C++, C#, and Lua
      1. Table of Contents
      2. CryENGINE Game Programming with C++, C#, and Lua
      3. Credits
      4. About the Authors
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Introduction and Setup
        1. Installing Visual Studio Express 2012
        2. Choosing your CryENGINE installation type
        3. Downloading the book's CryENGINE sample installation
          1. What just happened?
        4. Using a custom or newer CryENGINE installation
          1. Verifying that the build is functional
          2. Integrating CryMono (C# support)
            1. Compiling the CryMono project
            2. Loading and initializing CryMono via the CryGame.dll library
              1. Including the CryMono interface folder
              2. Initializing CryMono at start up
              3. Registering flow nodes
        5. Registering your CryDev account
          1. What just happened?
        6. Running the sample application
          1. Editor
            1. Starting the Editor
          2. Launcher
            1. Starting the Launcher
          3. Dedicated server
        7. Compiling the CryGame project (C++)
          1. What just happened?
          2. The CE Game Programming Sample solution breakdown
            1. CryGame
            2. CryAction
            3. CryCommon
        8. The CryENGINE folder structure
          1. PAK files
            1. File query priority
            2. Attaching the debugger
          2. What just happened?
        9. Summary
      9. 2. Visual Scripting with Flowgraph
        1. Concept of flowgraphs
        2. Opening the Flowgraph Editor
        3. A tour of the Flowgraph Editor
          1. Components
            1. Terminology
            2. Component categories
          2. Flowgraph types
            1. AI Actions
            2. UI Actions
            3. Material FX
            4. FG Modules
            5. Entities
            6. Prefabs
        4. Creating a flowgraph
          1. The flowgraph entity
            1. Spawning FlowgraphEntity
          2. Attaching a new flowgraph
          3. Adding nodes into flowgraphs
          4. Input and output ports
            1. Port types
          5. Target entities
          6. Linking flownodes
          7. Testing our flowgraph
        5. The stock flownode overview
          1. Building a clock
          2. Listening for player input
          3. Executing on a loop
        6. Flowgraph modules
          1. Creating a module
          2. Calling a module
          3. Module parameters/ports
        7. Custom flownodes
        8. Creating a custom node in C++
          1. Organizing nodes
          2. Creating a new node file
            1. Breaking down of code
          3. The node functions overview
          4. Implementing GetConfiguration
            1. Creating ports
            2. Assigning arrays to the node configuration
              1. Flownode configuration flags
          5. Implementing ProcessEvent
        9. Creating a custom node in C#
          1. Adding inputs
          2. Adding outputs
          3. Implementing Activate
          4. Target entities
        10. Summary
      10. 3. Creating and Utilizing Custom Entities
        1. Introducing the entity system
          1. Entity classes
          2. Entities
            1. entityId
            2. EntityGUID
          3. Game objects
          4. The entity pool system
        2. Creating a custom entity
          1. Creating an entity using Lua
            1. Common Lua entity callbacks
          2. Creating an entity in C#
            1. Adding Editor properties
              1. Property folders
          3. Creating an entity in C++
            1. Creating a custom entity class
              1. Implementing a property handler
        3. Entity flownodes
          1. Creating an entity flownode in Lua
          2. Creating an entity flownode using C#
          3. Creating an entity flownode in C++
            1. Registering the entity node
            2. The final code
        4. Game objects
          1. Game object extensions
            1. Creating a game object extension in C++
            2. Activating our extension
        5. Summary
      11. 4. Game Rules
        1. Introduction to game rules
          1. IGameRules interface – game rules
          2. Scripting – game modes
          3. Loading a level
        2. Implementing the game rules interface
          1. Registering the game object extension
          2. Creating custom game modes
        3. Scripting
          1. Lua scripting
            1. Invoking methods
            2. Invoking methods with parameters
            3. Getting values returned from Lua
            4. Getting table values
          2. CryMono scripting
            1. Calling methods
            2. Return values
            3. Properties
            4. Fields
        4. Creating a basic game mode in C#
          1. Defining our intention
          2. Creating the actor
          3. Spawning the actor
          4. Handling disconnections
          5. Assigning the player to a team
          6. Implementing Headquarters
            1. Adding the end game event
            2. Creating the Headquarters entity
              1. Detour – trigger bounds and entity areas
          7. Populating the level
        5. Summary
      12. 5. Creating Custom Actors
        1. Introducing the actor system
          1. Channel identifiers
          2. Actor spawning
            1. Removing actors
          3. The view system
            1. Linking views to game objects
        2. Creating custom actors
          1. Creating actors in C#
            1. The CryMono class hierarchy
            2. Using native and CryMono actors alongside each other
              1. C++ actor registration
              2. C# declaration
          2. Creating actors in C++
            1. Registering actors
        3. Camera handling
          1. Implementing IGameObjectView
          2. Creating a top-down camera
            1. View rotation
        4. Player inputs
          1. The hardware mouse
          2. Action maps
            1. Listening for action map events
              1. IActionListener
            2. Enabling action map sections
        5. Animated characters
          1. Movement requests
          2. Adding a movement request
        6. The Mannequin animation system
          1. The Mannequin Editor
            1. Preview setup
            2. Creating contexts
            3. Creating fragments
              1. Adding options
            4. Creating and using tags
              1. Appending tags to Options
            5. Saving
          2. Starting fragments
            1. Acquiring the fragment identifier
            2. Queuing the fragment
          3. Setting tags
            1. Forcing actions into requerying options
          4. Debugging Mannequin
          5. Setting up Mannequin for a custom entity
            1. Initializing Mannequin
            2. Loading the controller definition
            3. Setting the active context
        7. Summary
      13. 6. Artificial Intelligence
        1. The Artificial Intelligence (AI) system
          1. Scripting
          2. AI actors
          3. Goal pipes
            1. Creating custom pipes
            2. Selecting pipes
          4. Signals
          5. AI behaviors
            1. Sample
          6. IAIObject
        2. Creating custom AI
          1. Registering an AI actor implementation
            1. In C#
            2. In C++
          2. Creating the AI entity definition
          3. AI behaviors and characters
            1. Understanding and using behavior selection trees
              1. Variables
              2. Signal variables
              3. Leaves / behavior queries
            2. Character
            3. NavigationType
          4. Creating custom behaviors
            1. Listening to signals
        3. AI base definition breakdown
          1. The AISample_x table
            1. The Properties table
            2. The AIMovementAbility table
          2. The CreateAI function
          3. The RegisterAI function
        4. Summary
      14. 7. The User Interface
        1. Flash movie clips and UI graphs
          1. Elements
            1. XML Breakdown
          2. Actions
        2. Creating a main menu
          1. Creating menu elements
          2. Exposing ActionScript assets
            1. Functions
            2. Events
            3. Variables
            4. Arrays
          3. Exposing MovieClip instances to flowgraph
          4. Creating the UI actions
            1. Creating the state control graph
            2. Creating the MainMenu action
            3. Adding buttons
          5. End result
        3. Engine ActionScript callbacks
        4. Creating UI game event systems
          1. Implementing IUIGameEventSystem
          2. Receiving events
          3. Dispatching events
            1. Dispatching the event
        5. Summary
      15. 8. Multiplayer and Networking
        1. The networking system
          1. Network identifiers
          2. Net channels
            1. Net nubs
        2. Setting up a multiplayer game
          1. Starting the server
            1. Dedicated server
            2. Launcher
          2. Connecting to a server via the console
          3. Debugging networked games
        3. Networking using game object extensions
          1. Remote Method Invocation (RMI)
            1. RMI structure
              1. Parameters
              2. Attach type
              3. Server/client separation
              4. Function definition
            2. RMI example
          2. Network aspect serialization
            1. Aspects
          3. Compression policies
            1. Creating a new compression policy
        4. Exposing Lua entities to the network
          1. Net.Expose
            1. Function implementation
            2. Invoking RMIs
              1. On the server
              2. On all clients
              3. On all other clients
          2. Binding our entity to the network
        5. Summary
      16. 9. Physics Programming
        1. CryPhysics
          1. Physicalized entity types
          2. Introducing physical entity identifiers
            1. Drawing entity proxies
              1. Entity types
              2. Helper types
        2. Physical entity actions, parameters, and status
          1. Parameters
          2. Actions
          3. Status
        3. Physicalized entity type details
          1. Common parameters
          2. Common actions
          3. Common statuses
        4. Static
        5. Rigid
        6. Wheeled vehicle
          1. Unique parameters
          2. Unique statuses
          3. Unique actions
        7. Living
          1. Unique parameters
          2. Unique statuses
          3. Unique actions
        8. Particle
          1. Unique parameters
        9. Articulated
          1. Unique parameters
        10. Rope
          1. Unique parameters
        11. Soft
          1. Unique parameters
          2. Unique actions
        12. Ray world intersections
          1. The ray_hit struct
            1. Commonly used member variables
          2. Origin and direction
          3. Object types and ray flags
            1. Object types
            2. Ray flags
          4. Allowing multiple ray hits
        13. Creating a physicalized entity
          1. In C++
          2. In C#
        14. Simulating explosions
        15. Summary
      17. 10. Rendering Programming
        1. The renderer details
          1. Shaders
            1. Shader permutations
            2. Shader cache
              1. PAK files
        2. Render nodes
        3. Rendering breakdown
          1. Pre update
          2. Post update
        4. Rendering new viewports using render contexts
          1. Rendering
            1. Using the I3DEngine::RenderWorld function
              1. I3DEngine::RenderWorld flags
        5. Shaders
          1. The shader description
          2. Texture slots
          3. Shader flags
            1. Material flags
            2. Engine flags
            3. Runtime flags
          4. Samplers
            1. Using texture slots with samplers
          5. Obtaining a texture
        6. Manipulating static objects at runtime
        7. Modifying materials at runtime
          1. Cloning a material
          2. Material parameters
          3. Shader parameters
          4. Example – Dynamic alpha-test for vegetation
        8. Summary
      18. 11. Effects and Sound
        1. Introducing effects
          1. Material effects
            1. Surface types
              1. Adding or modifying surface types
          2. Particle effects
          3. Sound effects
            1. FMOD Designer
        2. Creating and triggering material effects
          1. Automated playback based on physical interactions
            1. Adding new surface types
            2. Effect definitions
          2. Triggering custom events
        3. Animation-based events and effects
        4. Spawning particle emitters
        5. Exporting sounds by using FMod
          1. Adding sounds to the project
        6. Playing sounds
          1. Using SoundSpots
          2. Programmatically playing sound
            1. Sound flags
            2. Sound semantics
        7. Summary
      19. 12. Debugging and Profiling
        1. Debugging the game logic
          1. Logging to the console and files
            1. Log verbosity
            2. Global log functions
          2. The persistent debug
            1. C++
            2. C#
          3. CryAssert
        2. Profiling
          1. Profile usages
          2. Profiling in C++
          3. Profiling in C#
        3. The console
          1. Console variables
            1. Registering a CVar
              1. In C++
              2. In C#
            2. Flags
            3. Console variable groups
              1. Cfg structure
              2. System specifications
          2. Console commands
            1. Registering a console command in C#
              1. Arguments
            2. Creating a Console Command in C++
        4. Summary
      20. Index