Skip to content
Projetos

Sobre

A delightfully simple 2D game engine.

Jogos e emulação

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
0
em 7 dias
+2
em 15 dias
+3
em 1 mês
+5

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

Parin

DUB License Docs

A delightfully simple 2D game engine for the D programming language. It's easy to set up, hackable, and comes with the essentials built in.

Parin demo

Why Parin

It has a cute API. If you like Processing or RPGMaker vibes, then Parin is for you. Its main ideas are:

  • Code-driven design: No engine-mandated architecture, so gameplay code can be structured however fits the game.
  • Flexible abstraction: Garbage collection is available for convenience, with the option to drop to manual management or avoid it entirely.
  • Modular foundation: Most of Parin is built on Joka, a portable utility library that can be used on its own (see this raylib example).
  • Batteries included: Sensible defaults for common needs (animation helpers, path finding, screen shake, etc.).

Basic code example:

import parin;

// Called every frame while the game is running.
bool hello(float dt) {
    lockResolution(320, 180);
    drawText("Helloo!!!", mouse);
    return false;
}

// Creates a main function that calls the given function.
mixin runDemo!hello;

Major features:

Quick Start

This section shows how to install Parin using DUB. Create a new folder and run the following commands inside it:

dub init -t parin
dub run

If everything is set up correctly, a window will appear showing a simple message. dub init -t parin also runs parin:setup, which copies the needed template/vendor files into the project.

Available starting templates:

dub init -t parin -- basic   # Minimal ready/update/finish app
dub init -t parin -- entity  # Union-based entity template

Install Without DUB

The scripts folder contains several scripts for using Parin without DUB. Create a new folder and run the following to set up a new project.

Prepare the folder (prepare copies the template and vendor files):

git clone --depth 1 https://github.com/Kapendev/parin parin_package
./parin_package/scripts/prepare
# Or: .\parin_package\scripts\prepare.bat

Run the project (run builds and runs it; extra args select compiler/platform, e.g. ldc2 macos or opend):

./parin_package/scripts/run
# Or: .\parin_package\scripts\run.bat

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 or dlang.uk/parin. The DDOX documentation engine can also be used to create an overview with:

git clone --depth=1 https://github.com/Kapendev/parin parin_package
cd parin_package
dub run -b ddox

Articles:

Videos:

Web Builds

Parin includes a build script for the web in the packages folder. Building for the web requires three tools:

Running the script with DUB:

dub run parin:web

API:

Usage:
  dub run parin:web -- [flags] [libs]
Flags:
  -help     Show this.
  -betterc  Use the `-betterC` flag.
  -release  Use the `-release` flag.
  -build    Avoid emrun after a successful build.
Libs:
  Any non-flag argument is linked as an extra library.
  Example: dub run parin:web -- web/libbox2d.a

Uploading to itch.io:

  1. Open the web folder.
  2. Select the index.* files and add them to a ZIP file.
  3. Go to itch.io and create a new project.
  4. Under "Kind of project", choose "HTML."
  5. Upload the ZIP file and enable the option "This file will be played in the browser."
  6. Ignore everything in "Frame options" except "Fullscreen button."

Ideas

If you notice anything missing, feel free to open an issue! You can also share things in the GitHub discussions. Most ideas are welcome, except hot reloading.

Small extras that don't belong in the core can live in the addons folder as single-file D libraries. Open a PR and add the file there.

Frequently Asked Questions

Is there a list of games made with Parin?

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 scripting language?

No general-purpose scripting language. Parin includes rin for dialogue scripts. The following projects might also 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 libraries that I can use?

  • arsd.ini: INI configuration file support.
  • newsdlang: SDLang/XDL configuration file support.
  • dex-cf: CF (Configuration File) support.
  • dtiled: D language parser for Tiled map files.
  • text-mode: Virtual text mode with 8x8 Unicode font and markup language.
  • Gamut: Image encoding and decoding library.
  • gameserver: Simple game server for toying with online games.

Can I release on Steam or make multiplayer games?

Yes. Parin includes bindings for Steamworks and ENet in parin.bindings. See the integration examples. The binaries themselves are not included, so they need to be downloaded or built and linked separately.

Recommended tools?

For Zed, install the Path Server extension to get autocomplete for paths inside the assets folder.

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 or code?

Hot reloading is not supported out of the box because I (Kapendev) don't care about that feature. The arsd libraries may help.

How can I test dialogue scripts?

With Rin, a small tool that runs dialogue scripts in the terminal. See packages/rin for how to use it.

Are the Parin assets free to use?

Yes. Be sure to check the associated README for any licensing notes.

Is Parin a raylib wrapper?

No. Raylib is one of its backends. A custom backend is being worked on, but it's still experimental. Contributions are welcome.

Can I use Parin for HD games?

Yes. Use Filter.linear for smooth textures, or Filter.trilinear if they are often drawn much smaller than their real size. See the mipmaps example.

Explore projetos relacionados

Carregando…