r/haskellgamedev • • Jun 19 '19

Peoplemon: an all-Haskell role-playing game

Thumbnail
self.haskell
35 Upvotes

r/haskellgamedev • • Nov 28 '22

devblog📖 Notakto: A Haskell game with Apecs and Raylib

Thumbnail
aas.sh
32 Upvotes

r/haskellgamedev • • May 09 '20

I remade the Unity 2D Roguelike Tutorial Project in Haskell with Apecs and SDL2

32 Upvotes

Based on https://learn.unity.com/project/2d-roguelike-tutorial

Github repo https://github.com/mewhhaha/apecs-unity-tutorial-haskell

I've never really done any game project in Haskell, or _any_ finished project in Haskell. I saw https://nmaehlmann.itch.io/mallrl posted here and I thought I'd give it a try. It's not 1-to-1 with the original tutorial. Most of the time I just skimmed it through and looked at the final project how it behaved, and tried to imitate it. It's not good code, but maybe it'll give someone else the inspiration to make something the same way I got inspired.

Are there any actively developed game engines in the Haskell community? Where's the best place to get inspiration and resources from? :-)

EDIT: I didn't write a tutorial, it's just a remake of the same project


r/haskellgamedev • • Oct 30 '21

Allure of the Stars v0.10.3 and LambdaHack, its engine, are ready in time for Game Off 2021

Post image
31 Upvotes

r/haskellgamedev • • Apr 09 '21

Allure of the Stars v0.10.2.0 is out

30 Upvotes

r/haskellgamedev • • Oct 01 '14

How to install SDL2 and the Haskell SDL2 bindings on Windows

25 Upvotes

I wasted 2 days getting this to work, so please benefit from my pain.

  1. Download the SDL2 Mingw Development Libraries from https://www.libsdl.org/download-2.0.php

Unzip it

Move SDL2-2.0.3 to C:\SDL2-2.0.3\

2) If you are installing version 2.0.3 of sdl2, download this file: https://hg.libsdl.org/SDL/raw-file/e217ed463f25/include/SDL_platform.h

Paste it over C:\SDL2-2.0.3\x86_64-w64-mingw32\include\SDL2\SDL_platform.h

This fixes a bug that blocks installation in 2.0.3 that should be fixed in 2.0.4.

3) This is an optional step, but it's good for debugging installation problems. Download http://lazyfoo.net/tutorials/SDL/01_hello_SDL/01_hello_SDL.zip

Unzip it and run this command in the same directory:

g++ 01_hello_SDL.cpp -IC:\SDL2-2.0.3\x86_64-w64-mingw32\include\SDL2 -LC:\SDL2-2.0.3\x86_64-w64-mingw32\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -o 01_hello_SDL

It should compile.

If it says: "winapifamily.h: No such file or directory" You didn't paste over SDL_platform.h.

4) Download pkg-config if you don't have it http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/

Unzip it.

Add pkg-config.exe to your path.

5) Run these commands to install the sdl2 bindings:

set PKG_CONFIG_PATH=C:\SDL2-2.0.3\x86_64-w64-mingw32\lib\pkgconfig
set PATH=C:\SDL2-2.0.3\x86_64-w64-mingw32\bin;%PATH%

If you want 64 bit games:

cabal install sdl2 --extra-lib-dirs=C:\SDL2-2.0.3\include --extra-include-dirs=C:\SDL2-2.0.3\lib\x64

otherwise:

cabal install sdl2 --extra-lib-dirs=C:\SDL2-2.0.3\include --extra-include-dirs=C:\SDL2-2.0.3\lib\x86

6) Try it out. This file should open a window for 2 seconds before closing it. https://raw.githubusercontent.com/palf/haskellSDL2Examples/master/src/lesson01.hs


r/haskellgamedev • • Dec 18 '21

Allure of the Stars v0.11.0.0 and LambdaHack, its engine, out and away!

24 Upvotes

r/haskellgamedev • • Dec 17 '20

A (mostly) guideline compliant Tetris

24 Upvotes

Hey all, I've been working on a Tetris clone made entirely with Haskell (and SDL2) and one of my main goals was to make it as guideline compliant as possible. Other minor goals included getting some experience on how to structure a game to allow for sound effects and to fit different screens and whatnot.

Yes, I can already tell what you're thinking "Christ, a Tetris clone, how original." True, it's lacking a bit in originality, but I set out to do this mostly as a learning experience and hopefully this can help someone else as well.

Feel free to check it out: https://github.com/VitorCBSB/HetrisV2

Information on how to compile and run it, as well as some other stuff can be found in its Readme.

Advice is more than welcome (on basically everything, but mostly interested in code advice)!


r/haskellgamedev • • Mar 01 '18

A Game In Haskell - Dino Rush

Thumbnail
jxv.io
24 Upvotes

r/haskellgamedev • • Sep 11 '15

Announcing a new set of high-level SDL2 bindings for Haskell

Thumbnail ocharles.org.uk
24 Upvotes

r/haskellgamedev • • Sep 16 '14

Wayward Tide is Being Written in Haskell • (from /r/haskell)

24 Upvotes

/r/haskell post here.

Chucklefish, developers of Starbound, have posted on their blog that their upcoming title Wayward Tide is being built on an in-house Haskell engine called Cove, which is largely inspired by Helm.

Down near the bottom is this enticing tidbit:

Being open source, the Cove engine will hopefully support Haskell game development, which in turn will cause a greater investment in Haskell from the gamedev community. If you’re looking to contribute, keep an eye on the blog – we’ll announce when Cove is available on here and Twitter. You can also find me on GitHub pretty easily.


r/haskellgamedev • • Aug 17 '19

How to write a game in Haskell from scratch

Thumbnail morgenthum.tech
23 Upvotes

r/haskellgamedev • • Dec 16 '15

"Growing Up", a short browser game written in Haskell for LD34

23 Upvotes

You can play it here.

Ludum Dare is a game making competition in which a theme is announced (for this 34th edition, the themes were "two button controls" and "growing") and then you have 72 hours to make a game based on it.

We used Haste to compile Haskell to javascript, and we wrote bindings to the sprite.js library. It was my first time using both Haste and sprite.js, so I should probably explain why I chose them and what I think of the experience.

In a previous edition, I wrote a game using FRP and it was great. After the contest is over we're encouraged to make our game accessible to as many people as possible, because we need people to play our game in order to accumulate votes. I ported the game so that it was playable on OS X, Windows and Linux, but for this kind of small game it's still much more convenient for players if they can play in the browser. Among the many Haskell-to-javascript technologies, I picked Haste because it was demonstrated at our local meetup and it really looked like real Haskell code.

Turns out I had completely misunderstood the talk, I thought Haste was a library providing some kind of JS monad which produced Javascript code but Haste is in fact a separate compiler based on ghc. It supports all the ghc extensions I tried, but unfortunately it couldn't compile any of the libraries I tried except for base, containers, transformers and random (and even then random was failing at runtime so I had to ditch it). I can understand that anything which links to a C library wouldn't work, but I don't understand why I couldn't compile an FRP, a lens or a memoization library, it seems to me like those libraries should consist of pure Haskell code. It always failed while trying to compile the same common dependency, hashable, so maybe there's an easy fix.

I couldn't find much Haste-specific libraries either, except for the ones which come with the compiler. So the only libraries I could use were javascript libraries, and even then I had to write my own bindings for them. Thankfully writing those bindings was super easy: it's trivial to call any javascript code, you just write any javascript function inside a string and pass it any argument you want, even a Haskell function if you want it to call back into Haskell. The way I created my bindings is I started with the sprite.js example which looked the closest to what we were trying to do, and I inlined its code inside my Haskell program as one giant ffi call. Then for each line, I either transliterated the code into Haskell, or if it was a new sprite.js call I separated that line into its own ffi binding. The advantage of this approach is that I keep a working example at all times, so when I make a mistake I can see it immediately.

Speaking of sprite.js, why did I choose it? Well I had read good things on this sub about the Tiled editor and the corresponding htiled library, so I wanted to use them. Haste couldn't compile htiled either, so I looked for an equivalent javascript library, and sprite.js was the only one supporting this format which I could just include from my html, the others were all requiring me to setup my machine for javascript development, with npm and grunt and similar tools, and I didn't have time or interest to learn those. Oh, and once the theme was announced we decided not to make a tile-based game after all, but I had already written most of the bindings so we kept going.

sprite.js was a bit buggy, but it's super straightforward code which was easy to fix. Turns out the examples use many undocumented features, so I was glad I was converting those examples into bindings instead of creating bindings from the documentation, as I probably would have done if I wanted to make official bindings. It does the basics right, namely displaying sprites on the screen and animating them smoothly. You can also mix and match sprites and css-styled DOM elements, for things like text and borders. Overall it's quite a small library, which is good because I'd rather have a few ffi primitives and then a lot of Haskell on top, than to have a more full-fledged game engine in which almost all the high-level calls would be ffi calls. I ended up deleting a lot of the bindings I wrote, because they were less generic than the Haskell versions I could write by combining other lower-level bindings.

Re-reading the above paragraphs, I realize I sound a bit negative towards Haste and sprite.js, but it was quite a good experience overall and I'll probably use both of them again for the next Ludum Dare.

One interesting aspect of the code which I didn't end up using is that since the level is described by a list of all the obstacles you encounter from bottom to top, and I only consume them one at a time as they come into view, I could easily make the game last forever simply by using an infinite list. Of course, making the level content stay interesting for that long would be much more complicated. Fun fact: due to lack of time, the current level design was originally intended as dummy test code to make sure my level loading code was working!


r/haskellgamedev • • Aug 24 '15

What's a good 2D Haskell game engine?

23 Upvotes

I have been trying to look for a 2D game engine for Haskell, but so far I haven't been able to find one that looked good so far.

I was interested in Helm at first, but rather disappointed after looking more into it. It's incomplete, has almost no documentation online, some of the documentation it has is incorrect, almost no commits this year, etc.

So, do you know of any good game engine in Haskell that supports 2D, that doesn't suffer from those issues?

Also preferably it should:

  • use FRP (Not necessary, but I would prefer to use FRP rather than not)

  • support other coordinate systems than just x,y (I can't recall how it's called)

  • have some examples/videos/articles that help you learn to use it


r/haskellgamedev • • Apr 10 '25

My Haskell game engine inspired by HyperCard

21 Upvotes

A while back (about two years ago) I made a game engine for Haskell called HaskellCard. I stopped development a while ago, but I think if people became interested I could start development again.

haskellcard an SDL2 game engine based around the idea of exploring different scenes. Ended up being similar to HyperCard. Kind of a point-and-click type thing, but I wanted to have a lot of real-time support, since I think feel like point-and-clicks are kind of boring or not very fun.

The first release was Christmas day, I think.

Neat parts:

  • Build with Nix!

  • Develop in Nix environment!

  • JSON-configurable game logic, rendering, rooms, objects, sfx, and more!

  • Music queue system, so can loop, but also wait for a loop to finish before next song plays

  • Tweening system

I am here for support/answering questions, showing demos if you're interested, etc.


r/haskellgamedev • • Dec 01 '22

devblog📖 Defect Process full haskell source (~62k LOC | action game on Steam)

Thumbnail
github.com
21 Upvotes

r/haskellgamedev • • Nov 20 '22

Board Game Server

21 Upvotes

https://serabi.de/ is a online board game server which I wrote in haskell. Currently you can play Reversi only, but the idea is to add more games, maybe chess could be the next.

The server needs some player but there is a serabibot, who is available for a match. The AI is quite simple. If you are careless you will loose, but it is not really invincible.

The frontend is written with Reflex DOM. The Javascript version is compiled with ghcjs, but there is also an android client. You can find it on the google playstore.

The backend is built with web sockets and servant for the OIDC login (keycloak).

I was positively surprised that mixing backend and frontend code works so well. Internally the reversi board is encoded as two bit boads (int64). Everything woks in the browser, but actually Javascript doesn't have int64, only number/double or Bitnum. So Aeson has to encode my numbers correctly and my bit operations must work correctly. Never saw a problem.


r/haskellgamedev • • Dec 05 '14

It's Ludum Dare! Let's show them what Haskell can do :)

21 Upvotes

Ludum Dare is a well-known competition in which teams or individuals create a game in 72 and 48 hours, respectively. And it's happening this weekend!

For small interactive projects like this, my Haskell library of choice is gloss. Its graphics are not as powerful as OpenGL, but it's much easier to use.

You can then write your update loop with pure functions, IO actions, or any of a number of FRP libraries such as reactive-banana, sodium, netwire, Yampa, elerea, and grapefruit.


r/haskellgamedev • • Feb 07 '23

The first Haskell Tiny Game Jam is now open!

20 Upvotes

Your mission: make Haskell games in 10 lines. https://github.com/haskell-game/tiny-games-hs and the #haskell-game chat room await your entries. Good luck!


r/haskellgamedev • • Jun 30 '21

DearImGui uploaded to Hackage

20 Upvotes

https://hackage.haskell.org/package/dear-imgui

Please test and report if something needs fixing.

The docs will be uploaded later, sorry. Please consult the package code for usage.

The bindings are not yet finished, it's just a snapshot of the git repo and there is a lot of work to do.


r/haskellgamedev • • Jul 19 '19

I remade my old VVVVVV parody in Haskell

Thumbnail
linearity.itch.io
20 Upvotes

r/haskellgamedev • • Apr 24 '19

How to use FRP in game programming

20 Upvotes

Hey r/haskellgamedev people. I am trying to rebuild my game engine affection to switch to the functional reactive programming paradigm. Unfortunately I have no experience in this field and am thus looking for resources, advice and discussion (or even collaborators).

Some questions to start this off are:

  • Does FRP leverage more performance for the game itself?

  • What is the better approach: implement by myself or use a library?


r/haskellgamedev • • Mar 10 '23

Haskell Tiny Game Jam 2023 Results

19 Upvotes

We are very pleased to announce.. the results of Haskell Tiny Game Jam 2023 ! Congratulations and thanks to all participants!

  • 55 entries in 4 categories from 28 entrants in 3 weeks

  • 109 reviews, 5 winners and 6 honourable mentions from 2 judges

  • Shell script to browse and play the games on all major platforms (single binary coming later maybe)

  • Readable source versions, useful development tips, informative blog posts

This was the first Haskell game dev contest. We invite you to come and play, read, and get inspired for the next one!

https://github.com/haskell-game/tiny-games-hs


r/haskellgamedev • • Feb 20 '23

Simple SDL2 Game in Haskell.

19 Upvotes

Don't Eat the Yellow Snow! is my first Haskell program. I used SDL2 for images font and sound. I tried unsuccessfully to get a code review on stackexchange. It's a pretty simple game one that i have written in Lua, ruby, c, c++, python, javascript and haskell. If any one would like to look over my code and let me know if i'm making any major mistakes that would be great. This project focused on making the must basic functioning game with sound, score, music, and key input i could make. I used stack to build since it was the only way i could get SDL_image to work. I used the state monad for gamestates. I had no reference for this at all so it was what i could figure out on my own. Thanks.

https://github.com/JeremiahCheatham/Yellow-Snow