New Delphi packages organization and “Tools->Castle Game Engine” menu in Delphi IDE

Posted on

Delphi IDE Castle Game Engine menu
Castle Game Engine 3D in Delphi FMX form
Castle Game Engine 3D in Delphi VCL form
  1. Our Delphi packages have been reorganized to better support all the platforms supported with Delphi (Windows, Linux — watch out for the next news post!). The new Delphi packages are:

    • castle_engine.bpl with the base engine units. Not dependent on VCL, not dependent on FMX, not using TCastleWindow.

    • castle_engine_vcl.bpl with the engine code dependent on VCL (Windows-only). In particular it registers TCastleControl component you can drop on a VCL form.

    • castle_engine_fmx.bpl with the engine code dependent on FMX (cross-platform). In particular it registers TCastleControl component you can drop on an FMX form.

    • castle_engine_window.bpl with TCastleWindow class and friends. It is a key to use TCastleWindow in your own applications, which is a great approach when you want to create a typical game using CGE, with everything (including UI) designed using CGE.

    • castle_engine_design.bpl contains additional design-time features for CGE components. In particular, the new menu we talk about lower in this news post.

    Follow the installation instructions for the new Delphi packages.

    We also have more internal (mostly for engine devs) details about the packages in the repository.

  2. A connected new feature is that Installing our Delphi packages, aside from registering the TCastleControl for FMX and VCL, also adds to Delphi a new menu items in the “Tools -> Castle Game Engine” submenu. These provide some useful integration between CGE and Delphi IDE:

    • You can open CGE editor on the current project.

    • You can add CGE paths globally to the Delphi IDE using the menu item “Configure Delphi to Use Engine”.

      We advise this, as a simplest way to have CGE units available for all your projects. It extends the “Library Path” for all the platforms you have, adding there source directories for all CGE units. This way CGE source code is available to all your projects, and CGE units will be compiled and linked with your projects that use any CastleXxx units.

      After using it (and restarting Delphi IDE!) you can inspect what it did by looking at “Tools -> Options -> Language -> Delphi -> Library -> Library Path”.

      There’s a corresponding menu item to revert this configuration change, if you want.

    • You can add CGE paths to the current project, platform, and config (debug / release). This is alternative to using “Configure Delphi to Use Engine”, less advised, but makes sense if you really want to avoid changing your Delphi settings.

      See the docs for more details.

    • Necessary DLLs will be automatically deployed alongside your EXE file, if you build a project with CastleEngineManifest.xml from Delphi IDE. These DLLs follow the declared <dependencies> of your project along with some auto-detected dependencies (e.g. we automatically deploy OpenAL DLLs if your project includes sound files in data).

    • You can set CGE root path (this is used by above commands — to know where CGE sources are, where CGE editor is). Note that this CGE path stays only in Delphi IDE — we deliberately do not set some system environment variable or other config (read by other tools) to keep things simple (by being independent), at least for start.

    • Finally, we feature easy links to CGE documentation, API reference and Patreon.

    We recommend all Delphi users to follow the Delphi packages installation procedure, install the packages and use the “Set Engine Path…” and “Configure Delphi to Use Engine” menu items.

    Note that this work may allow us to remove a deprecated feature from our auto-generated DPROJ files (done if you set up the project using CGE editor). Right now, the DPROJ contains the paths to all CGE units, absolute — so they only work on your machine, and are not good for sharing your project in a version control system. We plan to simply stop adding these paths to new projects in the upcoming future. The idea is that all Delphi developers who use CGE should just use “Configure Delphi to Use Engine” on their machine, once.

  3. If you are interested in developing Delphi IDE extensions, you may find it useful to also take a look at our test project Delphi IDE design-time features tests. This is a small, independent of CGE, piece of Pascal code demonstrating how to extend Delphi IDE — adding new menu items, changing project and global options. We used it as a “test bed” to develop the CGE integration, and it may be useful for you too.

Start the discussion at Castle Game Engine Forum