A delightfully simple 2D game engine for the D programming language. Parin is designed to make game development fun โ it's easy to set up and lets you jump right into making things.
Worms Within
A bite-sized escape room game.
A list of projects made with Parin is available in the projects page.
- Efficient tile map structures
- Flexible dialogue system
- Intuitive immediate mode UI
- Atlas-based animation library
- Pixel-perfect physics engine
- Cross-platform (Windows, Linux, macOS, Web)
- Small C interface for cross-language use
- BetterC support
import parin;
// Called once when the game starts.
void ready() {
lockResolution(320, 180);
}
// Called every frame while the game is running.
// If true is returned, then the game will stop running.
bool update(float dt) {
drawText("Hello world!", Vec2(8));
return false;
}
// Called once when the game ends.
void finish() {}
// Creates a main function that calls the given functions.
mixin runGame!(ready, update, finish);
This guide shows how to install Parin using DUB. Create a new folder and run inside the following commands:
dub init -n
dub run parin:setup
dub run
If everything is set up correctly, a window will appear showing the message "Hello world!". For instructions on building without DUB, see How can I build without DUB?.
Some libraries for sound, graphics, and input handling are required before using Parin on Linux. Below are installation commands for some Linux distributions.
sudo apt install libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev libwayland-dev libxkbcommon-dev
sudo dnf install alsa-lib-devel mesa-libGL-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel libatomic
sudo pacman -S alsa-lib mesa libx11 libxrandr libxi libxcursor libxinerama
Start with the examples folder or the cheatsheet for a quick overview. For more details, check the tour page.
If you notice anything missing or want to contribute, feel free to open an issue! You can also share things in the GitHub discussions. Most ideas are welcome, except ECS.
Create a new folder and run inside the following commands:
git clone --depth 1 https://github.com/Kapendev/parin parin_package
git clone --depth 1 https://github.com/Kapendev/joka joka_package
./parin_package/scripts/prepare
# Or: .\parin_package\scripts\prepare.bat
./parin_package/scripts/run
# Or: .\parin_package\scripts\run.bat
# Or: ./parin_package/scripts/run ldc2 macos
# Or: ./parin_package/scripts/run opend
Parin includes a build script for the web in the packages folder. Building for the web also requires Emscripten. By default, Parin's web builds use the BetterC flag, meaning only projects compatible with BetterC can be compiled.
dub run parin:web
./parin_package/scripts/web
# Or: .\parin_package\scripts\web.bat
Projects requiring the full D runtime can be built using the GC flag.
This flag also requires OpenD and the latest version of Emscripten.
Note that exceptions are not supported and that some DUB related limitations apply like having to include all dependencies inside the source folder.
Before using the GC flag, make sure opend install xpack-emscripten
has been run at least once.
dub run parin:web -- gc
./parin_package/scripts/web gc
# Or: .\parin_package\scripts\web.bat gc
Below are installation commands for Emscripten for some Linux distributions.
sudo apt install emscripten
sudo dnf install emscripten
yay -S emscripten
# Or: sudo pacman -S emscripten
Vec2
is a type provided by the Joka library, which Parin depends on.
An example using this type can be found in Joka.
Call setIsUsingAssetsPath(false)
to disable the default behavior.
Or setAssetsPath(assetsPath.pathDirName)
to load from the executable's folder.
Asset hot reloading is not supported out of the box. The arsd libraries may help.
Yes. Be sure to check the associated README for any licensing notes.
No. Raylib is the current backend. A custom backend may be added in the future, but it's not a priority.
The goal is a smooth experience, similar to Godot or Unity.