Oculus (VR) (we have the hardware to test)
WebGL (FPC can compile to WebAssembly)
XBox (we have the hardware to test).
|Not enough? Want more features? :) See our roadmap and support us on Patreon to make it happen!|
Truly cross-platform, you can work on (almost) any platform and compile to any platform.
Desktop (Linux, Windows, macOS, FreeBSD). Just install the engine, compiler (like FPC) and run the application.
Mobile (Android, iOS) with numerous Android services and iOS services to integrate with platform-specific features.
Console (Nintendo Switch).
Raspberry Pi (it’s just desktop Linux on Arm CPU).
Coming soon (roadmap):
Oculus (VR) (we have the hardware to test)
WebGL (FPC can compile to WebAssembly)
XBox (we have the hardware to test).
The engine code is portable and in principle "just works" on any operating system and CPU supported by FPC or Delphi.
Editor to visually design your game 3D and 2D world and user interface around it.
With templates for new projects — empty, 3D, 2D. They showcase nicely engine possibilities and were designed as a good starting point for your applications.
Allows to easily build the project for all platforms.
With file browser, with preview for data (3D models, images, sound files).
With easy way to execute code editor (Lazarus, Visual Studio Code or anything else you like) to edit your code.
Designs are (de)serialized to JSON. Any component can be (de)serialized, along with it published properties.
Designs can refer to each other using
TCastleDesign, to use them like prefabs from other engines. See examples/advanced_editor/advanced_loading_designs.
You can define custom project-specific components available in the editor.
Viewport with scenes, camera, navigation allows to define 3D and 2D worlds.
Flexible hierarchy of transformations and scenes that you can design in the editor or control from Pascal code using a powerful OOP API.
TCastleScene to load and render a lot of model formats, like glTF, X3D, sprite sheets.
Other visible objects like
TCastleImageTransform. Great also for quick prototyping 3D and 2D worlds.
Flexible camera support, with multiple camera possible, attaching children to camera and placing camera as child of other objects, like bones.
Easy navigation components if you want to allow user to navigate in 3D or 2D worlds in a standard fashion. These include typical 2D and 3D navigation methods (like
TCastle2DNavigation) as well as 3rd-person navigation with avatar (
Each transformation can be enhanced with behaviors (descendants of
TCastleSoundSource. It is easy and encouraged to create behaviors required for your specific game, see Behaviors in the manual.
TCastleTransformReference to efficiently reference the same transformation multiple times. Great e.g. to instantiate thousands of trees.
Lights using components
TCastleSpotLight. See lighting in manual.
Components to visualize terrains (
TCastleTerrain), and generate terrain data from smooth noise (
TCastleTerrainNoise) or image (
TCastleTerrainImage) or a combination of them (
TCastleTerrainCombine). See the examples/terrain.
TCastleViewport is a 2D user interface control that you can naturally use multiple times, to observe the same or different 3D / 2D worlds from different cameras at the same time.
We support standard model format from Khronos: glTF.
We support standard model format from Web3D: X3D and VRML.
Support for X3D 4.0 with Physically Based Rendering and lots of possibilities for shapes, textures, animations etc.
TCastleScene is a set of X3D nodes. We implement extended set of X3D nodes.
You can build and process scene graph of X3D nodes. Procedural generation of models, any pre/post-processing of models is possible.
We can save the X3D graph back to file in X3D format, see
You can write model conversion utilities. Our view3dscene allows to convert various models to X3D.
We support sprite sheets.
In Castle Game Engine (
.castle-sprite-sheet), Starling and Cocos2D formats.
Own sprite sheet editor to visually create sprite sheets from texture atlases.
See the platformer example - complete platformer game using sprite sheets. Also released on itch.io.
We support Spine skeletal 2D animations.
We have own Spine importer in Castle Game Engine that reads Spine JSON (not relying on any official Spine runtime).
Spine animations and rendering features are converted to standard engine animation nodes (same nodes as used by glTF and X3D) so they play consistently within the engine, with animation cross-fading etc.
Spine skins are suported.
Loading Spine JSON files from various Spine versions, up to and including Spine 4, is supported.
Spine texture atlases with all advanced options (e.g. stripping whitespace, rotating) are suported.
Alternative: Spine runtime for Castle Game Engine is an alternative approach to load and render Spine models. It supports some additional features by "offloading" some work to the Spine C runtime.
Compositing shaders to define shader effects that enhance existing engine rendering. See examples/viewport_and_scenes/shader_effects example. You can write own effects easily using OpenGL Shading Language.
Bump mapping (normal maps) using basic, parallax, steep parallax with self-shadowing algorithms.
Animation blending/cross-fading (
Physically-Based Rendering used by default for glTF and X3D 4.0 models using
Alternative unlit shading also available, with glTF and X3D 4.0 models using
Alternative "classic" Phong shading is also available using
Shadow maps (with auto-detection of limits, correct shadows from multiple light sources).
Shadow volumes (with z-fail / z-pass automatic detection, silhouette detection).
Screen effects (post-processing) API to define post-processing effects using shaders. See screen effects specification, you can add screen effects over any UI control: just place it as child of
TCastleScreenEffects. See examples/screen_effects_demo/.
Easily design background (with sky/ground gradients, skybox), fog.
Multi-sampling (full-screen anti-aliasing), just set
Occlusion Culling can greatly speed-up rendering in certain cases.
Modern approach to OpenGL and OpenGLES usage:
Using modern OpenGL (OpenGL 3.3 "core" profile).
Possibility to use ancient OpenGL (even 1.1) if we have to. To support ancient, buggy systems or virtual machines. See
TGLFeatures.RequestCapabilities for information how to test it.
We can leverage some OpenGL ES 3.0 features (for shadow maps, 3D textures, occlusion culling…), but any OpenGL ES 2.0 system works.
On desktops we can use both OpenGL (default) and OpenGLES. On mobile, naturally only OpenGLES.
Easy OpenGL debugging (
TGLFeatures.Debug allows to get rich logs and exceptions from GL).
Easily display display images as user interface or in a viewport.
Numerous image formats (like PNG, JPG, RGBE) supported thanks to the integration with Vampyre Imaging Library.
Full support for KTX and DDS that enable GPU texture compression, cubemaps and more.
User interface library providing cross-platform UI controls that work on all platforms, like buttons, labels, images.
Their look can be adjusted to match the style of your game.
Your game is organized into views. Each view can have a design (created in editor) and an associated unit where you can handle various events, like a key press.
Automatic UI scaling to adjust to any screen resolution and aspect ratio with anchors.
Powerful masks: manual, API reference, example.
Rendering text in user interface and in 3D, with customizable fonts.
Fonts can be loaded from common formats (like TTF or OTF,
TCastleFont) or images (
Localization (including automatically translating user interface and
UTF-8 support for all strings through the engine API, in particular to render text.
The engine uses URLs, allows to download contents of URLs, and can be integrated with various networking libraries.
All paths are expressed as URLs with some special CGE protocols, see nerworking.
Application data can be always accessed using URLs like
You can download URLs asynchronously using
Integration with Indy.
We have extensive optimization documentation and a number of features to help you make your game faster.
Inspector available under F8 in any debug game shows FPS profile.
Built-in simple profiler
Built-in frame profiler
Built-in texture memory profiler
DynamicBatching is available to batch multiple shapes, to conserve draw calls.
You can play sound, spatial (in 3D) or not.
Supports for various sound backends: OpenAL or FMOD, on multipe platforms.
Sound streaming is done, for efficient playback of music tracks.
WAV and OggVorbis file formats are supported with all sound backends.
TCastleSoundSource can be designed and tested also in editor.
Automatic sound source management based on priorities.
You can use physics.
Define rigid bodies and colliders on your objects.
Allow gravity and collisions to automatically have an effect.
Register events on collisions or triggers.
We use Kraft Physics Engine under the hood.
Coming soon (roadmap): designing colliders, rigid bodies and joints using code or by CGE editor. See teaser movie, 1st PR.
You can perform easily collision queries to determine… whatever you need. Just set
TCastleSceneCore.Spatial to at least
[ssDynamicCollisions] to make collision queries treat your scene as more than just a bounding box. Then use routines like
Viewport.Items.WorldBoxCollision to query whether something collides. Note that this, as of now, does not use the "proper" physics engine (like Kraft or planned Bullet), instead it uses custom octree implementation, but this will change in the future.
You can design game maps using Tiled.
Tiled maps (TMX files) can be loaded into
TCastleTiledMap for a 2D or 3D display in a viewport.
Viewport display means they can be combined with other scenes on top of it, like sprite sheets for units on the map.
We support various map types (orthogonal, isometric, hexagonal), layers (you control which layers are displayed), animations and more.
See examples/tiled/strategy_game_demo for a complete strategy game in CGE using Tiled maps.
Particle systems are not yet part of the core Castle Game Engine units. However you can use additional open-source components that add this capability to the engine:
Particle Emitter: Particle system for 3D and 2D that supports editing right inside CGE editor. Particles are calculated with GPU acceleration (transform feedback). By Trung Le (Kagamma).
Effekseer Integration: Integration with Effekseer, a full-featured open-source particle effect creation tool. Also by Trung Le (Kagamma).
The engine, as well as your games, are written using modern Object Pascal.
We support FPC and Delphi compilers, see Supported compilers and IDEs.
Pascal as a programming language is
elegant (type-safe, OOP, generics),
full-featured (big existing codebases can be used, e.g. Pascal and C, C++ libraries to connect your games with database, AI, networking),
native (compiled to native code that runs fast out-of-the-box).
To interact with a library using C++ classes (and other features that only C++ compilers understand) you generally need to write a "wrapper" library that exposes the equivalent API in plain C. This is exactly the same as trying to use C++ library e.g. from C#.
The same programming language that is used to make the engine is used for your applications — this results in simplicity (it’s easy to contribute) and speed.
Fast execution. It’s a language that compiles to fast native code, while staying elegant and type-safe.
Native debugging. It’s just a native application using native debugger. Debugging is integral part of the Lazarus IDE.
Build tool to manage your project from the command-line or in batch mode (good for continuous integration). The build tool, just like editor, reads project information from CastleEngineManifest.xml file.
Build tool can build, package, run your application and autogenerate compressed textures (and more).
You can build for any supported target platform. You may need to install cross-compiler (e.g. using fpcupdeluxe), some platforms may also require additional tools (see their docs like Android).
We can build ready applications, like APK / AAB for Android, IPA for iOS.
Docker image with CGE and prerequisites (FPC, Android build tools, texture processing tools) to easily build CGE applications.
Ready instructions to automatically build CGE projects using:
Enjoy modern continuous integration, for free, however you host your code!
The engine is licensed on "LGPL with static linking exception" license, similar to FPC and Lazarus standard libraries.
In short it means that you can create commercial closed-source applications with it without any issues.
See license for details.
To improve this documentation just edit the source of this page in AsciiDoctor (simple wiki-like syntax) and create a pull request to Castle Game Engine WWW (cge-www) repository.