Object Pascal is a
modern,
readable,
fast,
type-safe,
cross-platform
programming language.
It is also easy to pick up if you know any OOP language. Learn more in our Modern Object Pascal Introduction for Programmers.
Object Pascal is a modern programming language. It supports classes, units, properties, generics, interfaces, reflection, closures… Everything you expect from a modern OOP language.
The syntax puts emphasis on readable code.
The language is type-safe. E.g. there are special types for booleans, strings, chars, sets, enums, ranges. Type conversions are either really safe (e.g. integer can be assigned to float without any fuss), or have to be done explicitly.
There’s a significant emphasis on checking things at compile-time. This makes refactoring things, e.g. rearranging data structures, pain-free in many cases: just do what you want, hit "Compile", and let the compiler point all the things you have to adjust. Compilation will not allow obvious mistakes (like name typos or type mismatches) to ever reach the user.
There are additional run-time checks, e.g. array range checking, integer overflow checking, assertions, memory leak checking. Notes:
You can turn off these checks in the "release" version (for performance), but use them in "debug" version to capture all problems during testing easier.
When compiling using CGE editor, we have debug / release modes automatically set up, they activate / deactivate reasonable options automatically. Just switch the mode between debug / release using CGE editor "Run" menu.
What are range and overflow checks (and errors) in Pascal.
Detecting Memory Leaks.
It is compiled to a native code and so is fast "out of the box". There’s seldom any need to do low-level optimizations.
But if you need to, language can be as low-level as you want. E.g. you can use pointers, do pointer math, write OS and CPU-specific code, even add pieces in assembly. You can work on the same level as C or C++ does.
Compilation is also fast.
2.5 seconds to get desktop build, 10.1 seconds to get Android build of a new project, opened for the 1st time. Try to match that with your engine :)
Desktop (Windows, Linux, macOS, Raspberry Pi, FreeBSD, probably every Unix…),
mobile (Android, iOS),
consoles (Nintendo Switch, special in CGE),
web (both WebAssembly and JS (using pas2js)).
See also Castle Game Engine platforms supported.
Above we listed platforms interesting for CGE, for now. For all the possibilities, see FPC target platforms and Delphi target platforms.
In Castle Game Engine case, engine code and game code are in the same language. Every user is contributor!
And the engine is open-source.
Don’t hesitate to fork CGE to adjust it to your needs.
There are existing libraries (units) in Pascal for everything:
database
XML, JSON
A.I.
blockchain
networking
Moreover you can easily integrate with (link to) any existing library with C API. Any renderer, sound library, physics - we can use everything.
You can also use Python libraries in Pascal easily.
FPC - Free Pascal Compiler, open-source.
Lazarus - IDE for Pascal, on top of FPC, also open-source.
Delphi - commercial compiler and IDE for Pascal.
VS Code support - CGE, as well as many others in the Pascal ecosystem, explicitly support integration with VS Code.
To improve this documentation just edit this page and create a pull request to cge-www repository.