Contents:
Read on for details!
We support many formats for 3D and 2D data.
We focus on full support of glTF and X3D model formats. They are both open standards to define 3D models with lots of features.
Our scene graph is using an extended set of X3D nodes to define the content to be displayed.
We are designed as a general-purpose 3D / 2D engine, and support lots of model formats: glTF, X3D, Spine JSON, VRML, Collada, 3DS, Wavefront OBJ, MD3, STL....
Our manual describes a lot of ways to use 3D and 2D objects, for example see simple loading of 3D models.
You can use various 3D and 2D authoring software to design your models. Blender, 3ds Max, Maya, Spine... That is thanks to our support for many model formats, and focusing on open model formats.
All your animation needs will be satisfied.
PlayAnimation
.
We can save (aka "serialize") the current state of the world to an X3D file, which can then be read back by our engine. You can use it e.g. to make a full-featured 3D editor on top of our engine! See TCastleSceneCore.Save and Save3D for basic methods to do this.
Various conversions between 3D model formats and even some editing capabilities are provided out-of-the-box by our tools.
Reading and writing of images in various formats, processing them and using as OpenGL textures. Besides many common image formats (PNG, JPG, PPM, BMP, and much more), included is also support for Khronos KTX and DDS (textures with compression, mipmaps, 3d, cube maps) and RGBE format (Radiance HDR format). See:
Handling of fonts. We can read fonts in many formats (like .ttf) using FreeType library, and render them at any size, with anti-aliasing or not. Fonts can also be embedded inside a Pascal source code, which allows us to provide default fonts (available as-is), and to use fonts even when FreeType library is not available. You can also use colorful fonts from a texture. Font rendering allows international characters in UTF-8. See manual about text and fonts and unit CastleFonts.
You can compile and package your games for various platforms:
It's easy to compile the same game to many platforms.
We have a build tool to make it easy to compile and package your games. Creating complete, ready-to-be-released Android and iOS applications is trivial. We can automatically generate an Android APK, iOS XCode project or IPA file and more.
Trivial to use integration with many services on Android: games (achievements, leaderboards), in-app purchases, ads, sound, vibrations, and much more. See Android Project Services documentation.
Trivial to use integration with many services on iOS, like Apple Game Center, in-app purchases, Facebook SDK, Google Analytics and Game Analytics.
The engine can be compiled into a library useful from other programming languages.
This does not expose the complete engine API (for now), but it does expose a simple 3D model loading,
rendering, animation, interaction. So you can e.g. make your own VRML / X3D browser.
We have an example in engine sources examples/library/qt_library_tester/
that shows how the engine can be embedded in a C++ Qt application.
Viewport is used for centralized world handling, with multiple viewports observing the same world possible.
Shadows by shadow maps. Our shadow maps are very comfortable to use, and shadows from multiple light sources are correctly rendered. We also have experimental Variance Shadow Maps implementation.
Shadows by shadow volumes (full implementation, with z-fail / z-pass switching, silhouette detection etc. — but for now limited only to a single light). See shadow volumes documentation.
Bump mapping (normal maps), specular maps, shininess maps and more are avaiable. Our custom Blender X3D exporter can automatically generate the necessary information. Various bump mapping algorithms are implemented: from the classic bump mapping (take normal from the texture), up to the steep parallax bump mapping with self-shadowing.
Shaders:
ComposedShader
or enhance with Effect
, see links above).Screen-space effects in GLSL are very easy to define and use, in pure X3D or in Pascal code.
Many texturing features:
Speeding up rendering by hardware occlusion query, a simple approach and more involved Coherent Hierarchical Culling. See UseOcclusionQuery, UseHierarchicalOcclusionQuery properties.
Anti-aliasing (by OpenGL multi-sampling), see AntiAliasing property.
Gamma Correction and Tone Mapping are available. For Physically Based Rendering materials, gamma correction is applied by default.
We have a comfortable and extensible implementation of viewport and objects. You have a ready implementation of levels, creatures (with AI), items, players and other things typical to 3D games.
Engine manual contains detailed information about this.
3D and 2D. Not everything is about 3D. Our API is perfect for 2D games too, with flexible (and pixel-perfect) rendering of 2D images, movies, text and everything you can compose from them (like GUI controls). We also support Spine which is very cool for creating 2D animations.
Rigid body physics. We are integrated with a powerful Kraft Physics Engine and you can easily use dynamic physics in your games.
Octrees are used for various collision detection tasks. For dynamic scenes, a hierarchy of octrees is used, allowing accurate and fast collision detection even when the scene constantly changes. There are many ways to use collision detection, for example you can query for collision between a specific TCastleTransform instance and the rest of the world (by methods like TCastleTransform.Move, TCastleTransform.Ray TCastleTransform.Height) or you can ask the whole world whether it collides with some geometric shape (calling methods like TCastleTransform.BoxCollision, TCastleTransform.SphereCollision TCastleTransform.RayCollision on the root transformation: Viewport.Items).
Includes X3D integration ("Sound" component of X3D specification), so content creators can define sound sources themselves.
By default it uses full-featured and open-source OpenAL. You can also use FMOD backend.
view3dscene tool to view and inspect your 3D models, before loading them in your game.
2D controls (buttons, panels, tooltips, on-screen menus etc.) are available. Customizing their look is very easy. Also creating your own 2D controls, using smartly stretched images and text, is very easy. Good for games, where making a custom-looking GUI (that fits with your game theme) is important. See CastleControls unit.
Although the main focus of the engine is real-time rendering, we have also implemented a software ray-tracer, just to show that it's possible! Two ray-tracing algorithms may be used: deterministic (classic Whitted-style ray-tracer) or Monte Carlo path tracing. All the engine 3D formats are supported, with smooth normals, textures, reflections, shadows... See the gallery and the CastleRayTracer unit.
Playing movie files. This includes loading and saving as image sequence or "real" movie files (ffmpeg is needed to encode / decode movie files). While the implementation is limited to a small movies for now (as memory consumption is large), it's perfect for flame or smoke animation in games. We even have a simple movie editor as an example program in engine sources. See TVideo, TGLVideo2D and related classes.
You can read maps designed using
Tiled Map Editor.
A default visualization (as a 2D control) is included in the engine,
but you can also read the map information and display it on your own,
in 2D or 3D. See the examples/tiled/
in the engine code.
You can convert a spritesheet from Cocos2D or Starling formats into X3D.
See the program tools/sprite-sheet-to-x3d
distributed
as part of the engine.
We have many example programs. Browse the engine
castle_game_engine/examples/
subdirectory.
For even more examples, see
some larger
games we have developed using Castle Game Engine and their
sources (for example on GitHub
Castle Game Engine organization).
We have ready window classes (TCastleWindow
)
and Lazarus components (TCastleControl
) to make simple
3D model browser, on a Lazarus form or independent from Lazarus LCL.
The engine is integrated with Lazarus —
we have various Lazarus components.
Engine components are independent when possible.
For example, you can only take model loading and processing
code, and write the rendering yourself. Or you can use our OpenGL rendering,
but still initialize OpenGL context yourself (no requirement to do it
by our CastleWindow
unit). And so on.
Of course, ultimately you can just use everything from our engine,
nicely integrated — but the point is that you don't have to.
Engine can be used to develop natively-looking tools, not just OpenGL games, since our OpenGL controls integrate with any GUI library (Lazarus LCL, GTK, WinAPI, Carbon...). You can embed the engine in a normal GUI program. You can use multiple OpenGL controls and windows visualizing (the same or different) game world. There are also various classes for processing 3D data without any rendering (like TCastleSceneCore), these are of course useful too (e.g. to write ray-tracers).
The engine is developed for the Free Pascal Compiler, an open-source cross-platform compiler. We have Lazarus components for RAD development, although the core engine doesn't depend on Lazarus LCL and you can develop full games with pure FPC (we have our own OpenGL window management unit, if you want). The whole engine is 100% clean Object Pascal code.