Writing a game with F# and RxNA

I wanted to test my hand on writing a short F# program and using functional
reactive programming in it. Because lot of this would be new to me, I
deliberately chose to write a simple shooter game.

F# is functional programming language on .Net platform. It can integrate with
existing .Net code easily and has decent tooling with Visual Studio. Some of
the features I really like are immutability and type inference. Immutability
means that I don’t have to worry that much about global state of the system
while working with some detail. Type inference means that I don’t have to
specify types all the time, but the compiler can figure them out from the
context (usually, sometimes it does need a little bit help).

Rx (or Reactive Extensions) is quite neat library for composing programs using
Observables, queries and schedulers. I found that by using Rx, my program
naturally fell into small pieces or streams that communicated with each other.
When ever something changed, all the dependent things reacted too.

MonoGame is an open source library for cross-platform game development. The
API is really close to now defunct XNA and there are plenty of resources out
there, so finding help or information usually isn’t particularly difficult.

RxNA is an open source library that adds a set of Observables that are suited
in interacting with MonoGame.

Continue reading