Yet another post about DobadoBots: my programming video-game. Right, let’s face it: it is done for two months now, this blog post is long overdue!
The video-game is now completely playable, I reached the MVP stage. Here’s a short video presenting the final result.
Let’s debrief this project.
Getting Familiar with Haskell
The main goal was to get some practical experience with Haskell. I had literally zero real-world experience before that.
After two months in, I can use Haskell productively enough. Yup, that’s a pretty steep and long learning curve. But it worth mentioning that I had no prior experience using a purely functional language.
It worth mentioning that you do not need to understand what’s a free monad or what are GADTs to be productive. You do not need a category theory PHD either.
There is a huge gap between getting productive enough and understanding what’s discussed on Haskell’s subreddit. This blog post made that click for me.
The main takeaway after this first practical experience is that a strong type system is a huge asset while refactoring. Having used Python quite extensively, a massive refactoring was always painful. You could easily introduce a lot of bugs as soon as your test suite was a bit weak. Haskell type system tends to cover your back most of the time and just refuse to compile your poorly refactored code.
I also found that assessing a task complexity very hard. Some things that would have been really long to do using a procedural language turns out being trivial using Haskell while some task that would have been simple using Python turns out being quite complicated using Haskell.
What has Been Unexpectedly Easy?
As previously discussed, I wrote my own language and parser for this project. This part has been unexpectedly easy.
What has Been Unexpectedly Hard?
Retrospectively speaking, the game part has been the hardest part. Without thinking about it, I basically wrote a whole game engine…
Choosing SDL2 as a graphics library turned out to be a poor choice. The library is low level, you basically need to implement everything. Turns out a video-game is not a trivial piece of software, you need to implement a button system, a menu engine, etc.
Writing the text editor also turned out being a real pain that took me almost two complete weeks.
The complexity is mainly hidden in small details.
I’m not going to lie, wrapping up this MVP was painful. I do not want to spend any more time on this project, working on it actually became a burden.
I do not plan to maintain this code, hence, I will not provide any binary distribution. You can, however, compile the Github repository if you want to play this game by yourself! It still has some rough edges and is only shipped with two stages. But you can easily add some more simply by looking at the JSON level format.
After getting familiar with Haskell, I think it is time to dive deeper in it and try doing something involving more performance tuning and some concurrent code. I’m going to take over the Haskell Wireguard implementation for the next few months!