F#··2 min read
My stylised-first F# game engine
A fork of the Nu engine that I work on a few days a month, in rare bursts of extra time and energy.
This week I shared some early screenshots of my engine on r/gameenginedevs and Twitter, and I was really happy with how many people liked them.



The scene is the Japanese Street pack from the Unity Asset Store, and its store page shows how it looks in Unity. The editor is ImGui, themed after the music player feishin, in Comic Mono.
The engine is stylised first, not photorealistic. I borrow a lot of Unity URP’s ideas about how customisable graphics should be, like custom shaders, shader graphs and a VFX graph, and marry them to ideas from functional programming. One render graph structure is meant to drive both Vulkan and WebGPU, though only Vulkan works so far. There are no shader variants and no materials, thanks to a dynamic cache I’m working on. If you want something material-like, with variants, you can build it, but it’s just F# data.
Global illumination comes from radiance cascades, which are built into the render graph, with signed distance functions baked alongside. The rest is toon shading, post-processing and a lot of care with lights and colours. The part I’m most excited about is the API: the game is authored in code, so the rain in the night shots is a GPU particle graph written like this:
let drop (rain : Rain) =
PBuilder.streak (Const Assets.Default.White)
|> PBuilder.named "Rain"
|> PBuilder.capacity 130000
|> PBuilder.spawnCount (Exposed ("Drops", single rain.Drops))
|> PBuilder.fromEyeBox (v3 44.0f 20.0f 44.0f)
|> PBuilder.immortal
|> PBuilder.velocityExpr (
let speed = Exposed ("FallSpeed", 8.5f) * PExpr.seedRange 0.85f 1.15f
let gust = PExpr.sin (PExpr.time * 0.7f + PExpr.seed01 * 13.0f) * 0.35f
PExpr.vec3 (PExpr.tan (Exposed ("FallAngle", 0.21f)) * speed * (1.0f + gust)) (-speed) (0.25f * speed * gust))
I forked Nu a few years ago because I couldn’t find an engine that did what I wanted. Nu is also what made me truly appreciate F# and functional programming, after Bryan Edds came up with its ImSim API. I’m keeping ImSim and evolving it, and leaving out Nu’s other API, MMCC, which I don’t think is worth it. The two projects have drifted apart since: Nu isn’t MIT anymore, its licence is now closer to ImageSharp’s, so I’ll never upstream my changes and will keep maintaining my own fork. When it’s ready I’m releasing it under MIT as ENGINE, which is a recursive acronym. I’m still smug that I managed to grab engine.af, and it’s the reason I picked this name over the others.
By the way, Bryan is a genius, and you should totally check out his engine, especially if you’re looking for complex photorealism built in or want to customise it for engineering applications.