The following is not intended to be a complete list of CRYENGINE 5.4 C++ API changes, rather it is an indication of the most important changes that Programmers need to be aware of.
Table of Contents
Visual Studio Support
CRYENGINE 5.4.0 introduces support for Visual Studio 2017. In addition, Visual Studio 2015 users are required to install Update 3 in order to successfully compile the 5.4.0 version of Engine source code.
This release officially deprecates:
- Game Objects (IGameObject, IGameObjectExtension - Replaced with the new Entity Components (IEntityComponent). Note: (IGameObject, IGameObjectExtension will be removed in a future Engine release.
- Game Rules (IGameRulesSystem, IGameRules) - Replaced with INetworkedClientListener (see below for more information).
- Actors (IActorSystem, IActor) - Replaced by the new Entity Components, to be used in-conjunction with INetworkedClientListener.
- 5.3.0 standard entities (see below for more information) - Replaced with new Standard Components.
- Legacy Game Folders (sys_game_folder, sys_dll_game) - Replaced with the Project System. Note: Automatic migration (after running 5.4.0 for the first time) will be performed. The old game folder support will be removed in a future Engine update.
- CryPlugin.csv - Replaced with the Project System. Automatic migration will be performed on first boot, moving all plug-ins into your .cryproject file.
Keep in mind that the legacy GameSDK project uses many deprecated systems and it will be dropped in the future. However, we have not yet marked it as deprecated, because we are waiting for the templates to accurately match the functionality of the GameSDK first.
Entity System & Schematyc
The new Entity Component system (that was introduced with CRYENGINE 5.3.0) has been adjusted in order to unify with the Schematyc setup. This means that any component exposed with the new 5.4.0 format (example below) will automatically become available in the Inspector and Schematyc so that Designers can build more complex logical entities.
The existing 5.3.0 method of creating components is still available, however we'll be phasing it out over time as the new unified setup matures. Part of evolving the new setup will be to reduce the amount of code required to expose a component, so keep in mind that the example below will not be as rough in the future:
The default entities introduced with CRYENGINE 5.3.0 are still part of the Engine, but are now considered deprecated and will be removed in a future Engine release. These entities are no longer available for creation in the Sandbox Editor, but existing instances will continue to work.
The new standard components can be used by Designers as well as Programmers using C++. For example, the updated 5.4 templates heavily utilize the new standard components in order to cut down on the amount of code required when getting started. The new components can be included with the path <DefaultComponents/...`>.
The components all reside in the Cry::DefaultComponents namespace.
- EntityGUID is now a proper 128-bit GUID. Parsing of legacy 64-bit GUIDs will still work, but convert on export.
- IEntity::Activate has been removed. Individual components can now return BIT64(ENTITY_EVENT_UPDATE) in GetEventMask and call UpdateComponentEventMask to trigger re-activation.
- For legacy code, use IGameObject::ForceUpdate(true) to mimic the same behavior as before.
- IEntity::IsActive has been renamed to IsActivatedForUpdates.
- IEntityComponent functions PreInit, Initialize, OnShutDown, OnTransformChanged, ProcessEvent and Run are now protected and can thus not be called from outside the component itself.
- If you need to send an event to a specific component, use IEntityComponent::SendEvent.
The templates have been refactored to require much less code for the same end result. New systems have also been introduced, which have allowed us to remove dependencies on legacy systems:
- Replaced IGameObject and IGameObjectExtension usage - Now using the new IEntityComponent system directly.
- Removed large blocks of duplicated code across templates - Now using the new Standard Components in order to simplify the creation of basic gameplay.
- Replaced IGameRules and IActor - Now using INetworkedClientListener (see below for more information) and IEntityComponent directly. Games no longer need to utilize the legacy actor system to support players.
Refactoring of our network is in progress and will start with the public API. The goal is to remove network dependencies (in the legacy CryAction module) in order to simplify how games can utilize networking in code. This is also preparation for a future refactoring of our network internals.
Receiving Client Connection Callbacks
INetworkedClientListener and INetwork::AddNetworkedClientListener was added as an alternative for the legacy game rules system. This interface can be used to receive callbacks when clients connect over the network, making it possible to skip usage of game rules in projects. The templates have been updated to utilize this.
Remote Method Invocation (RMI) Support for New Entity Components
In the initial 5.3.0 Engine release, the new Entity Component system did not support RMI's, this has now been corrected and allows new entity code to be networked. See example below.
Network Aspect Serialization for New Entity Components
In addition to RMI's, 5.4 also introduces support for serializing chunks of data as aspects over the network. This can be useful, for example to synchronize player input of a player. We've attached an example below:
- IAnimEventPlayerGame introduced - Replaces hardcoded string lookup.
- The Character Tool previously found the game's custom IAnimEventPlayer implementation by searching for a class with the name of the 'sys_game_name' CVar. This has now been removed. Instead, the system now searches for the first IAnimEventPlayerGame implementation it can find and exposes that to the Character Tool.
- IAnimationPoseAligner::Update - Now takes character instance.
- IActionController::FindOrCreateProceduralContext - Can no longer take a string, instead passes the class id, for example CProceduralContextRagdoll::GetCID()
- The entirety of the audio interfaces have been refactored to utilize the new CryAudio namespace.
- For example, AudioControlId is now CryAudio::ControlId.
Asset Browser & Paths
- Engine assets can no longer be loaded through the "Engine/EngineAssets" path - This will now have to be changed to "%ENGINE%/EngineAssets". Engine assets will automatically show up in the Asset Browser, and will use the new path automatically.
- CryCreateClassInstance(const char*, std::shared_ptr<T>&) - Has been removed, please use CryCreateClassInstance(const CryClassID& cid, std::shared_ptr<T>& p) or CryCreateClassInstanceForInterface(const CryInterfaceID& iid, std::shared_ptr<T>& p).
- For example, CryCreateClassInstance("AnimationPoseModifier_OperatorQueue", m_poseModifier); becomes CryCreateClassInstanceForInterface(cryiidof<IAnimationOperatorQueue>(), m_poseModifier);
- Loading of Engine assets in code now requires the "%ENGINE%" prefix, for example "%ENGINE%/EngineAssets/Textures/White.dds".
- Flow node registration no longer requires extensive extra logic to be implemented for each game. Instead, call CryRegisterFlowNodes during initialization and CryUnregisterFlowNodes during shutdown.
- CryMath/Random.h - Is no longer included by default in certain header files. This may result in projects having to include the files manually (#include <CryMath/Random.h>).
- IConsole functions that were used to register console commands and CVars are no longer publicly accessible. You might have to update your code to use the already existing macros or the new ConsoleRegistrationHelper class (all of which are located in <CrySystem/ISystem.h>.