Current Delphi package in engine/packages question

Hello, I just would like to ask about Delphi package that is currently obtained in the engine in packages/delphi. If I understand correctly, this package is the start of the Delphi “conversion” for the engine? Should it be compilable in its current state? I am trying to port the 6.5 version as a university project kind of(also quite new to Delphi), and I was wondering if it should be a starting point, in the means that the Delphi packages should “copy” the packages like for the Pascal. As in the current base.dproj file there are few units, but in the base package for Pascal there are like tens of units that I assume are the units that should be converted to Delphi and obtained in the project for base package and the I think window package that is needed for engine to work properly? Just trying to make sure if I am correct, or wrong in something. Thanks for the reply.

Yes, the current packages/delphi/castle_base.dpk is a start. It is a package you can install in Delphi. There is also example project (just a very simple command-line thing) in examples/delphi/base_tests/.

Yes, they should compile in Delphi (pretty much any late version, also Community Ediiion). Although admittedly I didn’t check it since a long time. It is possible I broke compatibility with Delphi in some minor way, even for these base units – that’s probably easy to fix. Help is most welcome.

For FPC/Lazarus we have Jenkins set up to make sure they always compile, but I just didn’t set this infrastructure for Delphi yet.

Indeed the full CGE is much much larger than what is currently in Delphi base package and what is used by test in base_tests. We do have some work ahead for Delphi compatibility.

If you want to help with porting new units, it is most welcome, but I have to say that there are a few hard decisions where I will want to do some research myself to make best decision. E.g. X3DFields unit uses generics in a way that most probably doesn’t work with Delphi – I will have to investigate how to handle it best. Ideally the generic usage could be adjusted.

As for window – we will want to port to Delphi both approaches,

  • TCastleWindowBase (castle_window Lazarus package) – our own class that creates a window with OpenGL context, and gives us complete control over the game loop,

  • TCastleControlBase (casle_components Lazarus package) – our class that creates an OpenGL context within VCL and/or Fire Monkey form, and allows to easily “drop” CGE rendering into an existing Delphi application.

Which one should be the start? I planned to start with TCastleWindowBase. It will mean dealing with small Windows API incompatibilities (between Delphi and FPC headers), but then should be easier, getting reliable window to render.

In general, if you plan to do serious work on helping with Delphi compatibility – you are most welcome and I’m happy! But also: please do consult with me :slight_smile: There are some difficult questions along the way, where I’ll definitely want to have an input :slight_smile:

I just had a chance to test CGE with Delphi 10.4.

As expected, I did some breakage in last months, but it was trivial to fix :slight_smile: The latest CGE from GitHub now builds OK with Delphi 10.4,

  • examples/delphi/base_tests/base_tests.dpr compiles and works OK,
  • packages/delphi/castle_base.dpk compiles OK.

Waiting for good news.