Wednesday, June 16, 2010

Angband on iOS and Android

I've been thinking about how to play Angband on handhelds recently, with particular reference to Android (which has come up on the Angband forums recently) and the iPhone/iPad (which are apparently conquering the world).

The two handheld ports I'm most familiar with are for Windows CE and the Nintendo DS. In both those cases, there is a touch interface designed for using a stylus with, which gives relatively fine control. Adapting the Angband UI to deal with that was a lot of work, but reasonably successful; although it should be said that fitting all the relevant info (even just map info) on a small screen is challenging.

For the new class of handhelds, though, the touch interface is finger based and much coarser. This presents a whole new set of problems; I think, though, that these are solvable.

For movement and looking at the map, the critical feature that I think will be necessary is a proper zoom. Luckily this is one of the primary features on iOS and Android. Pinch inward to zoom in and get a close look at what's about you, pinch outward to zoom out and make sure you don't get breathed on from a distance. Tap on a corner or edge to move, double tap to run. Flicking will scroll the map. Targeting will require care, but should be feasible.

The big question, though, is how to deal with the many non-movement commands that are required in Angband. Classically, these were just each given different keys - 'q' for quaff, then give the inventory letter label of the potion to quaff, for example. Even in this setting, though, the player needs to either bring up the inventory list to find the potion or have a subwindow containing the inventory. In the Windows CE port, the order was reversed - choose an inventory object, then decide what to do with it (noun-verb rather than verb-noun).

So, how to do it for iOS/Android? Subwindows are clearly not possible where there's limited screen space. Well, there's another ingredient from the WinCE and NDS ports that can be used here - buttons. Buttons can be standard (escape and repeat are two obvious ones to always have), user-configurable (playing the role of macros and keymaps) or context-sensitive (downstairs button appears if you're on the stairs). They could be always present as an overlay, or brought up as a gesture.

So this is almost a plan. Now all that's needed is someone to actually make it...

5 comments:

  1. General movement/action commands in angband can currently be accessed through the Enter key - it brings up a menu that can be used to select actions, information, etc. I've seen and used this in both curses and SDL ports - I'm assuming they're available in all interface versions. That gives access to up/down stairs, aiming wands, etc, if you can provide access to "Enter".

    Movement with screen clicks can work...but I've found it doing odd things in town sometimes (like moving in the opposite direction).

    This menu system however is not available in shops, options menus, help dialogs, etc. For those you really need some form of key/button presses to be available.

    It's critical that you have some method of providing the ESC (or backtick `) key sequence in shops & menus, otherwise you can't leave the shop or menu.

    Macros work in shops/menus (whereas keymaps don't appear to - at least they didn't when I was testing things). So an in-game macro can be used for critical key sequences.

    I'm not sure whether inscriptions make any sense for a no-keyboard version...but if they do, you'd also need access to {, }, @, ! and some numbers within the squelch menu to be able to create auto-inscriptions.

    I've just over the last week got Angband 1.1.2v2 compiled and working (SDL port) for Maemo 5 (Nokia's N900 linux phone uses this - and has a QWERTY keyboard of sorts). I've listed the actual macro definitions I needed to create for the Maemo 5/N900 port at the bottom of my "what I did" page at http://www.dawnmist.net/angband/

    The Maemo 5 port is built from the debian git repository source code with a few modifications in main_sdl.c to suit the N900's screen res & size, and to provide the required macros and a menu entry by default. I've provided a full copy of my modified code so that if I got exhausted and vanished someone else had a chance to SEE what was done and continue it :)

    Best of luck!

    ReplyDelete
  2. Gah, that should have read "3.1.2v2", not "1.1.2v2" *lol*

    ReplyDelete
  3. That looks very cool.

    There was a bug in click-to-move early on which made you start running in the wrong direction, and then have to correct - I can't recall if I'd fixed it before it went into Vanilla, so that may be the problem there.

    The 'no menus in shops etc' issue is one of the reasons why I used buttons.

    Both the WinCE and the NDS ports have a software keyboard available for things like inscriptions - I assume there would be a way of doing a similar thing in iOS/droid.

    I've got to say, the N900 looks like a nice Angband platform. I don't suppose there's a zoom...

    ReplyDelete
  4. Zoom within angband...no (although bigtile works as a sort-of zoom). Zoom in web pages, yes. It's done as a single finger spiral motion - clockwise to zoom in, anti-clockwise to zoom out if I remember correctly.

    I'm sure it could be made usable in other programs - but most of the special controls in the phone are implemented in the gtk layer...so you're looking at gtk or python-gtk bindings to get access to them. Not so useful for sdl - it's part of why the screen keyboard isn't usable in the sdl version. :)

    ReplyDelete
  5. Oh - you may also find this site useful - angband 3.1.0 for android: http://angdroid.org/

    ReplyDelete