News for hackers. Stuff that matters.
Re:Flappy Bird for Android, only C, under 100KB by habibur on Sunday September 22, 2024 @04:49AM (#41615641)
Less than 4k loc.

   457 android_native_app_glue.c
   360 audio.c
   802 game.c
   201 init.c
    93 main.c
    39 mouse.c
    38 shaders.c
   229 texture.c
  1377 upng.c
    27 utils.c
  3623 total
Re:Flappy Bird for Android, only C, under 100KB by kgeist on Sunday September 22, 2024 @07:23AM (#41616305)
A student of mine had an assignment to write a game using SFML, they wrote a FlappyBird clone and it was like a few hundred lines of code. It's not a very complex program to write. To be honest, I think 4k is too much :)
Re:Flappy Bird for Android, only C, under 100KB by dario_od on Sunday September 22, 2024 @07:35AM (#41616354)
Are you including SFML loc in that total?
Re:Flappy Bird for Android, only C, under 100KB by kvemkon on Sunday September 22, 2024 @07:51AM (#41616408)
3623 total - 1377 upng.c (3rd-party tiny PNG image decoding library) = 2246
Re:Flappy Bird for Android, only C, under 100KB by snvzz on Sunday September 22, 2024 @07:33AM (#41616347)
To be fair, Android itself requires some level of fluff.

So does making the game work well in more than one device.

Re:Flappy Bird for Android, only C, under 100KB by charles_f on Sunday September 22, 2024 @01:08PM (#41618349)
game.c is 800 odd lines. There are some optimizations you could do here and there (e.g load digit sprites in an array to avoid the switch case 1/2/3... stuff).

The bulk of the 3000 is fluff that you need because this is C on Android, not SFML.

Re:Flappy Bird for Android, only C, under 100KB by londons_explore on Sunday September 22, 2024 @07:32AM (#41616345)
A shame that 4k loc compiles to over 100k of binary size.
Re:Flappy Bird for Android, only C, under 100KB by kvemkon on Sunday September 22, 2024 @07:55AM (#41616423)
actually including both architectures: armeabi-v7a + arm64-v8a

to check:

- dependencies statically compiled-in

- debug symbols

Re:Flappy Bird for Android, only C, under 100KB by lern_too_spel on Sunday September 22, 2024 @10:50AM (#41617476)
It doesn't. The total APK size is less than 100k, including images and sounds.
Re:Flappy Bird for Android, only C, under 100KB by mdp2021 on Sunday September 22, 2024 @11:44AM (#41617827)
It compiles to 37kb of 32bit code and to 48kb of 64bit code.

  /lib/arm64-v8a/libflappybird.so    48kb
  /lib/armeabi-v7a/libflappybird.so  37kb
  assets:     29kb
  icon:        3kb
  signature:  12kb
Plus the manifest (2kb) and resources.arsc (0.5kb)