Coming back to gamedev (pt. 2)
Continuing from my previous post, I wanted to troubleshoot further and resolve the remaining issues I had so I conclude which game framework to use. Today I’ll briefly talk about the problems I faced, and my progress with them.
Flixel
I couldn’t get HaxeFlixel’s flixel
command to run off my bash terminal. It works fine from Windows’ cmd
, but I preferred bash
. I originally thought it had something to do with Administrator rights, but it still didn’t work when I ran bash
as an Administrator.
Turns out, bash
doesn’t recognise commands for certain file extensions; In HaxeFlixel’s case, cmd
recognises flixel.bat
, but not bash
.
The solution was to type flixel.bat
instead of flixel
, and now it works in bash
! So to further clean it up, I just added an alias to my .bash_profile
: alias flixel="flixel.bat"
Unfortunately, out-of-the-box, I couldn’t produce the .exe
using lime build windows
:
Warning: Could not find Visual Studio 2017 VsDevCmd
Missing HXCPP_VARS
Error: Could not automatically setup MSVC
A little poking further (essentially, I forgot to run lime setup windows
), I got this message:
In order to build native executables for Windows, you must have a
Visual Studio C++ compiler with "Windows Desktop" (Win32) support
installed. We recommend using Visual Studio Community, which is
available as a free download from Microsoft.
I didn’t want to install VS2017, which is about 7gb(!) of installation size if I wanted the C++ libraries. I’m sorry HaxeFlixel. I’ll come back to you another day.
Ebiten
I came across this short article about reducing the build size of go applications. It worked!
I used go build -ldflags="-s -w" main.go
on the Hello World main.go
file, which reduced the original size of the main.exe
from 8mb to 6mb. Using UPX, via path/to/upx.exe main.exe
, the main.exe
was reduced further to about 2.7mb. Double-clicking it opens up the Hello World screen fine too.
The best part about the trick above is, the main.exe
is already compressed enough; Running gzip
on it doesn’t change the size any further.
On the other hand, I tried to use GopherJS as an alternative to the WASM build output. The original .js
output was 8mb, which was disappointing. Even with uglifyjs mygame.js -o mygame.min.js -c -m
(compressed and mangled), it only went down to about 4mb. This makes the WASM build of 2.3mb a better alternative. Considering the JS build size is almost similar to Love2D’s, I shouldn’t complain.
Love2D
Just wanted to clarify some potentially incorrect points from my previous blog post. “Compiling” the game is rather easy! It’s a 3-step process (at least for desktop build):
- Zip your game files, and change the extension to
.love
(It’s that easy!) - Open
cmd
and runcopy /b "path/to/LOVE/love.exe"+mygame.love mygame.exe
- Put the resulting
mygame.exe
in a new folder with the dll files (frompath/to/LOVE
), zip it, and distribute!
I missed the last step previously, so when I sent my Hello World to a friend, he got a “Missing SDL2.dll” error message. The base LOVE folder is about 9mb, so that’s the smallest it can go. Gzip did not help reduce the size much, unfortunately.
I really, really love how simple it is to start developing and distributing games with Love2D. It’s the perfect framework for game jams. The 2mb size for JS output is a little discouraging, but it’s a small sacrifice considering the extremely low barrier to entry :)
Heaps
I forgot to talk about the JS build from Heaps. It was relatively easy, with the initial build size being about 1.6mb. When uglified, it goes down to 900kb. When further gzipped, it goes down to a whopping 200kb, which is fantastic.
As for compiling the C project with GCC… Tonight was unfruitful again. I’ve searched around and landed on this page, which implies that I’m not the only person who is having difficulty getting started with Heaps.
Perhaps if I just installed Visual Studio, it would set up the correct environment and dependencies required for me to compile Haxe code (for HaxeFlixel and Heaps). For now, it’s just too much effort.
I’ve decided to stop here. I don’t want to waste anymore time troubleshooting this. Perhaps when the stars align in the future, I would be knowledgeable enough to figure out how to compile C or C++ code from the terminal. For now, I should focus on writing actual code.
Conclusion
My final contenders are Ebiten and Love2D. Of course, there’s a lot of other frameworks out there, but I don’t want to spend anymore time researching endlessly. I’m going to try out Ebiten for now, as I’ve always wanted to learn Go.