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.

1 Like

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.

Hi again, sorry for the few months delay but I had a lot of duties and very little time. I have seen that some work have been done on delphi compatibility in here - Delphi Port (WIP) by and3md · Pull Request #338 · castle-engine/castle-engine · GitHub. For the next few months I can finally help with porting, so I would like to ask what should be my starting point basically now, when you have started with porting. I was thinking that I would take the PR as starting point and start fixing things that might not work yet, and then continue with porting other modules here. Dont know if you guys have any plan besides the steps listed in PR or how you would imagine the next process.

Hi,

Status:

  • Andrzej Kilijański is working on Delphi Port (WIP) by and3md · Pull Request #338 · castle-engine/castle-engine · GitHub constantly, to make 100% CGE units compileable by Delphi (right now he’s on X3DNodes). With the goal to finish things for TCastleWindowBase + Windows ASAP.

  • I’m working on the PR too, to add secondary things: integrate with Delphi from CGE editor and build tool, test non-Windows platforms (we have access to Delphi Enterprise and can test all platforms, including Linux, Android, iOS).

We’ll give a presentation about it on upcoming DelphiCon in 2 weeks, you can register for free using Castle Game Engine - Coming to Delphi! - DelphiCon 2021 by Embarcadero .

To be honest there are no particular next steps where you can help right now. As multiple things are in progress by Andrzej or me for now :slight_smile: You are most welcome to:

For anyone that finds this thread by searching the Internet: Castle Game Engine works with Delphi now, for a long time :slight_smile: See Supported compilers and IDEs | Manual | Castle Game Engine .