Friday, January 25, 2013

The Little Computer That Could

There was once a Little Computer called Pi. He was smaller than all the big computers around him. Pi wanted to do the work that the big computers were doing. He would love to run high resolution 3D games for all the gamers in the village. But the big computers made fun of him. "Oh, you are too small for HDTV gaming." they would scorn. But the Little Computer would respond "I think I can! I Think I can!" But the big computers would not let him run the complex games. "Too slow for rigid body physics simulations" they would say. Well, "Running physics simulations, I think I can, I think I can!" responded Little Pi.

On one day, when all the expensive computers were busy charging micro-transactions to their users, Little Pi was given the task to run a crane simulator game with complex rigid body simulation and render it at a 1920x1080 resolution. The programmer demanded a fluid 30 frames per second. The Little Pi was straining, but thought "I think I can! I think I can!" It began calculating the constraints and solving the matrices, it would spew out 2 MPixel framebuffers, and there it was. "I knew I could! I knew I could!"

If you want to play The Little Crane That Could on the big screen, now you can conveniently do so with a Raspberry Pi. This little $35,- computer packs quite a punch, and manages to run the game at 1920x1080 at 30 frames per second, albeit without the dynamic shadows. So why don't you head over to the Pi Store and get yourself a free copy of The Little Crane That Could.

Friday, January 18, 2013

Raspberry Pi Explorations

Since I got challenged to porting my game to the Raspberry Pi, I got myself one of these devices. Here I will document my explorations of this device.

  • I installed an OS image using RPi sd card builder tool.
  • Upon booting, you get access to a tool called 'raspi-config' which lets you resize the root filesystem to take up the full size of the SD card.
  • raspi-config also lets you change the keyboard mapping. This worked for the text mode keyboard, but in X I still have a UK keyboard mapping. Editing /etc/default/keyboard did not help. Typing 'setxkbmap us' in a xterm does fix it though. Why is this still a problem? It got reported a long time ago.
  • I am not impressed with the case I bought for it. It is very fragile and hard to open and close. My advice is to shop for something better.
  • Hooking it up to the DVI input of my Samsung SyncMaster 172w did not work. My Dell Ultrasharp works superbly at 1920x1200 though.
  • You can power the device with a microUSB cable that is pligged into an iPhone charger.
  • The graphics chip is the Broadcom VideoCoreIV and there is a github for it. Note that a misspelling as VideCoreIV is often repeated.
  • Apparently you can do OpenGLES2 without X.
  • A guide on EGL on the Pi.
  • The VideoCoreIV driver lacks both GL_OES_texture_half_float and GL_OES_depth_texture which would make shadow mapping a very expensive operation. I think I will have to leave out shadows from my Little Crane port.
  • I have not been able to find support for OpenSLES on the Raspberry Pi.
  • To get XWindow use the full screen on TVs, you need to disable overscan in /boot/config.txt
  • To get natural scrolling, like OSX does, you need to: apt-get install x11-xserver-utils followed by echo "pointer = 1 2 3 5 4 7 6 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap