Supported compilers and IDEs

Castle Game Engine icon

1. FPC and Lazarus

We support Free Pascal Compiler (FPC) version >= 3.2.0.

We always support and advice the latest stable release of FPC. Usually, we also support a couple of older FPC releases.

We use some modern Pascal features (like generics) in CGE, so we occasionally bump the required FPC version. We check what is commonly available, e.g. what is in the latest Debian stable (which is a baseline for many other Linux distros). Last time, on 2021-12-12, we bumped required version for Castle Game Engine 7.0-alpha.snapshot from FPC >= 3.0.2 to FPC >= 3.2.0.

For Aarch64 (64-bit Arm), as found on Android, iOS, macOS: While we support any FPC >= 3.2.0, we strongly advise FPC >= 3.2.2. That is because certain optimizations have been broken in older FPC versions. Our build tool disables optimizations in released builds when it detects Aarch64 and older FPC.

You may also find it comfortable to use Lazarus, which is an IDE (editor, debugger etc.) built around FPC with a visual classes library (LCL). Our engine can be used together with Lazarus form (LCL) though for most applications we recommend using TCastleWindow independent from LCL.

Hint: If you want to install multiple versions of FPC/Lazarus (stable, unstable, NewPascal), with cross-compilers, it is easily possible with fpcupdeluxe.

1.1. If you use sparta_Docked package

Some FPC libraries, like sparta_Docked or sparta_Generics, may contain their own copy of Generics.Collections unit and friends.

FPC >= 3.2.0 doesn't need them (it contains the Generics.Collections and friends, with the same implementation from Maciej Izak). In case of CGE, we didn't need them even for FPC 3.0.x, and CGE included our own copy of Generics.Collections.

Solution: Remove Generics.Collections and related units from any sparta_xxx or other packages. FPC includes them already. Report to authors of these packages that these units create conflicts with FPC >= 3.2.0 standard units.

1.2. If you use FPC development version (from GitLab)

We generally try to support using the latest (unstable) FPC development version to compile CGE.

You can get such FPC:

Of course please remember that this FPC version is unstable, and it changes with every commit to FPC. We cannot test or guarantee that CGE works with an arbitray FPC development revision. But we welcome testing such FPC. PRs to make CGE work with latest FPC trunk are also welcome (unless there's a temporary bug in FPC which should be rather reported to FPC devs).

On Aaarch64 (important on mobile platforms): Note that if you use FPC 3.3.1, we assume that it is at least from SVN revision 48104. See Trello ticket about Aarch64 optimizations. The optimizations are disabled on Aarch64 with FPC < 3.3.1. With FPC >= 3.3.1, we assume it is from at least SVN revision 48104, and has Aaarch64 optimizer bugs fixed.

2. Delphi

We support Delphi.

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

The support is available in the master branch of CGE, so you should just download the latest CGE release from the main page. (You can also download sources of course and compile the engine yourself — note that you will need FPC/Lazarus for this too.)

See the presentation:

We are an official Embarcadero Technology Partner. What this means, in simple terms, is that Michalis and Andrzej 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 platforms, please show your support by subscribing on Patreon!

2.1. 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). I did make initial attempt at Linux and I know it's possible, just needs more work, e.g. importing cross-platform OpenGL units like dglOpenGL.

  • 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.

2.2. Delphi versions

  • We test on 10.4 and 11.

  • In principle, any Delphi version >= 2009 (with generics support) should be OK.

    We welcome reports (of success or failure) if you use Delphi version between 2009 and 10.4, and tested CGE with it. If you get a compilation error or any other issue, please report it with details — post a screenshot, post copy-pasted (exact!) error message and so on.

  • 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. See Delphi XE7: Migrating Delphi Code to Mobile from Desktop: Use 0-Based Strings.

    This would mean completely rewriting all our String handling code in the engine. 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 {$ZEROBASEDSTRINGS OFF} for Delphi desktop and mobile compilers..

3. Code Typhon

We do not support using Code Typhon (a fork of FPC/Lazarus).

I (Michalis) strongly advice that you should rather use original FPC and Lazarus. I have much more trust in FPC and Lazarus developers doing great quality job, respecting copyrights of other projects (CodeTyphon did some murky things), and working in a transparent fashion (version control, cooperating with other projects).

Note that Lazarus comes now with Online Package Manager. And you can use fpcupdeluxe to easily install cross-compilers. I mention these, in case your reason for using Code Typhon was to get such features.