First install Lazarus with FPC.
Download the Castle Game Engine, version >= 6.5. Unpack the engine ZIP wherever you like.
Inside the unpacked
castle_game_engine, you will find a subdirectory
bin. Run the
castle-editor executable inside.
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.
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.
To use Lazarus for development:
Open and compile the package
You will find it in the
Use the Lazarus menu item "Package -> Open Package File (.lpk)"
to open the package file, press "Compile" in a dialog that appears.
Then open and compile the package
Note: do not install the
Finally, open and install the package
In the package dialog, the option to "Install" package is under the "Use" button.
castle_components.lpk is successfully installed,
Lazarus restarts, and you should see the "Castle" tab
with our components.
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
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.
Another option is to build and install the engine using FpMake.
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.
Copyright Michalis Kamburelis and other Castle Game Engine developers.
Thank you to Paweł Wojciechowicz from Cat-astrophe Games for various graphics.
This documentation is also open-source and you can even redistribute it on open-source terms.