Game Engine for Delphi/FreePascal

(Current release 2.1)

Powerful 3D OpenGL Renderer
Scene management using octrees
Cross-plataform window management (See table below)
Sprite engine, with scaling, rotation and alphablending and more.
Integrated resource manager for sound, textures and meshes
Most common file formats supported (See table below)
Material/Geometry shaders, supporting both GLSL and software targets
Supports both skeletal and keyframe animation
Custom static skyboxes
Realtime dynamic skydome, with day-night system
Advanced 3d audio system using OpenAL
Ogg streaming sound using OggVorbis
Extensible scripting language (Pascal based, read manual here)
File Package support (*.LEAF files, editor included)
Data/File Compression support
Complete vector math library
File patching/updates support
Network UDP Client/Server
HTTP Client/Server
SMTP mail support
XML custom loading/saving library
Extensible GUI system (windows, buttons, icons, text)
Basic support for AI (pathfinding, FSMs)
Joystick support (Windows only)
Internal video decoder, with support for custom codecs
Video decoder via DirectShow (Windows only)

Targets supported by LEAF2

Windows Delphi 7
FPC 2.0.2
Linux FPC 2.0.2
MacOS Not supported yet, in progress

File formats supported by LEAF2
Note - Support for custom formats can be added easily


4,8, 24 and 32bits
4,8 and 32bits, transparency
24 and 32bits, transparency
8bits, static and animated


Skeletal animation
Skeletal animation
Keyframe animation
Static geometry only
Static geometry only
Animation data only

8, 16bits
Not working yet

All codecs, using DirectShow



How to add an icon to my LEAF application?
Create a new text file and write the following:
Replace LEAF.ico with the desired icon name and save the file as LEAF.rc
Put the file in the same folder as the source code.
Now in you main dpr file, add the following line to the program source.

My LEAF application is creating a huge log file.
How to disable the log?
The LEAF Log system uses pipes to redirect log output.
To create a pipe you use the LogAddPipe and LogSetDefaultPipe function.
Add the function calls to the program initialization.
Some common usages are:

To disable all OpenGL missing extensions warnings:

To disable all warnings:

How to create a LEAF package?

Use the PackageTool to create packages.
Run it in the command line, with the following sintax:
PackageTool <PackageName> <Action> [FileName]

For example, the following command creates a Mesh package, using all files in the C:\Project\Mesh folder.
PackageTool Mesh -n C:\Project\Mesh\*.*

Why LEAF doesnt support file format [insert format here]?

Currently LEAF supports the most common file formats for images, 3d models and sound.
If a file format isn't supported, is because there's some patent issues, or I couldn't found the format specs.

However, LEAF2 is a very customizable engine, and you can add support for any format easily, as long as you can decode the data yourself.
Just take a look at the LEAF_BMP, or LEAF_WAVE, and use these as a template to create your own.


Note - Currently LEAF2 is still under development.
The version avaliable here is a alpha version.
Is fully functional, but may contain some bugs.
Extra features may be added later.
The engine is now only avaliable in source code.

Download LEAF2 source code

Note - The source code include additional libs.
However, these libs are only necessary if you use specific components.
If you have trouble compiling some libs, check the following table for possible alternatives.

Lib Required by Alternative
DirectX Windows only.
Required if you're using LEAF_DirectShow for playing media.
The built-in media decoder, LEAF_AVI, is less compatible, but is faster and lightweight. Can also be used with Linux.
PasJPEG Required if you're using JPG file support. Use other fileformats, like PNGs, that also support compression, but have bult-in decoders.
ZLIB Delphi only.
Required if you're using PNG file support.
Use other fileformats, like JPG or TGA.
You can also try compiling with FPC, that uses the pre-installed zlib.
OGG DLLs only.
Required if you're using OGG file support.
Use other file formats, like WAV.

No documentation is avaliable yet, however these tutorials should be enough for now.
They're compiled and test using all LEAF2 versions, for both supported targets.
At the time of writing, there's still some issues to resolve with Tutorials 3 and 4 for Linux.


Unrar the compiled units to a folder, called for example LEAF2.
Then you must add the folder to the compiler unit/library path.

In the Delphi IDE, you can add the folder to the library path by going to
Tools->Environment Options->Library->Library path

In the FPC IDE, you can the folder to the unit path by going to
Options->Directories->Unit path
Or, when compiling in the command line, use the -Fu switch to include the path.


Copyright 2007, by Relfos