You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Xelmish** is a small project that creates an **X**NA Game loop (via Mono Game) and connects it to the **Elmish** MVU architecture, via a custom setState method in its own version of the classic Elmish.Program module (Xelmish.Program).
5
+
**Xelmish** is a small project that creates an **X**NA Game loop (via Mono Game) and connects it to the **Elmish** MVU architecture, via a custom setState method in its own version of the classic Elmish.Program module (Xelmish.Program).
6
6
7
7
In this way, you can develop games using the excellent Elmish architecture, with all the power of an XNA renderer! You can also convert existing Elmish applications to use Xelmish by rewriting their view functions.
8
8
9
9
To use Xelmish, the Elmish program must provide a view function that returns a list of 'viewables', functions which take an XNA SpriteBatch. A set of common such functions like colour, image and text are provided in the Xelmish Viewables helper module.
10
10
11
11
Xelmish is for **2D games** (the SpriteBatch object is for drawing textures, not rendering vertices). Hopefully it allows users to develop such games rapidly using the Elm architecture and F#!
12
12
13
-
**Update: Available on Nuget [here](https://www.nuget.org/packages/xelmish)**
14
-
15
-
**Update Update**: the project and its samples were recently upgraded to .NET 5. The older, dotnet core 2.2 version can be found in [this branch](https://github.com/ChrisPritchard/Xelmish/tree/fs-applied-2019), though its mainly just the framework that changed, not any code effectively.
16
-
17
-
**Update Update Update**: the project and its samples are now .NET 6, along with a MonoGame version bump.
18
-
19
-
**Update Update Update Update**: the project and its samples are now .NET 68, along with a MonoGame version bump.
20
-
21
13
## Simple Example of Usage
22
14
23
15
The simplest usage of Xelmish is shown in the first sample, [xelmish-first](./samples/xelmish-first/Program.fs). This sample renders a square to the screen, and allows you to move and resize it with key presses. It doesnt have any loaded assets like textures, fonts or sound, and therefore also doesn't require the monogame content pipeline. Nice and simple.
@@ -40,6 +32,8 @@ It has been upgraded since to MonoGame 3.8, and the core Xelmish project made cr
40
32
41
33
**UPDATE 2024** It has been updated to .NET 8, and compiled using dotnet cli. Tested on Windows 11.
42
34
35
+
**UPDATE 2025** Latest versions of core dependencies added: elmish 5 and monogame 3.8.4. Minor rework was required for subscription changes in elmish.
36
+
43
37
### A note for Linux builders
44
38
45
39
On Linux the Monogame Content Pipeline may not work by default. If you get mono failure errors, try installing mono-complete, e.g. `sudo apt install mono-complete`. I was able to compile and run the samples on Ubuntu 18.04 after this without issue.
@@ -74,11 +68,11 @@ This is also the first sample that uses audio, with retro beeps and explosions b
74
68
75
69
## History and Reasoning
76
70
77
-
Xelmish has been built for the **[2019 F# Applied Competition](http://foundation.fsharp.org/applied_fsharp_challenge)**, but also as a replacement architecture for my prior [fsharp-gamecore](https://github.com/ChrisPritchard/fsharp-gamecore) experimental engine.
71
+
Xelmish has been built for the **[2019 F# Applied Competition](http://foundation.fsharp.org/applied_fsharp_challenge)**, but also as a replacement architecture for my prior [fsharp-gamecore](https://github.com/ChrisPritchard/fsharp-gamecore) experimental engine.
78
72
79
73
> **Update:** While Xelmish unfortunately did not win in the competition, my [other](https://github.com/ChrisPritchard/FSH) submission did. Full results [here](http://foundation.fsharp.org/results_applied_fsharp_2019).
80
74
81
-
While I have successfully built several small games with gamecore, I was finding that as my games increased in complexity the very simplistic model/view architecture in gamecore started to get stretched and warp. Things which were view-specific started to leak into model, and vice versa.
75
+
While I have successfully built several small games with gamecore, I was finding that as my games increased in complexity the very simplistic model/view architecture in gamecore started to get stretched and warp. Things which were view-specific started to leak into model, and vice versa.
82
76
83
77
In contrast the battle-tested Elmish model has, so far, proved a pleasure to work with. Much more elegant, and it has also achieved in a far better way my goal of having games being purely functional (where performance permits) and agnostic of engine. The MVU architecture, and parent-child relationships that the Elm architecture handles so well, mean that a game can be designed and theorised without having the engine get in the way, which is (in my opinion) ideal.
0 commit comments