As I mentioned in my last post, I am building a web-based game. What does that mean? First and foremost, it means that it is meant to run in your web browser just like any other website. But more importantly, to me it means that it is not meant to be a graphical game. There will be no animations, and you will not be navigating characters through a fictitious world. At least, not in the WASD sense.
What it also means is that just like any other website or web application, I need to pick a stack.
As I mentioned, Django is the key backend component. It is a Python framework that has been around for years, and is my typical go to choice because of its reliability, flexibility, and huge user base. Just spend 5 minutes Googling “how to build a website with django” and you will get a ton of resources. When leveraged with packages like Channels and DRF, it is an amazing tool. Channels allows me the ability to handle a direct connection from the frontend to the backend over a WebSocket (more on that below). And DRF allows me to effortlessly build a complex web API needed to pass information back and forth between the frontend and backend.
But why this?
Well, I initially was thinking that I would skip the Django root and try out a new VERY promising framework called apistar. It is lean and it is built with some really neat ideas. One of the biggest complaints I hear about Django is that it is a batteries included framework (as opposed to flask, Bottle, or Pyramid). And, apistar is built by the same guy who made DRF. The problem is that it is still a bit new. The reliability has not yet been tested, and I am pretty sure its own development API will change at some point. It is a great project and I plan to continue following it. But for now, Django is in.
React? Angular? Vue? Ember? What should I use?
I hate this debate. I really do. I have used a number of JS frameworks, and I really cannot find a best solution. Angular is too … bloated and restrictive. Ember is inflexible. React is complex. Vue is … well, maybe I don’t have any complaints about it. But we will continue on.
And, to all you out there, I agree that React is not complex to use. In fact, I think it is simple and love its intuitive nature and JSX built right in. I do however take issue with the overwhelming number of packages needed to get up and running. There are a ridiculous number of dependencies. Spend a few minutes Googling “React starter template” and you will see what I mean.
What if I could have everything I wanted in a framework with real simplicity? You know … like I used to have back in the day when I built my own framework 15+ years ago. Back in the days when I didn’t even know what the word framework meant. Hmmm …
Well, maybe I should just build one then. Take all the ideas I like about modern frameworks and dust off the old stuff. Enter PorterJS. I do not mean for it to be a replacement for anything else. I am not even sure that anyone out there will ever find it useful to build with. But for me and my projects, it does EXACTLY what I need in the way I want it it.