Posted November 18, 2021 by mj.Jernigan
This is, essentially, the postmortem to a rewrite of a game prototype.
After wrestling a few-hundred-too-many times with Phaser's lack of a standardized programming pattern (you have to use three patterns to instantiate some objects -- and they don't see the issue if you complain about it) and poor documentation, I went looking for a new engine. Phaser is what happens when you have too many cooks and not enough oversight in open source (but light-years better than with Flame, I might add, just to poke that Flame beast once more and plug Pogo instead). Anyway... I landed on Godot because it builds easily to WebAssembly (important) and gives me WebRTC as well. I thought Godot would also give me a Firebase RTDB plugin but, well, I ended up writing my own Godot Firebase Lite plugin -- which is another story you can find elsewhere.
Now, nearly a year later, I have finally finished the Sendit Soccer rewrite in Godot. Of course, I didn't work on this full time, but it was still maybe three or four months of work. Was it worth the switch to Godot? I think maybe so... but it's really hard to call it right now. While I don't regret leaving Phaser behind, Godot was such a fight to get the game port working, I can't be sure I'll ever get back the time lost between Phaser and Godot. Also, the Godot build came out at about 6 times larger than the Phaser build (the minimal Godot custom-web-engine build being about 8 times larger than the sum of the packages I used with Phaser). If itch.io would implement gzip support for HTML games, I could compress Godot's wasm file small enough to not worry about the size increase. But, alas, I can't, and I worry about the 9.5 MB overhead being too much. Too much for my liking, anyway, for a browser game. Then again, hey, it could have been worse. It could have been Unity's wasm engine (which, I think, is self-zipped to not make it seem so fat... luckies).
Aside from the Firebase disappointment and subsequent adventure ("Yay! Godot users now have a better Firebase option."), the biggest slice of work with porting to Godot was adapting to their absolutely crazy kinematic character controller. This was so insanely-maddening of a physics controller it led to me blogging about it here: The Annoying Quirks of Godot’s Kinematic Bodies. That was definitely the worst thing about Godot... and avoidable if you ignore kinematics and go straight to dynamic rigidbodies (and maybe what I should have done with Sendit Soccer, if I could guess the performance impact of it in a browser).
After that, Godot's inability to refactor classes without throwing dependency errors all over the place, also wasted a stupid amount of time. You see, Godot won't re-evaluate such class errors unless you reload Godot and/or the project (or you get very lucky with some super-secret mojo-like editor actions). It should be relatively easy to add more class-evaluation triggers to mitigate most of this... but reading the issue discussions reveals that nobody cares to even try to fix the worst parts of this... because they can't also fix the edge complaints as well. Whaaaaat!!!!! They're waiting for a hopeful class system rewrite in Godot 4 instead -- or some excuse like that. Always waiting for a better Godot. Sigh.
On the positive side, this rewrite brought about a total rethink on the lobby code and the result puts it in a much better place for filling out the needed features there. That's a pretty big win. Also, the annoyances with the kinematics forced me to redo the collisions in a much-more-deliberate/less-lazy way. As much of a pain as that was (and still is) it should bring about much better performance -- something that might prove critical with a lot of players on the field in a browser-as-a-server (BaaS?) product. How overall performance compares between Godot and Phaser, I don't know. I don't immediately know how to test that myself and I don't care to look it up to try right now. Maybe I just don't want to know. I can admit that. I am curious, regardless, in spite of myself.
One other perk with Godot is that it gives an easy route to native builds for Windows and Linux. (No apologies, but Mac has become too difficult to bother supporting anymore as an indie dev -- use Safari.)
Overall, I'm happy with Godot... but it sure can be a hard beast to love at times. Hard to contribute to as well with it's 5,491 open issues, onerous reporting expectations, and jerks aplenty. Expect most things to be swept under the rug. Perhaps more the fault of open-source circumstance than those involved (aside from the jerks). For free, however, it's outstanding and I'm hooked! See ya, Unity.
Photo credit: Tambako The Jaguar - Flickr
As to the game, this rewrite doesn't bring much in the way of new features. But, just because, I did add a few. Godot also helped me break many things. I eventually worked around most of those, but not all.
I upped the version to 0.3.0 mostly because of the rewrite. Not features. Features, however, should start coming quicker now that this big lift is done.