1. Introduction

We support Delphi, a powerful commercial Pascal IDE and compiler.

Any Delphi tier, including free Delphi Community Edition, is fine.

We are an official Embarcadero Technology Partner. This means that Michalis Kamburelis and Andrzej KilijaƄski have full access to the latest Delphi version, with all the Delphi platforms (including Android and iOS), for free. For testing CGE compatibility.

If you like Delphi compatibility, and want to see more of it (e.g. more platforms or Delphi-specific integration tools), please voice your needs and if you can — support us on Patreon!

Castle Game Engine API in Delphi Castle Game Engine and Delphi

2. Configure Castle Game Engine to use Delphi

In Castle Game Engine editor, open "Preferences" dialog. In both the "Code Editor" and "Compilation" tabs set "Delphi", if it was not auto-detected already.

That’s it. CGE editor is now integrated with Delphi. You can test it:

  • Press F9 to compile the project from CGE editor (using CGE build tool which will use Delphi command-line compiler under the hood).

    In case of Delphi Community Edition: It doesn’t have command-line compiler, so you have to compile the project using F9 from the Delphi IDE.
  • Double-click on Pascal files to open them in Delphi.

  • Use "Code → Open Project in Code Editor" menu item to open project in Delphi.

3. Presentations

4. Platforms supported with Delphi

  • Right now we support only Windows (both 32-bit and 64-bit).

  • Other platforms will come, most likely Android and Linux (talk to us on #delphi on Discord about the progress). The Delphi+Linux branch is actually in progress already, with lots of Delphi improvements along the way. (It also adds dglOpenGL usage.)

  • You can use TCastleWindow, which is our standard way to create CGE window. Our "New Project" templates as well as most examples use it.

  • You can alternatively use TCastleControl that allows to put CGE rendering on FMX (FireMonkey) or VCL form. See here for details.

5. Delphi versions supported

  • The engine is tested and supported on all Delphi versions >= 10.2.1. It was actively tested on 10.2, 10.3, 10.4 (including CE), and all Delphi 11 editions (including 11.3 CE).

  • In the future, we could support Delphi versions >= XE 7.

    Adjusting to Delphi XE 7 seems to require only a few local changes (see XE7 test, 10.0.1 test, 10.1.2 test).

    We do not plan to support older Delphi versions. They are really old (Delphi XE6 is from 2014) and would require more work (see XE4 test). It doesn’t seem wise to spend resources on maintaining (making and testing) compatibility with these ancient Delphi versions.

  • We will not support Delphi versions older than 10.4 for mobile (Android and iOS).

    Reason: The older Delphi versions have crazy compatibility-breaking change to String handling on mobile: strings are 0-based (but only on mobile!, on desktop they remained 1-based) and Embarcadero/Idera recommended way forward was to use TStringHelper, with all operations 0-based, and maybe treat strings as immutable.

    This is documented now in Zero-based strings (Delphi). In the past page Migrating Delphi Code to Mobile from Desktop (for Delphi XE7) had a longer section "Use 0-Based Strings".

    Adjusting to this would mean rewriting all String handling code in the engine to use new TStringHelper. And it would be quite risky task — as the global String routines remained available for mobile, but they were nearly useless for cross-platform code, as they would use 1-based on desktop and 0-based on mobile. Thus causing hard-to-find bugs, as the same code would compile everywhere, but would work differently between desktop and mobile.

    We’re happy that Embarcadero backed off from this weird decision in later Delphi versions. See Delphi 10.4 (Sydney): Zero-based strings (Delphi). In particular it says "In general terms, string indexing is now uniform across platforms and uses 1-based index model." and "Default" is "`{$ZEROBASEDSTRINGS OFF}` for Delphi desktop and mobile compilers".

To improve this documentation just edit this page and create a pull request to cge-www repository.