If you like to learn by watching, enjoy this video introduction to the engine and editor:
First install Lazarus with FPC.
Download the latest Castle Game Engine. 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.
Configure FPC and Lazarus locations in editor Preferences, if needed.
Create a new project, using one of the suggested New Project templates. These templates have been designed to show you most important features of our engine, along with the most advised way to use them.
Compile and Run the project using the editor Run menu.
That's it! The world is your oyster now :)
Open and try more example projects from the engine
examples subdirectory. Almost all engine examples have a CastleEngineManifest.xml file and can be build using the editor (or command-line build tool).
In either case, the project configuration is defined by a CastleEngineManifest.xml file.
The editor and build tool are most natural to build 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 external libraries.
On Windows the libraries (
dll files) are in the downloaded engine archive.
If you use some other method of compilation, you need to manually make sure that the
dll files are in the correct place.
dll files are in:
You can copy these
dll files to every directory with
exe files of your application.
Or you can modify your
PATH environment variable to include the directory
dll files are. If you're not sure 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
Be sure to use the
dll files corresponding to your target platform. For example, if you use FPC/Lazarus for 32-bits, then you make executable for 32-bits (by default), and you should use
dll for 32-bits. Even if you work on a 64-bit Windows.
On Linux and FreeBSD, we use the following libraries:
The first 3 (OpenGL, LibPng, Zlib) are definitely present on all reasonable desktop installations. The others are typicallly installed too, but it will not hurt to document somewhere for users "Please make sure you have these libraries installed: ...".
On your (developer) system, you will need the development versions of some of these libraries. This allows to build programs that link to these libraries. On Debian systems, this command should install everything you need:
sudo apt install libgtk2.0-dev libgl1-mesa-dev
Note that we link to many libraries dynamically using "dlopen" Unix mechanism.
So it is not necessary to install e.g.
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.