Pixel Dungeon


While I played a lot of tabletop RPG, I’ve never really been a fan of computer RPGs, I does not mean I do not enjoy playing them once in a while, I really like Dungeon Siege II, and Torchlight, but I generally prefer strategy games. Pixel Dungeon was the first 2D RPG I really enjoyed, as the name indicates, the game artwork is reminiscent of 8 bit games.

The game’s goal is pretty standard, get to the lowest level of the dungeon and get the amulet of Endor. Every few levels, there is a boss to slay, you pick up spells, potions, weapon and armour along the way. Most of the time, you don’t know the effects of any item, so you must either discover it by trial and error, or use an identification spell. Some items are cursed, some potions are toxic, or flammable. Food plays an important role as you typically need to find a food item per level to survive.

Where I found the game very interesting is the handling of the physics: toxic gases diffuse, fire spreads, and the interactions between spells and the environment is complex: a flaming dart can put the whole level on fire, destroying spell scrolls, doors, and cooking meat, and potentially kill you. Lighting spells work better in water, but also affects you when you are too close to the target. This is a game that encourages you to think about the effects of your magical items.

Pixel dungeon is an Android app that you can find on the play store, it is free, but you can donate to the author (I did).

Screen capture of a web view of a proposal for an apocalypse shopping value label

Touch interfaces and fever

Screen capture of a web view of a proposal for an apocalypse shopping value label

People often talk about accessibility in interface design, but it remains an afterthought, something for the next version, version one is for normal people. I was sick these days, which meant using user interfaces while having fever. While the experience itself was not pleasant, it was interesting to see what worked, and what did not.

The first observation is that my precision went down the drain, when using a mouse I could just go slower, but for touch interfaces this was really a problem, I missed these tiny links and targets, multiple times. Text-selection was really hard in both iOS and Android, although iOS seemed to a have a better clue on what I was trying to do. As usual, having controls for opposing actions close to each other is a problem.

The second observation is that my attention span was greatly reduced, so I would get confused by application that did not acknowledge my action in some way, the worst are Android applications that are stuck in garbage collection and do not react for three seconds. This also meant I had trouble keeping track of state, I found app that embed a web-view pretty confusing, you expect Facebook, but you have some random news page, with a slightly different web-frame indicating that you are, in fact, not in the web-browser – try to guess in which application the screen-capture picture here is. The notion of back navigation is pretty fuzzy when your brain cannot hold the state, yielding random results and frustration.

Some icons are really not intuitive, I ended up staring at some for ages, with no clue whatsoever on what they could do. Finally, some special effects are painful to watch, in particular the RGB beam out of sync effect of Android being turned off.

A map with Lal's building to the nord-west and Gaia's daughters to the south east

How to run Alpha Centauri in Windowed Mode

A map with Lal's building to the nord-west and Gaia's daughters to the south east

Sid Meyer’s Alpha Centauri is probably my favourite turn based strategy game: the mechanics are quite close to Civilisation II, but the factions and the fact that you can shape the map with terraforming actions makes it more interesting. Thanks to Good Old Games, it is possible to run that game on a Modern OS X machine. Problem is, the game runs within Wine which emulates the Win32 Api using Xlib (X11). This is probably as inefficient as it sounds, but we are talking about a game designed to run on a 133 MHz Pentium and 16 Megabytes of RAM.


There are two problems with the good old game version: first the keypad is not properly emulated, so even if I attach a keyboard which has a keypad, I can’t use it for controlling the units, this is annoying, but you can use the mouse to move units in diagonals, and the arrow keys for direct moves.


The other annoyance for me is the fact that the application runs full-screen and does not take well to be switched away. I found how to go around this the following way:

  • Navigate with the Finder to the icon of the game (Alpha Centauri Alien Crossfire)
  • Right-click and select Show Package Content.
  • You should now see an application icon named Wineskin, double-click on it.
  • Click on the Set Screen Options button.
  • Select Rootless (Windowed).
  • Close the (screen option) window.
  • Click on the Advanced button.
  • Select Force use of wrappers quartz-wm for window decorations and not what is on the system
  • Select Force use of system installed XQuartz of using built-in WineskinX11

Of course for this to work, you need to have X11 installed on your Mac.

A tyrannosaur lift down into an Sarlacc pit

What if

A tyrannosaur lift down into an Sarlacc pit

I’m a regular reader of the and sometimes read the which answer more or less absurd questions with physical explanations. The book what if, from that section.

While the question asked are often whimsical, for instance: what happens if everybody points their laser beam to the moon, the question are hard science, and very often hard-core, people must be warned: the book contains a large amount of things dissolving into high energy plasma.

What If

Mariner Books
ISBN : 978-0-544-45686-0

I found Munroe’s writing style very pleasant to read, and the amount of technical jargon stays very reasonable, I read this book while being sick and still had no problem understanding. There are, of course many illustrations by the author that help explain the problem, or they are just funny. While the book is thick, it is far from long (~300 pages).

In conclusion, a funny book I recommend to everybody.

Apple Menu, Safari Menu window top and wordpress content

OS X Ten

Apple Menu, Safari Menu window top and wordpress content

One thing that used to fascinate me in Ikea shop were the fake computers: plastic shells, with the screen’s content printed out on some adhesive transparency. They never contained a real user interface, more a designer’s vision of a UI, with an extremely high-resolution, you could never see the pixels.

When I installed OS X version 10 on my laptop, it was connected to an external display, i.e a low resolution screen, and my first reaction was, it look horrible. Then I disconnected the displayed and used it as a standalone laptop, and my thoughts were that someone finally implemented this Ikea user interface: the font is Helvetica and the user interface is extremely pure, a lot like the tools I have seen to do UI mocks.

While there still are pixels down the line, they are not relevant anymore, this new UI could have been draw using vector graphics, while this is not the case, just a trickery of multiplying everything by two. Vector logic will come later, maybe. The important thing is that pixels are not important anymore, in a sense this is the same transition as when colour stopped being an issue: pixels were in RGB, no discussion.

Some of the default apps have been redesigned, most notably Safari, the UI is now closer to the iOS version. Under the hood Safari uses LLVM to compile JavaScript to native code. Up until now it feel fluid. Among the default apps I use, Pages, Preview, there are not many changes, although the tools to annotate images in arbitrary places pop-up in Preview. The biggest change is Spotlight, which is now much more central and shows results from various apps (including the dictionary which is nice).

Under the hood, I could not find many changes, the terminal program has become more user-friendly with mouse-scroll and search support, sometimes it scares to see how far this DEC terminal emulator was dragged. I did not have the opportunity to test out the continuity features, i.e. the ability to answer phone calls on the laptop. What I find interesting is that my phone now always appears among the possible WiFi hot-spots.

I have the feeling that Apple is somehow following Intel’s tic/toc approach to release, one of two has many internal changes while the other is about UI and new APIs. Yosemite clearly falls into the later. With its focus on extensions and integration APIs, it was to be expected to have few visible changes, they will come when developer embrace them.

If you have a Mac with a retina display this update is really nice. For the other, the new UI might be a problem. As always, Ars Technica has a long and exhaustive review.

Mini tower PC with 2 optimal drives, 4 media ports, one floppy disk and sound input/output

The dock distribution

Mini tower PC with 2 optimal drives, 4 media ports, one floppy disk and sound input/output

I recently bought a Belkin Thunderbolt express dock for my new Retina laptop, basically there is one input Thunderbolt port, and the dock provides gigabit ethernet, Firewire, multiple USB ports and a sound-card, while acting as a pass through to send video data to the actual monitor. The upshot is that I only need to connect two cables: power and Thunderbolt, and everything works.

What I found interesting is that I bought some hardware for something that could have been done by an old-computer, if only the right software existed. I call this software the dock distribution.

One nice feature of Macintosh computer is ability to boot in target mode, that is the firmware does not load any operating system, instead it presents itself as a hard drive that can be accessed over FireWire or Thunderbolt, while this is not meant for everyday use, it is a nice way to recover the drive of a laptop.

The dock distribution would take the same concept: boot it on an old PC, and all its hardware is available to a laptop (or another computer), including:

  • Hard drives
  • Optical drives
  • Ethernet port
  • USB ports
  • Sound-card
  • Media readers
  • Floppy drive

Basically, you would use an old PC as a grab-bag of hardware.

The dock computer would connect to the laptop using FireWire, many desktop computer sported such a port (even if it often never got used), if not, adapters are cheap nowadays. Many of the components mentioned above (storage and sound devices) can be expressed as standard FireWire profiles

Does this distribution exist? Kind of LIO and SCST seems to implement the storage part, but it is clearly targeted at handling iSCSI for servers, not reusing old PC hardware.

Of course, one could argue that instead of sharing all this hardware as a hardware emulation, one could install some server software for each of these services. In my opinion, this is a bad idea, setting up a service implies a lot of overhead: access control, networking, with typically bad support for disconnecting stuff, while the hardware layer had the notion of plug and play for ages. Also hardware standards are pretty well define, whereas on the software side, there are typically X competing and incomplete projects.

HP Pavilion a367c © Columbustech, Inc – CC BY-SA 3.0

Open RA

Screen Capture of Open-RA with a skirmish in Dune 2000

One of my favorite type of computer guides is real-time strategy type (RTS), a genre I discovered with Command & Conquer and Warcraft II. I had missed the first game of that type, Dune II, which I brought much later.

I have all these games on some CD in my basement as I bought them when they became classic (and cheap), but booting a machine with Window XP is to much of a hassle nowadays, so I was very happy to discover , a system that clones some Westwood games of that style: the original Command & Conquer (which got the additional name Tiberian Dawn once this became a franchise), the first Red Alert and Dune 2000.

Screen Capture of Open-RA with a skirmish in Command and Conquer

The games are not perfect clones, but instead re-creations that reuse the original game assets, the sprites and the sounds. This means there a few features from Red-Alert that were back-ported to the Dune and Command & Conquer: crates, unit-experience, etc.

The code is implemented in Mono and is pretty fluid, the installation was very smooth. The games can run in full-screen or within a window, there is an option to enable pixel doubling, but on a retina screen, where the pixels are already double this would be a bit overkill.

So if you are, like me, a fan of these old-school games, I really recommend you to have a look.

Connecting an old API

x-term icon, not really pretty

I managed to improve my program a bit this week-end, the icon on the program sending the event is now converted to a growl icon within the program and not round-tripped via the file-system. Using the file-system has the advantage that I could use existing APIs: X11 knows how to export files in the x-bitmap format, a format that strangely enough, OS X still can read. Safari on OS X is one of the last browsers that supports that strange format (don’t bother checking for buffer overflows, I already did).

Doing the conversion explicitly in the program required some API archeology, I used XLib a bit when I was in the university, but I have largely forgotten what I did then, and I was mostly concerned in pushing pixels out, her the goal is to read some structures provided by the window manager.

I managed to get something that kind of works, which basically mimics the behaviour of XWriteBitmapFile, resolving the pixels using XGetPixel. This means I can get the same black/white images I already had, but instead of pushing to a file, I write the data into a buffer which I give the Core Image, which I used to scale the image and serialise it for Growl.

The frustrating part is that XGetPixel does not return information in RGB format, instead I get a reference in some colour table. From the documentation, I should call XQueryColor to resolve the colour into RGB, but when I do so, the whole program crashes with an illegal access. So I’m stuck with OK images for basic programs like xlogo and broken ones for things link xterm.

It is interesting to consider the two graphic APIs I’m trying to connect: their designs are a quarter century apart the first one handles colours as precious resources that are named and allocated and associated with a screen, you cannot simply work with an unattached image buffer. The other is all about buffers and transformations, memory is not the main constraint, but structuring the data-flow in a way that is understandable for the GPU is.

Anyhow, the new version is available in the releases section of github.

Unix top command running in xterm (X11) and the native terminal app with retina resolution

Retina Macbook

Unix top command running in xterm (X11) and the native terminal app with retina resolution

I have finally bought a new Macbook with a retina screen for my personal usage. Retina is Apple’s marketing word for screen resolutions above 100 PPI (pixels per inch), typically in the 200-300 range. I had one for some time at work, and I really liked the quality of the image of the screen. It used to avoid coding on the laptop screen, I preferred connecting the laptop to a large screen to do so. Since I changed laptops, I realised I’m pretty happy to code on the smaller laptop screen.

I do quite a lot of reading on my home laptop, not to mention reading and coding for my pet projects, so the resolution difference is quite staggering and I feel that my eyes are getting way less tired. The last time I felt such a change was the transition from CRT monitors to LCD.

Photoshop Elements 9 on a retina screen

The other big transition is move to an SSD, which translated into two disappearances: disk noise, and slowdown when loading. While not that disturbing, the noise of the disk spinning up and down was pretty noticeable, less noise is always good. While I cannot claim that the computer is never slow, the number of noticeable slowdowns are seriously decreased, in particular when launching application with state like calendar or the address book.

The main problem with this transition is that many things now look ugly. Pure Cocoa application do pretty well in the transition, with only the icons looking blurry, but my old copy of Adobe Photoshop Elements looks horrible, as everything is in low resolution.

The same issues arises with web-sites: simple designs that use modern CSS and things like web-fonts look great, those that have many bitmap images not so much. On this blog, I installed a plugin called WP Retina 2× which replaces images with their high-resolution counter-parts on a high DPI display. Of course, this only works if there are high-resolution assets on the blog, for many past blog entries, I had actually hand crafted a 250 pixel wide image, so the plugin cannot do much. Of course, SVG assets always look good, if only WordPress supported them better…

While it is nice to see the desktop world finally breaking away from the 100 DPI screen resolution universe at a large-scale, the sad part is that this was done by just doubling the pixels and not switching to using more vectors. Maybe now that the fashion for UI is going back to a flatter look, we will see a more widespread use of vector assets, but I fear this will require a large shift in the designer community.

Growl notification displaying “xkbgrowl works!”

xkbgrowl – memory management

Growl notification displaying “xkbgrowl works!”

I have created a new release for xkbgrowl, the main visible difference is that the tool should now use the XQuartz icon as default icon, instead of the generally missing X11 app icon. Less visible is the change I did to the code related to memory management. The original code was using C style strings and memory pools and doing manual reference management on the objective-C side. I rewrote the code to use std::string as much as possible, and it is compiled using ARC. As a result, the code is simpler, and the only manual memory management is related to X11 structures. Finally, instead of a simple zip archive, I built an installer package, which should, hopefully, put all files in the right places. The package is available from github.

The change I would like to do, if I have the time, is to rewrite the image conversion logic, currently the tools emits a xbm file on one side, and reads it from the other, which involves a round-trip to the file-system, but also forces all the images into 1-bit depth.