Parin
A delightfully simple 2D game engine.
Install / Use
/learn @Kapendev/ParinREADME
Parin
A delightfully simple 2D game engine for the D programming language. Parin is designed to make game development fast and fun. It's easy to set up, hackable, and comes with the essentials built in.
<div align="center"> <table> <tr> <th><div align="center">Twenty Seconds, Twenty Steps</div></th> <th><div align="center">Worms Within</div></th> </tr> <tr> <td align="center"> <a href="https://kapendev.itch.io/twenty-seconds-twenty-steps"> <img alt="A Short Metamorphosis" src="https://img.itch.zone/aW1hZ2UvNDExODcyMy8yNDU0NDYzMy5wbmc=/original/G9%2B%2BMo.png" width="480"> </a> </td> <td align="center"> <a href="https://kapendev.itch.io/worms-within"> <img alt="Worms Within" src="https://img.itch.zone/aW1hZ2UvMzU4OTk2OC8yMTM5MTYyMC5wbmc=/original/fWBA1L.png" width="480"> </a> </td> </tr> </table> <p>A list of projects made with Parin is available in the <a href="PROJECTS.md">projects page</a>.</p> </div>Why Parin
- Focused on games: It's opinionated in ways that make game development tasks (rendering, input) easier out of the box than in general-purpose engines.
- Code-driven design: There's no imposed architecture, allowing freedom on how a game is structured.
- A guided workflow: It assumes a few common patterns like a fixed aspect ratio, debug UI and a frame allocator to smooth out the development experience.
- Flexible abstraction: Leverage the GC of D for convenience, or drop down to manual memory management when needed.
Parin sits somewhere between a small engine like raylib or LÖVE and a big engine like Godot or Unity. It offers more direction than small ones, but far less overhead and "magic" than big ones. It's especially well-suited for retro games, with helper functions and two pixel fonts included.
[!NOTE] The project is still early in development. If something is missing, it will probably be added when someone (usually the main developer) needs it.
Major Features
- Pixel-perfect physics engine
- Flexible dialogue system
- Atlas-based animation library
- Efficient tile map structures
- Intuitive immediate-mode UI (WIP)
- Includes extras like microui and memory allocators (tracking, frame, arena)
- Mixed memory model (manual, GC, or both)
- No external dependencies
- Support for Windows, Linux, Web, and macOS (needs testing)
Examples
Basic Window
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);
Simple Editor
import parin, parin.addons.microui;
Game game;
struct Game {
int width = 50;
int height = 50;
IVec2 point = IVec2(70, 50);
}
void ready() {
readyUi(engineFont, 2);
}
bool update(float dt) {
// The game code.
drawRect(Rect(game.point.x, game.point.y, game.width, game.height));
// The editor code.
beginUi();
if (beginWindow("Edit", UiRect(500, 80, 350, 370))) {
headerAndMembers(game, 125);
endWindow();
}
endUi();
return false;
}
mixin runGame!(ready, update, null);
Quick Start
This guide shows how to install Parin using DUB. Create a new folder and run inside the following commands:
dub init -t parin
dub run
If everything is set up correctly, a window will appear showing the message "Hello world!". For instructions on building without DUB, check the "How can I build without DUB?" section in the FAQ.
Required Libraries on Linux
Some libraries for sound, graphics, and input handling are required before using Parin on Linux. Below are installation commands for some Linux distributions.
Ubuntu:
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
Fedora:
sudo dnf install alsa-lib-devel mesa-libGL-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel libatomic
Arch:
sudo pacman -S alsa-lib mesa libx11 libxrandr libxi libxcursor libxinerama
Void:
sudo xbps-install make alsa-lib-devel libglvnd-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel mesa MesaLib-devel
Documentation
Start with the examples folder or the cheatsheet for a quick overview.
For more details, see the tour page.
The parin.types and parin.engine modules are easy to read and show what's available.
Ideas
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.
Devlogs
- Latest: October 2025
- More: dev.to/kapendev
- Archive: parin/devlogs
Recommended Tools
While it is possible use any tool with Parin, these open-source ones are simple to use and work well with it:
- Editor: Pulsar or Lite XL
- Art: Pixelorama or GIMP
- Levels: Tiled
- Sounds: Bfxr or Jfxr
- Music: MilkyTracker
Frequently Asked Questions
Does Parin have a scene or entity system?
No. However, there are examples of how to build them using the Union type in the examples folder:
Does Parin have a UI library?
Yes. However, it's WIP and will change in the future. Check the examples folder for more information about how the current version works.
The following libraries are also compatible with Parin:
- microui-d: A tiny immediate-mode UI library. Included by default in
parin.addons. - Fluid: A declarative cross-platform user interface library.
Does Parin have a scripting language?
No. The following projects might be useful:
- wren-port: A port of the Wren programming language to D.
- arsd.script: The language is based on a hybrid of D and Javascript.
- bindbc-lua: Static & dynamic D bindings to the C API of Lua.
Any other helpful libraries that I can use?
- text-mode: Virtual text mode with 8x8 Unicode font and markup language.
- newsdlang: SDLang/XDL reader and writer.
- Inochi2D: A library for realtime 2D puppet animation.
- Gamut: Image encoding and decoding library.
How do I use Vec2?
The Vec2 type is provided by the Joka library, which Parin depends on.
An example using this type can be found in the Joka repository.
It's a good idea to learn how Joka works in general.
How can I load an asset outside of the assets folder?
Call setIsUsingAssetsPath(false) to disable the default behavior.
Or setAssetsPath(assetsPath.pathDirName) to load from the executable's folder.
How can I hot reload assets?
Asset hot reloading is not supported out of the box. The arsd libraries may help.
How do I make a web build?
Parin includes a build script for the web in the packages folder. Building for the web requires Emscripten (the latest version is recommended).
[!WARNING] The defaults are using the
-betterCflag. If your project requires the D runtime (GC, classes, etc.), scroll down to thegcflag instructions.
Running the script with DUB:
dub run parin:web
Without DUB:
./parin_package/scripts/web
# Or: .\parin_package\scripts\web.bat
Projects requiring the D runtime can be built using the gc flag provided by the build script.
This flag also requires OpenD.
Note that exceptions are not supported and that currently some DUB related limitations apply like having to include all dependencies inside the source folder.
Make sure opend install xpack-emscripten has been run at least once before using it.
Using the flag with DUB:
dub run parin:web -- gc
Without DUB:
./parin_package/scripts/web gc
# Or: .\parin_package\scripts\web.bat gc
To speed up build times, use the debug flag.
The build flag can be used to build the project without running the game.
Additionally, raylib-d projects are partially supported through the rl flag.
A small subset of raylib-d
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
