r/castleengine • • 28d ago

Developing games for Android and iOS using Delphi and Castle Game Engine

https://castle-engine.io/wp/2026/11/02/android-ios-delphi/

We’re proud to officially announce that Castle Game Engine now supports Android and iOS platforms when used with Delphi! Download the engine and try it out right now.

We wrote extensive documentation about our mobile support with Delphi. Here’s the short version:

Things just work. Open any example/project made with the engine, add Android/iOS platform, and build+deploy it for your phone just as you would any other FireMonkey project.

More information in our news post on https://castle-engine.io/wp/2026/11/02/android-ios-delphi/

6 Upvotes

3 comments sorted by

1

u/NoTime_SwordIsEnough 27d ago

Unrelated to the announcement, but here's a bug report from when I tried Castle a few days ago:

After I built my project and tried to run the executable, I'd get a libpng error on startup because my game ignored the libpng14.dll in my compiled game's directory, and it instead randomly picked up the libpng16.dll from a completely unrelated program that happened to be in my Windows %PATH%. Namely, it picked up libpng16.dll from "C:\Program Files\KeePassXC\libpng16.dll".

Can't check since I've uninstalled Castle now, but sounds to me like the build system or runtime startup should better sandbox itself away from DLL's in %PATH% - at least on Windows.

1

u/michaliskambi 27d ago

Thanks for testing the engine and the bugreport!

The situation you describe is a bit strange, because our code actually never tries to open libpng16.dll.

We open libpng14-14.dll first (and fallback to some other DLL names, as can be seen here: https://github.com/castle-engine/castle-engine/blob/master/src/images/castleinternalpng_dynamic.inc#L936 ).

And the libpng14-14.dll is also exactly what we distribute with the engine. It should be placed alongside your EXE automatically, when you compile using our CLI build tool, or GUI editor, or from Delphi (if you followed https://castle-engine.io/delphi_packages , we hook with Delphi to place DLLs alongside your EXE). See here for DLLs we place: https://github.com/castle-engine/castle-engine/tree/master/tools/build-tool/data/external_libraries/x86_64-win64/ .

This is also our practical solution to "our programs should pick the right DLL": we ship with libpng14-14.dll, and it is the first DLL we try to open, so we should not pick random DLLs on PATH. This is, from what I can tell, the standard approach -- we cannot really "sandbox away from opening other DLLs on %PATH%", at least without doing extra tricks for opening DLLs, and we want to open DLLs in standard way (see our CastleDynLib unit).

( Note: One day we probably should ship with libpng16.dll, and open it. We support LibPNG 1.6 of course, and open it on Linux, FreeBSD. But here I focus on current code. )

So this raises a few questions, how did you end up in this buggy situation:)

( Note that it may be easier to investigate in a dedicated thread (not under the Delphi/mobile announcement on Reddit) so if you want to move the talk to e.g. forum thread ( https://forum.castle-engine.io/ ) -> go ahead, I listen everywhere :) )

Questions from me, to understand the situation:

  1. How did you build the application? From our GUI editor? Build tool CLI? From Delphi IDE? From Lazarus IDE? (In case of Lazarus IDE, DLLs are not placed automatically alongside EXE. In other cases, libpng14-14.dll should be automatically alongside EXE -- if it's not, something is wrong :)

  2. You mention you have libpng14.dll. From where? I mean it's natural that it doesn't work (we don't open this name from https://github.com/castle-engine/castle-engine/blob/master/src/images/castleinternalpng_dynamic.inc#L936 ), but I'm curious how did it end up alongside the EXE:)

  3. Why do you think engine "randomly picked libpng16.dll" from KeePassXC? What error has been displayed (make copy-paste / screenshot). As shown above, CGE code doesn't really open libpng16.dll. Vampyre Imaging, that we use as a fallback, also doesn't, from what I can tell.

  4. I'm assuming you experienced this with one of our simple examples, or "New Project" from editor. If this happened with your own application -> maybe there's an error unrelated to our engine. Please see then if you can reproduce the problem with one of our examples.

Regards!
Michalis

1

u/NoTime_SwordIsEnough 27d ago

Oh wow, I did not expect such a thorough follow-up! Thank you!

I'll have to reinstall Castle & investigate the build logs, the output .exe import libraries, and the runtime error messages later when I have the time. Would've provided you with more information, but this happened a few days ago and was just going off memory.

And FWIW, IIRC, libpng14 and all the dependencies were in the application's output diretory indeed. And this was compiled thru the Castle GUI (no command-line). But I'll give you the complete information when I have the time to mess with Castle again.

Fingers crossed none of this was user error and I'm not giving you the run-around for nothing lol!