archives

Iterative Functional Reactive Programming with the Nu Game Engine - An Informal Experience Report

This is an experience report on the design and usage of the Nu Game Engine, a purely-functional 2D game engine written in F# -

Iterative Functional Reactive Programming with the Nu Game Engine

Synopsis

The Nu Game Engine certainly qualifies as 'functional reactive' in that -
1) it is reactive in that it uses user-defined events to derive successive simulation states.
2) it is functional in that is uses pure functions everywhere, even in the event system.

However, I cannot describe it as the typical first-order or higher-order FRP system since it uses neither continuous nor discrete functions explicitly parameterized with time. Instead it uses a classically-iterative approach to advancing game states that is akin to the imperative tick-based style, but implemented with pure functions.

Thus, I gave it the name of 'Iterative FRP'. It's a purely-functional half-step between classic imperative game programming and first / higher-order FRP systems. This document discusses the major plusses and minuses to using this 'iterative' FRP style.

An aside about the document -

I released an earlier version of this PDF along with an earlier version of the engine, but had to make significant revisions due to a fundamental flaw in the engine's previous design, and thus removed it.

Hopefully this newer version will inform us about the properties of this 'iterative' style of FRP in contrast to the known styles.