Greetings to everyone reading this post.
If you followed my previous blog posts you are probable aware that I’ve decided put some effort into game development and document my progress along the way. So you might be asking what is happening? Where are all the posts? What is happening?
Well, there are few things that were going on.
First, I have been busy with my academic work, with some exciting (at least for me developments). However this is not a topic of this blog so we will skip that, for now.
- How easy/hard is it to use F# compared to C++ for game development? F# is labeled as “general purpose language”, so why not try to use it to make games? There are two main problems with that in my view. Game development is heavily object oriented and low level. F# low level programming is not its strongest point, I believe. The low level part is not that bad – a few successful indie games were made using XNA – and Monogame is, well, just open source port / implementation of XNA. The OOP part is harder I think – most of game development books / tutorials are using OOP approach, and F# while it supports OOP, let say it strictly – OOP in F# is just ugly (it is my opinion based on trying to port C# OOP code to F# OOP code), at least if you try to use OOP in way it is used in mainstream languages C#, Java, C++ etc. For example, inheritance is painful and kinda ineffective due to lack of protected members and implementing interfaces is annoying – because every interface must have explicit implementation – which requires you to write more code. I plan to see how far I can go with functional (first approach) – namely replacing everything with modules, composition and first class functions. Keep in mind that at least in first stages (if there are later stages of course and I don’t get bored and move on to something else… ) my code is going to be unnecessary functional sometimes – so take everything I write with a grain of salt – while I like F# and played with it for a while – I am in no way an experienced F# developer.
- To compare the performance – it is general belief that C++ code tends to be faster, though harder to write than other languages while F# is joy to write, and usually produces very few errors. I am going to explore the tradeoffs.
Why am I doing it?
- A check of concept – I want to check whether it can be done easily enough without sacrificing too much performance.
- Check how well F# handles task that people often don’t recommend using it for.
Well so far I am going through a Monogame tutorial trying to convert the examples into functional (first) F# style.
I hope to finish it a a few days and write an update with some examples then. If I still enjoy the experience and decide to continue doing it – I hope to write a series on game programming with F# and monogame.
Please comment if tried using F# or other functional languages for game or graphics programming