Got 45.2 compiled for Nokia N900 -> not playable (yet)

  • aapo
    20th Jan 2011 Member 0 Permalink
    Hi, I saw on forum speculating about tpt on Nokia N900 (Maemo5) and I tested it.
    I compiled current git version, I think it is almost version 45.2.

    With crosstoolchain and needed libraries installed, it was only:
    gcc -DINTERNAL -opowder -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -lSDL -lm -lbz2 src/*.c

    Game will start on N900, but it is slow, 4-5fps, even on empty screen (Parts=0). E.g. when game instructions are fading out, user will get almost bored.

    N900 has screen resolution 800x480, but there are big statusbar on Maemo, so SDL_FULLSCREEN was needed.

    N900 has qwerty-keyboard, but without ESC and alt. (q=esc, but is alt necessary?)

    With stylus and touchscreen right-mouse-button, middle-mouse-button and mouse-on-hovers are all omitted (-> user must now how to play because there are no tooltips)

    N900 supports GLES, so if every gl-calls are ported to gles, it can run better on N900 (or is it all about raw computing power?).
  • Xenocide
    20th Jan 2011 Former Staff 0 Permalink
    The FPS is why it's not really much good on embedded platforms.

    Could you provide links to the needed libraries and crosstoolchain, as well as any sites you used to help you compile. I'm also sure you can make more optimisations.
  • aapo
    20th Jan 2011 Member 0 Permalink
    Maemo5 uses officially Scratchbox environment:
    http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation
    (It is used also on autobuilder when releasing packages via repositories)

    I'm using Scratchbox2 (=sb2) and this is installation instruction I have written:
    http://jammo.garage.maemo.org/crosscompiling.html

    sb2 is used like debian (and technically sb2 is not "crosscompiling", it uses QEMU and arm-binaries)
    I had so much already installed, but I can guess with ldd:
    sb2 -eR apt-get install build-essential libsdl1.2-dev libbz2-dev libasound2-dev libpulse-dev
    (I think it is same than fresh Ubuntu)


    Is there any premade optimizations in code not default used? Frameskipping? Is some visible-mode faster than others? How empty screen can be only 5 fps? If I could easily test something before I have time to dive deep to code.
  • Xenocide
    20th Jan 2011 Former Staff 0 Permalink
    One option could be to reduce the number of displays available. Personally, I would reduce it down to Velocity, Pressure and Nothing displays.

    I'm curious about the asound and pulse libraries, there's no sound in TPT so are they really needed?
  • Made2Shred
    20th Jan 2011 Member 0 Permalink
    @antb
    pressure, nothing, fire/fancy
  • aapo
    20th Jan 2011 Member 0 Permalink
    About asound and pulse: maybe all sdl applications are linked to them on Maemo5. I'm not sure what happens if they are not installed.

    I think reducing number of display-modes doesn't affect. Modes are used on 'switch-case':
    https://github.com/FacialTurd/The-Powder-Toy/blob/master/src/interface.c#L530
    Or 'if-else':
    https://github.com/FacialTurd/The-Powder-Toy/blob/master/src/graphics.c#L1378
  • Xenocide
    20th Jan 2011 Former Staff 0 Permalink
    well its less switching and if'ing... and a smaller file size
  • jacobrb
    20th Jan 2011 Member 0 Permalink
    you put powder toy on a phone? wtf?
  • aapo
    20th Jan 2011 Member 0 Permalink
    >you put powder toy on a phone? wtf?
    Yes this is Curse of OpenSource, somebody uses code on places where it is not ever planned.
    -----

    I decreased resolution of the game and got it faster (not surprise).

    (includes/defines.h)
    #define MENUSIZE 40 //not changed
    #define BARSIZE 17 //not changed
    #define XRES 383
    #define YRES 200

    (src/main.c )
    kiosk_enable = 1;
    sdl_scale = 2;
    hud_enable = 1;

    Now it is running fullscreen 800x480 and icons are big enough to press.
    Maybe this is obviously, but:
    (YRES+BARSIZE)*scale = (383+17)*2 = 400*2 = 800
    (XRES+MENUSIZE)*scale = (200+40)*2 = 240*2 = 480


    It is not very fast, but "almost-playable" (everybody can define this term for own)
    #Part | FPS
    empty | 12
    2000 | 10
    5000 | 8
    10k | 6

    Smaller resolution fastest it more -> causes black borders and there are less to play.
    What is the limit for resolution that game is still fun?
    What is the limit for speed that game is still fun?

    I hope there are still something else to do.
    e.g. Stripped binary size is still almost half mega (449k)

    See screenshot: http://img121.imageshack.us/img121/5601/thepowdertoyn900.png
    There are too much stuff on the bottom row.

    Now I realized that keyboard is also missing Insert (and backquote), TAB and Caps Lock. And I didn't previously explicitly mention, but there are no Mousewheel.
  • plypencil
    20th Jan 2011 Member 0 Permalink
    I would say 12 FPS is the lowest for fun play,
    and halving what TPT was originally in the screen size should be a nice size still (half height, half width, so a quarter)

    Well done for the conversion, I do not know much about the SDK's but would they be at all compatible with non nokia products?
    And just remap the missing keys to something different :)