Learn Cryengine - 10 Code Examples & CST Typing Practice Test
CryEngine is a high-end, cross-platform 3D game engine developed by Crytek, designed for AAA-quality games, simulations, and VR/AR applications. It features advanced rendering, physics, AI, audio, networking, and a full toolchain for game development.
View all 10 Cryengine code examples →
Learn CRYENGINE with Real Code Examples
Updated Nov 24, 2025
Code Sample Descriptions
CryEngine C++ Entity Example
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CMyEntity final : public IEntityComponent
{
public:
static void Register(Schematyc::CEnvRegistrationScope& scope) {}
virtual void Initialize() override {
CryLogAlways("CMyEntity initialized!");
}
virtual void ProcessEvent(const SEntityEvent& event) override {
switch (event.event) {
case EEntityEvent::Update:
CryLogAlways("Entity updating each frame...");
break;
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
};
A minimal CryEngine entity component written in C++ that responds to game start and updates each frame.
CryEngine Entity Move Example
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CMoveEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CMoveEntity initialized!");
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
auto pos = GetEntity()->GetWorldPos();
pos.x += 0.1f;
GetEntity()->SetPos(pos);
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
};
Moves the entity along X axis each frame.
CryEngine Entity Rotate Example
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CRotateEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CRotateEntity initialized!");
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
auto rot = GetEntity()->GetWorldRotation();
rot *= Quat::CreateRotationY(0.01f);
GetEntity()->SetRotation(rot);
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
};
Rotates entity each frame on Y axis.
CryEngine Entity Scale Example
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CScaleEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CScaleEntity initialized!");
scale = 1.0f;
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
scale += 0.01f;
GetEntity()->SetScale(Vec3(scale, scale, scale));
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
private:
float scale;
};
Changes entity scale over time.
CryEngine Log Key Press Example
#include <CryEntitySystem/IEntityComponent.h>
#include <CryInput/IInput.h>
#include <CrySystem/ISystem.h>
class CKeyPressEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CKeyPressEntity initialized!");
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
if (gEnv->pInput->IsKeyDown('F')) {
CryLogAlways("Key F pressed!");
}
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
};
Logs message when key is pressed.
CryEngine Entity Toggle Visibility
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CVisibilityEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CVisibilityEntity initialized!");
timer = 0.0f;
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
timer += gEnv->pTimer->GetFrameTime();
if (timer > 1.0f) {
GetEntity()->Hide(!GetEntity()->IsHidden());
timer = 0.0f;
}
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
private:
float timer;
};
Toggles visibility every second.
CryEngine Entity Destroy on Collision
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CCollisionDestroyEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CCollisionDestroyEntity initialized!");
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Collision) {
GetEntity()->Remove();
CryLogAlways("Entity destroyed on collision.");
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Collision;
}
};
Destroys the entity when it collides.
CryEngine Entity Follow Player
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CFollowEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CFollowEntity initialized!");
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
auto playerPos = gEnv->pEntitySystem->FindEntityByName("Player")->GetWorldPos();
GetEntity()->SetPos(playerPos);
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
};
Entity follows another entity called Player.
CryEngine Flashing Light Entity
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CFlashLightEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CFlashLightEntity initialized!");
timer = 0.0f;
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
timer += gEnv->pTimer->GetFrameTime();
if (timer > 1.0f) {
lightVisible = !lightVisible;
GetEntity()->SetSlotFlags(0, lightVisible ? 0 : ENTITY_SLOT_RENDER);
timer = 0.0f;
}
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
private:
float timer;
bool lightVisible;
};
Flashes light component on/off every second.
CryEngine Timed Destroy Entity
#include <CryEntitySystem/IEntityComponent.h>
#include <CrySystem/ISystem.h>
class CTimedDestroyEntity final : public IEntityComponent
{
public:
virtual void Initialize() override {
CryLogAlways("CTimedDestroyEntity initialized!");
timer = 0.0f;
}
virtual void ProcessEvent(const SEntityEvent& event) override {
if (event.event == EEntityEvent::Update) {
timer += gEnv->pTimer->GetFrameTime();
if (timer >= 5.0f) {
GetEntity()->Remove();
CryLogAlways("Entity destroyed after 5 seconds.");
}
}
}
virtual Cry::Entity::EventFlags GetEventMask() const override {
return EEntityEvent::Update;
}
private:
float timer;
};
Destroys the entity after 5 seconds.
Frequently Asked Questions about Cryengine
What is Cryengine?
CryEngine is a high-end, cross-platform 3D game engine developed by Crytek, designed for AAA-quality games, simulations, and VR/AR applications. It features advanced rendering, physics, AI, audio, networking, and a full toolchain for game development.
What are the primary use cases for Cryengine?
AAA 3D games on PC and consoles. VR/AR immersive experiences. Architectural and engineering visualization. Simulations and training applications. High-fidelity real-time rendering
What are the strengths of Cryengine?
AAA-level graphics and photorealism. Full source code access. Comprehensive world-building tools. Advanced physics and AI systems. Strong VR/AR support
What are the limitations of Cryengine?
Steep learning curve for beginners. Heavier system requirements. Smaller user community compared to Unity/Unreal. Complex C++ integration needed for custom systems. Limited mobile support compared to other engines
How can I practice Cryengine typing speed?
CodeSpeedTest offers 10+ real Cryengine code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.