During the whole development of Citybound I was half-knowingly waiting for the day where my selection of technologies would turn out to be inadequate. This day has come.
Instead, I decided now to do game development the tried-and-true old-school way and focus all my efforts on implementing & innovating, not on fighting language restrictions:
I will rewrite Citybound in C++.
...let me address all the surprise, rage, happiness and incomprehension that you might have, with a convenient question & answer format. Feel free to skip what you don't care about, since I go into a lot of detail.
But you believed in JS & WebGL so much! Why did you continue for so long and what made you finally doubt it?
Yes... I really wanted to believe. From the very beginning people told me that it's a stupid idea. But I didn't want to dismiss new technologies and not try new things just because of that. I needed to see it fail before my own eyes, after actually trying.
After this relevation, I noticed a lot of other restrictions that I was playing down for myself and others (see advantages of C++ below).
So why C++? Isn't it horrible?
- No, many (including me) are prejudiced about this. After taking a deep dive into C++11 for the last couple days and coding some first drafts, I have to say that it's a really nice language, allowing you to do horribly fast low-level stuff, while letting you package that in safe and nice-looking abstractions.
What advantages will C++ actually bring?
- Much, much faster everything. This might make even my wildest goals of simulating true populations in the order of millions possible.
- Inversely, this means that Citybound will run much smoother on even old and weak hardware.
- Minimal amount of RAM usage and savegame size theoretically possible.
- I can use existing, cutting edge and battle tested libraries for parts of the game instead of doing everything myself, for example:
- Instead of hundreds of megabytes, the game's download size will be just a few megabytes (excluding only music).
- The strict typing of C++ will probably prevent a lot of silly bugs early on and make it easier to find others.
What about cross-platform compatability?
Citybound will run as a native app on Windows, Mac, Linux and who knows what else! This is made possible by libraries for graphics, input, etc. which are themselves cross-platform (SDL 2.0 & bgfx).
Since I didn't want to publish Citybound as a webapp anyways (but as a webpage+browser Electron app), using C++ just means that the game will feel even more native on each platform (for example full multitouch gestures on trackpads/touchscreens)
What about moddability, tooling and open source?
Except some initial configuration hell (that I take care of for you), C++ also offers a great development & debugging experience, there exist very good tutorials and IDEs for it.
Since with native code I can protect a few select parts of the code much better, I actually feel comfortable open-sourcing all of the game-behaviour-defining code.
The game will come with a mod-kit that contains the source of the vanilla game in a perfectly set-up git repository. You would branch that into your own mod, modify whatever you want, run and try it and then publish it.
git's merge tools will help you to make your mod compatible with new versions of the game or even with other mods.
The way the engine is set up should allow something very close to hot-code-swapping where you can "operate on the living patient" for very fast development iteration.
Ideally I will find a solution for crosscompiling, so even though you only have Windows, for example, you can create working mods for all the platforms.
So..., will you finally use an engine now?
- No, there still exists no engine that is optimized for the kinds of stuff Citybound needs (millions of actors...) and some essential things like advanced 2D geometry (for architectural stuff) is completely missing from engines.
How much will carry over from the old code?
- The basic handling of game state, which is very compactly stored in RAM and can be dumped 1:1 onto the disk and then loaded again with almost no additional work required. This should make loading and saving super quick.
- The geometry code should be pretty easy to be ported.
- The user interface and intersection logic for roads and zones will also stay the same, so it only needs to be rewritten.
- Graphics code will become slighly-lower level, but there's not much grahpics yet anyways, so I hope this will be fast.
- Traffic simulation also "just" needs to be rewritten.
- Economy and all the other gameplay needs to be written from scratch anyways.
How long will it take you?
I refuse to invent an answer to this question at this point. I know you hate me for it, but all of this is necessary and good. I will try to make more concrete promises like I did one month ago, as soon as they make sense again. Thank you for your patience.
You will give up on it! This is just the best proof that Citybound is nothing but Vaporware!
Never! Don't think that this was an easy decision to make, but rest assured that I will stay with Citybound until it is exactly what I want it to be, no matter how much time, effort and rethinking it will need!
You have even more questions, comments or concerns?
Let me know!