![]() |
We have a number of improvements to announce, so welcome to another “bag of improvements all around the engine” news post! Take a look around, see if you find something you like 🙂 As usual, all the announced improvements are already part of the latest downloads.
TCastleComponentFactory
is now a non-visual component registered in the editor, so it’s easier to use it. You can just add the factory instance to your view, point it usingTCastleComponentFactory.Url
to the design that you want to spawn multiple times, and then from code useTCastleComponentFactory.ComponentLoad
to spawn multiple instances of the same thing.For examples using
TCastleComponentFactory
like this, see examples/audio/game_3d_sound (theTntFactory: TCastleComponentFactory
) or simple_3d_scanning_fun from conference-pascal-cafe-2025 (theFactoryGamepads: TCastleComponentFactory
).There are more examples in the engine using
TCastleComponentFactory
, though some createTCastleComponentFactory
by code. Like examples/space_shooter. This approach is also of course fine (it is always OK to create in code what can be done in the editor), it depends on what is more comfortable in given case.-
We have upgraded Kraft, our physics engine to follow the latest developments done by Benjamin “BeRo” Rosseaux. This brings new optimizations and features (see below).
The upgrade is quite substantial, from version last synchronized on 2019-08-26 to 2025-03-10. We hope to keep in-sync more often in the future, which should be easier because we isolated most of our customizations to separate files like castlekraft.inc and castleinternalkraftoverrides.pas. Our changes revolve around adjustments to platforms and compilers not supported by Kraft, like web, Delphi on Linux or Nintendo Switch. Some of those rely on linking Kraft with some CGE utilities, e.g. for time.
-
Following the Kraft upgrade, we expose a new method in Castle Game Engine: casting a sphere using physics. See
TCastleAbstractRootTransform.PhysicsSphereCast
,TCastleRigidBody.PhysicsSphereCast
. This is similar to casting a ray, but now you move an imagined sphere in a certain direction.This is great for implementing navigation using physics. And it synchronizes our “master” branch with the new physics-based navigation components developed by Andrzej Kilijański. Effectively, we have merged part of this PR into master, with some changes and newer Kraft.
And yes, this means that eventually merging these new physics-based navigation components is closer now. We still want to do some work first (I outlined next TODOs in this comment), but we are getting there. Of course tests are welcome, and if you’re impatient you can also just try to use the components from the PR 🙂
Aside from this PR, a simple example using
PhysicsSphereCast
is already available in the engine as part of examples/viewport_and_scenes/collisions. -
More physics improvements? Sure 🙂 Our
TCastleAbstractRootTransform.PhysicsRayCast
,TCastleRigidBody.PhysicsRayCast
methods have been extended to support layers. They just get an additional parameterCollisionLayers: TPhysicsLayers
, by defaultAllLayers
. Customize it to test for collisions only with a subset of your bodies.This also synchronizes our work from 2 branches, the new navigation components and hit-api-upgrade. Our master branch gets new features, and other branches get closer to master 🙂
-
Thanks to Vlad (phomm) you can now disable compiling-in support for some formats that you don’t need, to reduce the exe size of your applications. See how to use the
CASTLE_xxx_SUPPORT_DISABLE
symbols.See also PR for more details how much you can gain and why. And also for some thoughts from Michalis “decision paralysis” where I wondered should be do it this or that way 🙂
-
We fixed iOS building and TestFairy integration. Ups! Without oversight of the CI/CD such mistakes can happen. I added to TODO to make automatic test of iOS building through GitHub Actions soon.
This has been done as we work on Mobile Castle Model Viewer version for iOS! Stay tuned for more details.
-
Our build tool
unused-data
analysis can now optionally remove some unused files.Please heed the warnings there before using it! In short, keep your stuff in a version control 🙂 Which is in general a good idea anyway.
-
We have improved some functionality around images:
- You can now load image created in code to
TCastleImageTransform
usingTCastleImageTransform.LoadFromImage
. -
We have
TDrawableImage.Create
overload to create a drawable image with undefined initial state. Just provide the size and format, no need to provide initial contents asTCastleImage
instance. Great if you want to fillTDrawableImage
with something later. -
We added new example showing how to draw on an image efficiently and use the result as a texture: examples/images_videos/image_generate_and_use. This demonstrates the 2 above new features, and also presents our recommended way to draw on images using
TDrawableImage
, with GPU acceleration, with complete rendering features.
- You can now load image created in code to
-
Finally, we have made
UrlEncode
andUrlDecode
public. Useful to construct URLs to arbitrary files, seeTCastleZip.Files
for example. -
BTW, Delphi users, Delphi 12.3 is available and of course our engine was tested and works flawlessly with it. Don’t hesitate to upgrade 🙂
OK, and this is not everything. We still have a number of web and IFC improvements to announce in upcoming dedicated posts. And a new release of our Android apps are in-review. Stay tuned for more!
And if you like what we do, please consider supporting us on Patreon. We count on your support to keep the engine development active. Thank you!
P.S. As I didn’t have a perfect image for this news post, I typed “improvements” into Sketchfab and run with it 🙂 The screenshot shows “Mars One” Mission 3D environment modeled by Admone and displayed using our Castle Model Viewer.
The sphere cast is something that immediately got my attention. Typically, in a 3d game players can interact with stuff - from opening the doors to picking some herbs. Thanks to the sphere instead of a single ray it’s now possible to select things that are in a general direction of where the player is looking, without the need to look directly at the item (or casting multiple rays if nothing’s hit). Also shooting from a weapon or casting a fire ball can be less tedious now, so this update made me happy.
Also the TDrawableImage is a nice & easy solution for situations where a texture is dynamically created or changed. For example, a sign on a shop with player’s custom text / image. Maybe even someone make a game for artists - like painting Monalisa on a virtual canvas.
Plus, you didn’t forget about Delphi users! I don’t need oxygen or H2O as much as I need Delphi to live.
Thanks a lot for all these little big things
How much size is saved by disabling all of these? I don’t have a problem with my current exe size (around 10meg for the client and 10meg for the server), but my prior prototype was well over 100megs, though I am not sure why since it didn’t do that much more. I won’t need much from external content as I want to build most everything in the game parametrically.
Is there a gofundme to clone you?
@edj Hi, I described the size gain here User defined Disable of media formats, allows to shrink binary file by phomm · Pull Request #670 · castle-engine/castle-engine · GitHub
when I enabled only gltf and spritesheets (which I need for my game) I gained 2. 5 mb in release exe
I see @phomm already answered the main question, about possible gain.
As for 100 MB, be sure to compare the same platform and only “release” builds. Debug builds can be much larger.
We’re working on it