Download the engine source code with examples, unpack it anywhere.
If you 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 TCastleControl 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 TCastleWindow class.Watch the movie showing the Lazarus installation process.
If you don't use Lazarus (only command-line FPC):
Our engine can be used without the LCL (Lazarus Component Library) through the TCastleWindow class. To compile the engine and applications without the help of Lazarus, you have a couple of options:
We advice using our build tool to compile and package your games. The build tool reads the project configuration from the CastleEngineManifest.xml file. It provides a lot of cool options, e.g. it can easily package your Android or iOS game, or prepare compressed versions of your textures. Try it out on the command-line:
tools/build-tool/castle-engine_compile.sh # Line below is just an example for Unix, the goal is to put castle-engine binary on $PATH sudo mv tools/build-tool/castle-engine /usr/local/bin # Line below is just an example for Unix, the goal is to define $CASTLE_ENGINE_PATH export CASTLE_ENGINE_PATH=`pwd` # Test that it works! cd examples/fps_game/ castle-engine compile
Or you can use a simple shell script that calls FPC with proper
command-line options. Make sure to pass to FPC file
that contains engine paths and compilation options.
Just try compiling any example program this way, for example to compile
examples/fps_game/fps_game.lpr do this:
cd examples/fps_game/ ./fps_game_compile.sh
And run the resulting executable (run
on Unix, or
fps_game.exe on Windows).
You can use a similar approach as the
script for your own programs.
Other option is to compile the engine using FpMake.
fpc fpmake.pp ./fpmake # If the above doesn't work, you usually need to define FPC units dir # ./fpmake --globalunitdir=<my-fpc-directory>/units/
Then add the path with compiled units to your
fpc.cfg file by
adding a line like
(see FPC documentation "Configuration file" to know where you can find your
fpc.cfg file). And then, just use our units in your game code,
and compile it in any way you like (like
on the command-line).
Programs developed using our engine (engine examples, and your own programs too) can use a couple of libraries.
You can just copy the DLL files to every directory
.exe files that you compile with our engine.
Or you can modify your $PATH environment variable to include the directory where these libraries are. Google "windows how to modify path" if you're not sure how to do this. 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, GtkGLExt 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.