Hi everyone,
So, I am trying to make a mobile SDL game as small as possible.
Currently, I am compiling each library (SDL, SDL_image, etc.) as a shared object, and then compiling my game all together into a shared library. The problem of using a library is that there is no official entry point, so the linker does not know what can safely be removed.
My compiler does not support --gc-sections
, so I cannot use that.
Do you know any other ways to make games smaller?
Thank you,
Alex
Have you considered using SDL_stbimage instead of SDL_image? It is more limited, but has fewer dependencies. If it has the functionality you need I think it is considerably smaller.
Hi
Thank you!
Maybe I just don’t know enough about C programming, but is it normal to write code like that C headers?
Why not put it in C files and compile it normally?
Is there any benefit to doing this instead of compiling all of SDL_image statically and eliminating that parts not used with ld/strip?
Alex
I use lodepng for importing images. It’s very tight.
Also don’t forget to define SDL_LEAN_AND_MEAN.
And are you using proguard on Android to obfuscate? That can reduce the compiled java considerably.
Another trick. Use android:extractNativeLibs=”true” in AndroidManifest.xml. This will make sure the native libs (which are huge) are compressed. It does mean Android will extract the libs, which will be a CPU & RAM overhead, but the APK will be smaller.