Castle Game Engine icon

Getting Started

1. Using Castle Game Engine Editor

  1. First install Lazarus with FPC.

  2. Download the Castle Game Engine, version >= 6.5. Unpack the engine ZIP wherever you like.

  3. Inside the unpacked castle_game_engine, you will find a subdirectory bin. Run the castle-editor executable inside.

  4. Open your project or create a new one, and Compile / Run / Package it using the editor Run menu.

    Alternatively compile / run / package from the command-line, using our command-line build tool.

    In either case, the project configuration is defined by a CastleEngineManifest.xml file.

  5. Try engine examples! They are in the examples subdirectory. Almost all engine examples have a CastleEngineManifest.xml and can be build using the editor (or command-line build tool).

    Note: Right now, only some engine examples have UI designed using the editor. Although we advice using the editor to design UI of all future games. Open e.g. examples/tiled/strategy_game_demo for a demo designed using the editor.

The editor executes under the hood our build tool which in turn executes under the hood FPC (and some other tools, depending on the platform).

The editor and build tool can be used to compile / run / package applications that do not depend on LCL (Lazarus Component Library). This means that you should initialize your game window using the TCastleWindowBase class. Our documentation and most examples follow this approach too.

2. Using Lazarus

To use Lazarus for development:

  1. Open and compile the package castle_base.lpk You will find it in the castle_game_engine/packages/ subdirectory. Use the Lazarus menu item "Package -> Open Package File (.lpk)" to open the package file, press "Compile" in a dialog that appears.

    castle_base: Open Package File castle_base: Choose the file castle_base: Compile
  2. Then open and compile the package castle_window.lpk.

    Note: do not install the castle_window package.

    castle_window: Choose the file castle_window: Compile
  3. Finally, open and install the package castle_components.lpk. In the package dialog, the option to "Install" package is under the "Use" button.

    castle_components: Choose the file castle_components: Install castle_components: Confirm Lazarus rebuild

Once castle_components.lpk is successfully installed, Lazarus restarts, and you should see the "Castle" tab with our components.

You're done:) Now compile and run from Lazarus any engine example. Open the project file (xxx.lpi) using Lazarus, and compile and run. A good examples to try at the beginning are examples/fps_game/fps_game.lpi and examples/lazarus/model_3d_viewer/.

From Lazarus, you can use the engine integrated with Lazarus forms (and the rest of the Lazarus Component Library) through the TCastleControlBase class. Or you can use Lazarus only as an editor and debugger, and use the engine without the Lazarus forms, initializing the window using the TCastleWindowBase class.

fps_game: Open Project fps_game: Choose the file fps_game: Run fps_game: Running!

Watch the movie showing the Lazarus installation process.

Another option is to build and install the engine using FpMake.

3. Install the libraries

Programs developed using our engine use some extarnal libraries.

  • On Windows the libraries (DLL files) are in the downloaded engine archive.

    If you use our editor or build tool, the DLL files will be automatically copied alongside your EXE file, so you don't have to do anything.

    If you use some other method of compilation, you need to manually make sure that the DLL files are in the correct place.

    The DLL files are in:

    You can copy the DLL files to every directory with EXE files of your application.

    Or you can modify your $PATH environment variable to include the directory where the DLL files are. If you don't know how to set the environment variable, search the Internet (e.g. these are quick instructions how to do it on various Windows versions). Remember to restart the appropriate programs, to make them use the new value of $PATH.

    Be sure to use the DLL files corresponding to your compiler. For example, if you use FPC/Lazarus for 32-bits, then you make executable for 32-bits, and you should use DLLs for 32-bits. Even if you work on a 64-bit Windows.

  • On Linux and FreeBSD you should install the following libraries using your favorite package Manager: LibPng, ZLib, OpenAL, FreeType and VorbisFile. Remember to install -dev versions of these libraries too (if you're under Debian or similar distribution) to be able to compile programs that link to these libraries.

  • On Mac OS X: Mac OS X requirements are listed here.

4. Read the manual

Now go to our manual!
..and create some cool games!:)

It's really easy, and if you have any questions — please ask on the forum!

Support on Patreon