My first release! Not as fancy as I wanted it to be; but hey, it’s my first game and certainly won’t be the last. Will put it up on the AppStore once I’ve saved up for the hefty dev fee.
This could seriously be an interesting game. UI looks simple and good.
I feel colors mixing is intuitive but not for many people. Anyways, this game can be good time pass
Your listing looks beautiful. How did you get the binary down to just 2.4M? Even my first builds were about 7M.
I’ll pass on improving it. Been done, hard to beat etc. Plenty more things for me to match one day.
I’m not sure how I ended up with that size and I did not do anything special really. I developed my game in cocos2d-x v3.0 using Visual Studio and export my project using Eclipse to produce the APK.
Compression is done by the APK packager. APK is just an archive with compression, like a zip archive.
The compiler and linker flags differ a lot between compilers/linker. E.g. on gcc you have to use special flags and procedures. There are also the binutils, which can be used to strip symbols and dead code.
Different flags for optimizing your code are available. E.g. optimizing for size, instead for speed.
Read about the different options for different compilers here(it’s a little dated, but you can still apply it to new compiler versions). To get the best out of it, you have to read the compiler/linker manuals.
Basically you optimize for size with the option -Os and stripping all symbols and dead code form your binaries to get the smallest binary possible.
clang is used in combination with LLVM to analyze code and strip dead code. http://llvm.org/docs/LinkTimeOptimization.html
in Android.mk and shaved a massive 200kb off a 14.7MB apk! Apparently local linker flags have no effect on static units. So I subbed gnustl shared in which made 100kb bigger than 14.7MB. I didn’t get as far as making cocos2d-x recompile as shared unit. I’d better off hacking away at my original content vs library boiler plate ratio, I think.
You could also strip the symbols with -Wl,-s. You only strip dead code, and maybe there was no such code. The 200kb are cause of -Os.
Don’t compare the .apk file, as it is just a zip archive. Compare the .so file inside it, which is your binary.
What is your binary/asset ratio? When assets take >100MB, it does not matter, if your binary is 7MB or 2MB.
If you want speed and tiny binaries, there is no way around ASM. The problem is, the OS, kernels, binary formats for executable files and software are just bloatware. It contains legacy stuff from the 70s. Even the hardware is carrying a lot it.
Hello World - Plain C
8 858 bytes of readonly code memory
54 bytes of readonly data memory
8 712 bytes of readwrite data memory
Hello World - Embedded C++
8 928 bytes of readonly code memory
252 bytes of readonly data memory
42 644 bytes of readwrite data memory
Hello World - Full C++ with exceptions
21 963 bytes of readonly code memory
2 637 bytes of readonly data memory
42 680 bytes of readwrite data memory
If you code a “Hello World” in ASM for a true 64Bit OS written entirely in ASM, you will get this numbers:
30 byte binary. The actual code compiles to 18 bytes and the string is 12 bytes.
Yes, 30bytes vs. at least 17kBytes.
So you may see, that caring for binary size may not be worth it, if the system you are using/targeting is just bloatware itself.