Applying Functional Programming to a Complex Domain: A Practical Game Engine PoC

Posted by IngloriousCoderz@reddit | programming | View on Reddit | 79 comments

Hey r/programming,

As a front-end developer with a background in the JavaScript, React, and Redux ecosystem, I've always been intrigued by the idea of applying FP to a complex, real-world domain. Even though JavaScript is a multi-paradigm language, I've been leveraging its functional features to build a game engine as a side project, and I'm happy with the results so far so I wanted to share them with the community and gather some feedback.

What I've found is that FP's core principles make it surprisingly straightforward to implement the architectural features that modern, high-performance game engines rely on.

The Perks I Found

I was able to naturally implement these core architectural features with FP:

And all of this comes with the inherent benefits of functional programming:

I've created a PoC, and I'm really enjoying the process. Here is the link to my GitHub repo: https://github.com/IngloriousCoderz/inglorious-engine. You can also find the documentation here: https://inglorious-engine.vercel.app/.

So, when and where will my PoC hit a wall and tell me: "You were wrong all along, FP is not the way for game engines"?