Showing posts with label gp2x. Show all posts
Showing posts with label gp2x. Show all posts

Saturday, 28 February 2009

Version 1.1

Ledow has released version 1.1 of STPPC2x!

The latest version of my efforts to port Simon Tatham's Portable Puzzle Collection to the GP2X. This is a set of 31 addictive logic and puzzle games. Some are old favourites (like sudoku, sliding puzzles and minesweeper) and others you may not have seen before.



You can download STPPC2x immediately from the main website or from the GP2X archive. The music pack is unchanged and can be downloaded from the main website too.

So, what's new?

Collection:

Display - Show whether a game supports numeric input, a solver, etc. on the main menu, removed a couple of incorrect screen updates that could make the menu flicker, game preview images now centre properly (e.g. Maze3D's).

Gameplay - All games now have cursor-mode control, status-bar messages now "time out" rather than linger forever.

Input - Digit input for large games that need characters rather than just numbers.

Memory - Can now take advantage of the upper 32Mb of RAM should we ever run out of memory on the GP2X.

Screenshots - Now disabled by default, enable and press Stick-Click to use them.

Size - The size of the executable has been reduced by a number of means: removal of unused code, better final compression, shortening of static buffers, etc. Also, the images have been compressed more using pngcrush. This should save up to 500Kb on the GP2X.

Games

Cube - Massive memory usage (spotted by me) now fixed (by Simon Tatham).
Dominosa - More presets.
Guess - Fixed potential crash.
Loopy - improve generation of "Great-Hexagonal" games, quicker solvers.
Map - "Show immutable regions" option now removed - you can just press Y and the regions that can't be changed highlight in red.
Mosco - Fix completion bug, add end-of-game flash, clicking on the edge tiles highlights squares that could "point" to them, non-square grids and new presets.
Solo - Show intermediate lines properly, enable 4x4 etc. presets, add "Killer" Sudoku mode.

Feedback is appreciated and full source code is available from:

http://www.ledow.org.uk/gp2x/ or http://code.google.com/p/stppc2x/

Tuesday, 11 November 2008

STPPC2x v1.1 News

Just to reassure everyone, I'm still working on STPPC2x after my "version 1.0" release.

At the moment, I have the following in progress for "version 1.1":

Menus - Added indicators on the main menu to tell whether a game requires numeric digit input (e.g. filling, solo, unequal), supports "cursor key" control (e.g. sokoban, maze3d, etc.) or has its own solver.

Mosco - Various memory cleanups, a working "end-of-game" detector with "flash" ( so that you know you've won) - I left a bug in the version released for v1.0 that lets you complete the game even if some of the conditions aren't met.

Solo (Sudoku) - Perfect display with all the intermediate lines but in a "normal" resolution now. 4x4 sudoku is also playable because I've adjusted the "digit" input code (e.g. Press L/R to increase digit and X to enter it into a square) so that you can use the letters too... 4x4 sudoku needs 1-9, A-G, for instance.

Unequal - Because of the above, you can now play much larger unequal games too, and smaller games now only let you select numbers that are "in range" (e.g. 1 - 4 on a 4x4 unequal, 0-9 on a 10x10 unequal, 0-G on a 16x16 unequal etc.)

Loopy - New SVN updates provide better puzzle generation when using "Great Hexagonal" layouts etc.

I'm also working on a Kakuro puzzle, because it's nice to have a new puzzle each time I put out a big update.

Wednesday, 8 October 2008

STPPC2x Version 1.0

(Hopefully) The definitive version of my efforts to port Simon Tatham's Portable Puzzle Collection to the GP2X. This is now a set of 31 addictive logic and puzzle games (1 new to this release - Mosco). Some are old favourites (like sudoku, sliding puzzles and minesweeper) and others you may not have seen before. An awful lot has changed in this release, so make sure you read this whole thing!



You can download STPPC2x immediately from the main website or from the GP2X archive.

PLEASE NOTE: This release is a bit of a leap in how the collection operates. It is recommended that you create a new folder for this version - the directory structure has changed significantly. INI's and SAV's from previous versions are, of course, still compatible but may need a little renaming (same_game.ini to samegame.ini or rect0.sav to rectangles0.sav, etc.)

So, what's new?

- Mines now works 100%.

- New game - Mosco - written by myself, based on a puzzle I found in an old book I found lying around. There isn't a "proper" solver yet (by Simon Tatham's definition), but it will give a valid answer and determine when you have won.

- Perfect display of all games (no more mismatching lines etc.)

- Save / Load / Delete Savegame with multiple saveslots for each game.

- "Autosave" option to save whenever you come out of a game (so it gives the appearance of persistence - come out of one game, or quit the collection, and when you come back it's exactly how you left it). Off by default to prevent unnecessary writing to your SD card (hold L or R when starting a game to ignore any autosave).

- Game presets are now fully working - you can play the "difficulty levels" of games that have them, as well as create your own defaults for each individual game. (Hold L or R when starting a game from the main menu to skip your defaults, or hold L + R on the main menu to delete the config file for that game entirely).

- Music by Mr Lou is available in a (optional and seperate) "music pack" from http://www.ledow.org.uk/gp2x/ (Turned off by default - check the tracks you want to play in the Music Tracks menu and it will loop through them. Press to the left of a track name to sample it. Make sure Play Music is on and save the config on the relevant pages to get music all the time). Many thanks to Mr Lou for allowing me to use the track.

- Integrated game menu.

- Map now has an option to show "unmoveable" colours.

- New SVN version of Loopy which is much more complex and configurable. Old savegames may not be compatible (not my fault!).

- Fixed display of Solo to show up better on the GP2X.

- Screenshot feature on stick-click.

- Cursor key emulation mode (so that the D-pad/joystick) to let you play games like Sokoban easily - joystick will act like a joystick when this is turned on (indicated by a keyboard icon in the menu). Net, Light-up, Maze3D and Sokoban also support this option.

- Fix to Blackbox to allow the player to set minimum and maximum number of balls on the GP2X.

- Use the Y button in more games to support additional functions (hints, clearing digits etc.)

- A million and one other features and fixes.

Feedback is appreciated (especially from F-200 and USB mouse users) and full source code is available from:

http://www.ledow.org.uk/gp2x/

Note that this is an unofficial port - so please don't bother Simon Tatham with any problems, although he is aware of the project's existence.

Monday, 15 September 2008

More version 1.0 news

Version 1.0 Checklist - Current Status

30 fully-working games (including Mines) - Check
Perfect display of the games - Check
Loading of built-in game presets (Easy, Medium, Hard etc.) - Check
Presets menu can cope with any number of presets - Check
Saving your own custom preset for each game, with automatic loading of the preset for that game ("I like net to start on a 10x10" mode) - Check
Ability to bypass the above if you want when starting a game - Check
Blackbox fix (so you can enter, e.g. 4-10 balls instead of a fixed number) - Check
Map fix (so you can see which "countries" were given to you at the start and are therefore locked) - Check
Loopy fix (so that you can still use the "old" presets which are much more playable than the enormous presets in the new code) - Check
Up to ten save slots can be loaded, saved and safely deleted from within the game - Check
Auto-save option so that whenever you quit a puzzle it is saved in a special slot and the same puzzle in the same state greets you next time you run that game - Check
Ability to bypass the above if you want when starting a game - Check
Cursor-key emulation available for certain games (sokoban etc.)
Latest SVN (including a more complex version of Loopy) - Check
Background Music - Check
Volume control - Check
Track list (up to ten music tracks, only turn on the ones you want to play, if any) - Check
Music can be replaced by any OGG file - check
Tweaked floating-point (decimal numbers) support in some games configuration options - Check
Screenshot feature on stick click (with options to snap whole screen or just puzzle area and settings in a global settings menu to hide certain elements) - Check
Game menu can cope with any number of games - Check

Hourglass cursors, credits screens, SVN version number in the title screen, updated text throughout, general help for keys, nicer menu system, smaller executable, smaller distribution (you can even remove the music, which doesn't need to be there), and a million and one tiny tweaks - Check

Basically the only things that remain on my list for v1.0 are "Interruptible generation", a new verson of malloc() and some random code-style, duplicated variables etc. that I can prune but which don't affect the games at all.

Interruptible generation for the games which are "slow" by default (which seems to be Filling and Slide) shouldn't be too hard at all. Moving it to every game will take a bit longer as they all have different generation strategies and it'll take a while to understand the code and find the bottlenecks.

It's also a little tricky to "recover" from a interrupted generation cleanly, but it shouldn't happen too often, so that shouldn't be an issue. Mainly, it's where the game allocated a ton of memory to generate the puzzle and I missed that it should be cleaned up.

The new "malloc" (which allocates memory for the games to use) may well be implemented for v1.0 depending on how easy it is to do. The games already use a "safe malloc" within the puzzle collection for all memory allocations, which leaves the opportunity to extend it to be able to use some of the Video RAM on the GP2X too. Basically, when a "normal" memory allocation fails, it'll be able to carry on and provide a bit of Video RAM to use instead and the games won't even know the difference.

The whole procedure would be transparent to the games, but provide them with up to 32Mb of RAM extra if they need it. I can't see many current games needing it will provide a safety barrier should they touch on the 32Mb mark. I'm looking at a new game (which probably will come after v1.0 if at all) that might well come close to that mark on it's larger settings. Once you add multiple fonts, PNG's loaded into RAM, OGG files, etc. it's better to be safe for the sake of fifty lines of code.

Anyway, version 1.0 is iminent and in a more-than-releaseable state as it is. I just want to playtest some more (the wife is very good at finding bugs accidentally), get those two more bits of code in and then it'll be released.

Thursday, 11 September 2008

Feature-creep

Okay, so version 1.0 is slowly taking shape. Here's a few snippets of the smaller parts that are being worked on in between a lot of the "big stuff".

Firstly, there's a couple of things that I've put in there for my own use. For instance, there's screenshot code now, although probably the only person that will use that is myself. It's BMP-only (converting to PNG using libpng just looks way too complex to bother with) and I use it to verify the drawing is correct, to build the new animated GIF's for advertising the game and things like that. Unfortunately, because it needs to be able to activate at any time, this is one of those features that can't be slowly moved into the menus like almost every other new feature and requires a dedicated key. I've put it on Stick-Click for now because most people never press it (and it doesn't even exist on later versions of the GP2X), so it won't get in people's way.

It highlights a big problem that I have - the GP2X doesn't have enough keys! Unbelievable, I know! Excluding the basic up-down-left-right (whether as a "mouse" or "cursor keys") that are common to all the games, and the key-combinations I have for "safety" (e.g. L+R to quit back to the menu etc.) the "keys" required after moving almost everything into the Pause menu are:

Left-click (required in every game)
Right-click (required in a lot of games and sometimes essential to completion / player comfort)
Middle-click (only used in a handful of the games, and not essential to puzzle completion, but convenient)
Pause / Enter Menu
Decrease Digit
Increase Digit (the only way I could make unequal, solo, filling, etc. playable without a keyboard, but still not perfect).
Enter Digit
Undo
Redo

And the buttons I have are: A, B, X, Y, L, R, Select, Start. 8 buttons for 9 functions. So before release I'll be re-jigging all the keys. I don't want to move Undo/Redo into the menus but it's an option. I also don't want to shift a common key into a "combination" (e.g. at the moment I have L+VolDown for Undo and L+VolUp for Redo). I'd also like a key to switch between input systems eventually, so that for some games where it makes more sense to use a "cursor-control" system instead of a mouse-emulation one (such as fifteen and sokoban), the user can change between them at the press of a button.

Some "hidden" combinations need to be present to. Because the user can save their favourite configuration for each game as a preset, and that preset loads by default whenever they start that game, there needs to be a way to cope with two scenarios: The config save file gets corrupted, the config describes a game which takes an inordinately long time to generate. Imagine accidentally saving a config for Net, for example, that takes an hour to generate a game. You'd have to leave your GP2X on for all that time before you'd be able to change the options and play Net normally again. In fact, the easy solution is a little hidden feature - press L or R when loading a game from the main menu and it will completely ignore your preset. You can then get into the game ultra-quickly, change the options and re-save your preset if you need to.

At the moment, the options in the Pause menu are so numerous that they are now sub-categorised:

New Game
Restart Game
Solve Game
Configure Game
- View Presets
- Load "My Preset"
- {Load Preset X}
- {Configuration Option X}
- Save As "My Preset"
Help
- General help (Keys, etc.)
- {Game X} Instructions
- {Game X} Tips and Tricks
Global Options
- Music
- Track List
- Volume (including On/Off)
- Auto-Save Game on Exit
- Screenshots
- Include cursor in screenshot.
- Include status text in screenshot.
Credits & Licenses
- Puzzle Collection
- Third-party Games
- GP2X Port
- Music
Quit to Main Menu (the list of games).

I have decided on the background music I want and got permission of the artist - by strange coincidence, they own a GP2X so they'll be able to play the game with their own music. I've gone for some plinky-plonky ambient music - gentle, relaxing, simple. I'll also retain the ability for the users to replace or remove the music if they so wish - it'll just be 10 OGG files in a music folder. If they aren't there, nothing plays. If they are, they appear on a track list that the user can edit - so even if they don't like my choices, they can choose their favourite tracks to play while they puzzle. And, of course, there's the all important "Music Off" option.

General Updates:

The main menu shows the revision of STPPC that they are based on. This is so that people can see how old the collection is and whether it needs updating to support feature X of a certain game, or indeed any new games that come about. (There's a new, much more configurable, version of Loopy in SVN and it's already in my private version of 1.0 and working perfectly.)

The main menu is now complete and allows loading any of the 30 fully-working games (yes, 30, because Mines works now). It lets you go into and come out of the games as many time as you like without quitting back to the menu and is super-fast. I tried it on my GP2X for a laugh and after 200 entries and exits from particular games without quitting back to the main menu, I was suitably satisifed that I wasn't leaking too much RAM or risking a crash by playing that many games - this test included music, games with saved presets, full games, partial games, games with timers, loading/saving games, etc. A fairly accurate measurement of memory usage says that (with music off) the games rarely go about 5Mb of allocated RAM in their default configurations, although obviously most of them can be allowed to grow to silly sizes if you play with their config options. Without going too mad, I was able to generate "virtually impossible to solve within the GP2X's battery life" puzzles in all the games and didn't once get an out-of-memory error or crash. Although some of them nearly took forever to generate puzzles of that size!

Music works but may stutter on very difficult puzzle generation. There's not much I can do about this without increasing the size of the sound buffer - at the moment puzzle generation is an inherently single-threaded process and it tends to swamp the CPU and all other threads running. When interruptible generation is implemented (a BIG task), then it will hopefully solve itself because in the same place that I put code to check if the user wants to stop, I can refresh the music buffer.

I also know that Blackbox has a configuration option that can take values of the form "4-10" meaning "anything from 4 to 10". That's totally impossible to enter in the options menu in the current state (although you can happily use a Preset or hand-edited config file to play it!), but I may well hack on the Blackbox code to convert this to two configuration options: Min and Max. If you set them to the same number N, it's the same as just "N" in the config box, and if you set them to, say, X and Y respectively, it's the same as entering "X-Y" in the config box. I'll also be on the lookout for other similar options that allow such things.

Config-options are one of those things that are really finicky to convert to a non-keyboard device because they are expecting textual input all the time - the current GP2X code has always had a special "Kludge" switch that allows entry of floating-point numbers in, for example, "Barrier Probability" in net because otherwise you'd only have barriers everywhere or none at all. At the moment, such options are hard-coded in the GP2X code but I'm trying to find a nice way for the puzzles to support telling the so-called "frontend" whether a configuration option should be floating-point or not. It looks like I might have Simon Tatham's ear on that particular issue, however.

There's been a massive reorganisation of the files that the program uses. The folder structure is currently similar to:

Configurations/ (holds the game-specific INI files)
Documentation/ (holds various information about the collection such as licenses etc.)
Help/ (holds the various help textfiles)
Images/ (holds splashscreens and "game previews" that show in the menu)
Images/Screenshots/ (holds any generated .BMP screenshots)
Music/ (hold, erm, the music?)
Saves/ (holds all the savegames)
STPPC2x.gpe

So hopefully, there will be no more hundreds-of-files-in-one-folder and even the above folders should be as empty as they can be.

Finally (for this update at least), I'm looking at making a new game to go into the collection. It won't make it into the official collection, I'm sure, but I'm looking at the possibility of a simple overhead 2D maze game - I have some code that I can use for various "types" of mazes and solvers for them and I'm hoping they'll translate well to the small screen of the GP2X. That will be probably be a post-1.0 thing, though, because believe it or not, programming for that side of the collection is new to me!

Friday, 29 August 2008

STPPC2x v1.0 (Work in Progress Information Only)

It's been a while since I posted any updates here and in that time a lot of important things have happened within the GP2X community.

Most importantly, the GP2X has been discontinued (if you didn't know this by now, it was even on Slashdot's frontpage for a while!). This came as a great shame, but hardly a shock, to myself. However, I will be (and have been) continuing development as normal. I don't have an F-200, I don't have a Pandora (an "unofficial" GP2X successor-in-spirit), I don't have a Wiz (an official succesor). I can't afford any of them anyway. Until that situation changes, I'll be programming for the GP2X F-100 (with F-200 compatibility where I can manage it) and will keep programming. The GP2X rekindled my love of programming and I'll be both playing and coding on it until the day my personal unit dies. In fact, just lately I've been seriously looking at the prospect of buying another cheap F-100 second-hand if one comes up.

If I do suddenly manage to get any of those whizzy new machines, though, then I'll still be programming for the GP2X anyway - I prefer the challenge of programming for the lowest denominator. There is little fun in programming on a machine which just laughs at everything you throw at it (however, *playing* on it is another matter entirely!), and a set of 2D puzzles will never really stretch a powerful machine in practical use. So, I'll probably be leaving any Pandora/Wiz conversion of STPPC2x to someone else (to be honest, people would probably just use the official GTK versions on Pandora anyway, or their new Java ports).

That said, development slowed a little this month and last month but this was for completely unrelated reasons. What with a holiday and some end-of-term work at the school I work at, all programming activities took a back-seat. However, when I did get some programming time, I put aside my GP2X for a moment and attempted to update the Palm port of Simon Tatham's Portable Puzzle Collection, the code for which seems to have stagnated a little. However, this proved frustrating and, in the end, fruitless.

My wife has a Palm TX and we found that although the "official" Palm port of the puzzle collection works fantastically on a Palm Tungsten E2, the TX somehow ran the same executable differently. Most importantly, it often saw right-clicks instead of left-clicks all the time, no matter what options were set. This, obviously, made affected games absolutely unplayable. What was odd was that it only occurred in about 50% of the games and there was no way around it short of actually diving into the code and seeing what happened. Additionally, the Palm port doesn't include several of the games in STPPC2x and it would have been nice to get them working on Palm too, not to mention the various bug-fixes and new options that have been added since.

My attempts to recompile a test version of the Palm port proved much more difficult than I ever imagined. First, finding an appropriate build environment was nothing short of a nightmare - the SDK's are hidden away under obscure names that have changed since the README for the Palm port was written, contained only on websites that require arcane registration. After several hours (and some creative hacking), I was able to get a full suite of headers and compilers working. This is when the second and most damning problem showed up.

For some reason, the Palm has a very, very rigid memory structure and programs are written in segments of code that need to be of a certain size. No problem, the original Palm port took care of that with some ever-so-fancy scripting which tags functions so that they end up in seperate modules. With some creative tagging, all the modules are below the required size and they can all "talk" to each other - with nothing more than adding a function name to a script's datafile. However, because of the problems of getting the exact build environment that the original porter used, a straight compile no longer generates the same size code. Thus, a lot of the programs now need to be split into not just two but three or more segments, which greatly increases the complexity of compiling, linking and the various supporting scripts. In short, it's an absolute nightmare.

What started off as "I'll just compile this and see if I can find out what went wrong for Palm TX" turned out to be hours of frustrated downloading, hacking, patching, compiling of compilers followed by more hours of changing headers and filenames, editing scripts and lots of other fannying about just to get the original source code to compile once more in a useable fashion. After deciding to just speed things along and get the simple things running and work on the complex stuff later, I did get a working executable in the end, but without 40% of the games present in it because of the various code size changes and other problems. In short, it really wasn't worth the effort and was certainly useless for anything but a developer.

The frustration was so intense having fought to get to that point that I'd completely forgotten the original point of doing it all and in the end, never even got to looking at the relevant lines of code or whether a simple updated header could fix the problem. I would have spent 5% of the time fixing my problem and the rest just trying to get the original games back into a working state, let alone what would happen once I started introducing the new updates, games, etc. into the Palm collection. In the end, I left it for another day (month, year) and just kept hold of what I had downloaded/patched to get things working that much.

That meant that I was pretty sick of the Puzzle code for a while, although it was hardly the Puzzles' code that was at fault as much as the design of the Palm and/or the gcc compilers/linkers for Palm. Why all that can't be done automatically is beyond me but I'm sure there's a good reason, even if it's just "nobody got around to doing that". I tried other compilers and I tried searching for help but the answer was always the same "There's nothing we can do, split your code into smaller modules".

So, getting back to the GP2X (once I'd mustered some programming enthusiasm again) was an absolutely joy. Compile for x86. Link. Run on laptop. Compile for ARM. Link. Transfer to GP2X. Run. Rinse and repeat. Programming for the GP2X is a cinch in comparison and, more importantly, is intuitive and standardised. If something goes wrong, it's obvious and never anything to do with the compiler/linker being used. I ballsed up a Makefile once, so that things compiled oddly for ARM but okay for x86, but that's hardly anybody's fault but my own.

Unfortunately, my TODO list for the next (and probably "definitive") version of STPPC2x, with which I'm going to tempt fate and call v1.0, is very long but I am working steadily through it, even if I'm not putting out BETA's every month like I used to. A lot of the new stuff involves major infrastructure changes. The dodgy menu code that was thrown in with the intention of having some way to restart a game, and then changed to an actual menu to have some way to pause the game, and then changed to have some way to display the current options (in some of the most horrible code you'll ever see), and then repeatedly altered, bug-fixed and torn apart to fix some interface issues - well, let's just say that it's not going to be practical to extend it again and add the new options that I want to (such as using difficulty presets, etc.).

I've had a design for a new menu for a while and it'll look and work much better than the current one. We're talking a proper menu on the Pause button. With actual sub-menus. And actual proper changeable options. And an actual list of save-games. And an actual list of presets (including custom ones) that can be selected. And all without having to remember fifty keys or cramming it all into one screen.

It does involve touching some code that even I'm not sure I can remember how it works (I made a point of documenting the configuration-option stuff very heavily at the time, because I knew it would become a problem) so it's a big change to make that'll impact on a lot of things. However, all the "big stuff" is already in the code and it's just a matter of making it work in an intuitive way, in the right order, without bugs.

I need to factor out a lot of things to make the changes to the menu and thus there probably won't be many "preview" versions of the new code until it's finished: e.g. at the moment, you are "in the menu" or not, and the helpfile display "sub-menu" is a massive bodge. I need to change that so that you are "in menu number X" etc. so that the game only plays when you're not in a menu and options on sub-menus inherit from their parents etc. correctly and the key-press changes differ depending on the menu you're in etc.

It's a big job but I'm aiming for the magic 1.0 and I'm hoping to get it all working so that the program has that "professional" air to it, rather than the rather hackish backend hidden behind a nice PNG and some bash scripts that the user gets at the moment.

As a first step, I have integrated the "select a game" menu supplied by juanvvc into the main code. This is now just seen as "another type of menu" by the game, so it works much more closely and was a good way to see what sort of functions I need to have. This meant almost a complete re-write of that code but it now uses all the in-game functions to do its job rather than being a tagged-on executable that runs a script, that runs an executable to actually play the game. You won't notice, except that there are some tiny cosmetic changes such as the menu now showing the version number and being "part of" the main program.

Now one program is distributed and run, and the switch in and out of games is nigh-on instantaneous (However, it was pretty damn impressive before!). The Palm port was always the inspiration for this - it uses a so-called "Combined" executable (as does the MacOS port) that has all the games in it. That's now how the GP2X one works, too (after a massive migration from single-game-per-executable to monolithic-executable-that-can-only-run-one-game-at-a-time to the current "proper" combined monolithic executable). Additionally, it means that the "join" between the menu and the games is seamless - so, for instance, a music track could play across both without needing a jolt in between.

It does add a lot of complexities, though. For instance, it does mean that I have to check carefully for memory bugs because they will now accumulate if a player plays a long session of several games without quitting out of the thing entirely. I've already caught quite a few bugs that wouldn't have bitten people on the old menu but bite the second you change in and out of different the games themselves. There are also games which require a resolution change mid-flight if you run them - no matter how you play with them, some games run better in 320x240 and some in 640x480, so the menu has to know about them and switch between them. Fortunately, that's already done and dusted (although for some reason my PC has problems doing that same thing - I must update my SDL libraries!).

All these changes mean, however, that a lot of extraneous files and code can disappear and also that a lot of in-game facilities can make it back out to the menu. I'm hoping to eventually ship just one executable and the associated PNG's, helpfile TXT's and a single menu datafile. If I can manage it, I'd like to put everything but the executable into a single file (probably a ZIP or something) purely so that I can ship the minimum amount of files necessary.

The other thing that I'm working on as and when my mood changes is to have game "persistence". This was one of the things that working on the Palm port brought home to me - if you quit out of the game, you really should be able to go straight back to where you were just by running the program again. It's a bit like an "auto-save" whenever you leave one game and start another, or quit the game entirely.

It'll only work if you specifically leave a game, though, because otherwise it would involve writing to the SD card all the time which is something I want to avoid. Avoiding writes also means doing things like checking whether you've actually done anything to the game or whether you just hit the wrong game on the menu and then quit out straight away. If you didn't press a button, then there's no need to auto-save, which would save one "write" from hitting the disk. It also means that I have to be careful - what if that auto-save is corrupted, or what if it takes hours to load/redraw because it's a massive game? There has to be a facility for the user to ignore it. That means more menu options... All this adds extra code, simple though it may be, which needs careful positioning, checking and re-writing, so it all adds up. Like any big change, it'll be a option for people to turn off - for instance if they want to play on a write-protected card.

I also have some "bigger" items on the TODO list. One of them is to be able to stop a game halfway through generation. Unfortunately, this is quite a tricky one because the games are inherently designed to be single-threaded and non-interruptible while in generation (all the official ports suffer from this and the Palm port suffers especially badly). However, there are a few tweaks to the code that can be made to make them interruptible (even if it takes a few seconds for the interrupt to be "seen" by the program). It means adding code to each and every game, unfortunately, but I think it's a sensible thing to do because hitting a large Bridges game by accident could leave the user with no option but to kill the whole GP2X (or at very least telnet in and kill the process). That's an ugly way to play a game. And now that we have a nice integrated menu to fall back to, there's no reason it can't be done in a nice way.

I'm also pretty certain that the games just aren't drawing themselves properly, even though it's damn close. Other ports show clean lines on all resolutions but the GP2X has some overlap issues. This has been there since the start but I was always of the "it's playable" mindset before so I left it well alone. Unfortunately, without single-stepping the code or sitting down with some graph paper and manually following along, it's rather difficult to see where the problem lays. I'm guessing that there is an off-by-one error somewhere but there are so many "definitions" of the various graphics routines involved that it's hard to track down - does setting a clip rectangle of 10x10 at 5,8 mean that it extends from 5,8 to 15,18 or from 6,9 to 15,18 or from 5,8 to 14,17 or what? It looks likely that I misread something and made a small error between the translation of the puzzles concept of "clipping", "blitting", or "drawing" and SDL's concept of the same. This would fix such things as Solo's missing lines.

One of the other things I have added is massive amounts of debugging code, turned on by compiler options, which should be able to resolve such discrepancies once and for all. It's just a matter of running a debug-compiled version on the PC, capturing the megabytes of debug logs and then manually replicating them on graph paper to see what goes wrong and where.

Then, I have a few extra bits of "polish". I'm considering a musical background noise. I wouldn't normally bother but it's v1.0 and it's a very simple thing to implement. The games seem to have more than enough spare capacity to play music too (the Palm port is noticeably slower on similar-MHz models) and I've found a couple of relaxing background tunes on a Creative Commons site, so when I get bored of the dreary work, I'll plug in some code for that. I've also considered short sound effects for such things as entering a game, pausing it, pressing a menu, clicking within the game etc. None of these things will affect anything if the player doesn't want them - they will be easily turned on and off and may even be off by default.

There is also supposed to be a way to "write down" the definition of a puzzle, so that you can pass it to friends. This is implemented as "Copy" in the desktop versions of these games but I consider it a bit pointless in the modern age. If the GP2X could do Bluetooth or something easily then I would use it as a basis for a "Beam game" option similar to that present on many Palm games. As it is, I might implement it as a menu option purely because it's so simple to do (call one function, get the "answer" as plain text, display it on the screen) but I don't see anybody using it. With the new menus, it can be put there without getting in the way.

The puzzles also have "print" options, but I'm deciding to leave those out entirely because I very much doubt anybody would bother to print them off, and adding the whole Postscript-creation routines into the puzzles is a bit overkill for a function nobody will use and nobody can use easily anyway. You would have to "print" the puzzle to a PS, or possibly PDF, file on the SD card, take it to a desktop machine (which has its own port of STPPC which understands the same savefile format and can print direct) and then send it to a printer. Because it's achievable in an identical amount of time, with an identical process, just by moving a savefile over to the PC version, I'm leaving it out.

I'm looking at downclocking the GP2X when it's not being taxed (i.e. most of the time it's actually in-game or in the menus, but NOT during puzzle creation when the poor thing struggles along) but I've still to experiment and test this thoroughly (when testing, you want to get into the parts you know are buggy as quickly as possible!). There would be a problem if it decided to throttle itself back on a certain game which would actually benefit from going faster and so just frustrate the user for no reason. I don't know if and how it would affect battery life but I hope that running at a slower clock speed is actually better for power consumption that just idling at a higher clock speed. There is a lot of take account of, though, because the cursor-motion and input is tied to the speed of certain timers and it would be very bad if they started getting lagged or overwhelmed because of the number of events happening while it was running slower.

There are lots of other things that I want to do but they are either trivial, cosmetic, only affect the source code, or they really aren't worth mentioning. I don't know when v1.0 will be finished but it will be finished sometime - every time I find myself in a programming mood, I'm on the GP2X straight away. Every time I play the GP2X, I suddenly find myself hacking on the code.

All in all, STPPC2x has been great fun so far and it's only recently that I've actually figured out how to win all the games in it! I still don't succeed every time, and Tents and Blackbox are often the most surprising ones - you get to the end by applying what you think is perfect logic and then you just cannot fathom the answer. Sometimes you can get it by restarting that same game but sometimes you just have to reach for that Solve option and then you start kicking yourself!

I do want to get out a v1.0, something to say "this is a real port of the games", I want it to be polished, I want it to be complete and I want it to stick around with the GP2X. Probably nobody else will continue the port to other platforms based on this particular code (although a couple of people have borrowed the early SDL code that got the games to a playable state for things like PlayStation Portable ports etc.) because there's such an abundance of power in modern consoles to just run the original versions or simple modifications - there are even Java ports of the collection now. But to have hold of a classic games console, quite rare, quite unique, very open, and to have a copy of a polished port for it that I know I wrote - that's something I want to be able to do. I don't care if nobody ever downloads it or nobody else owns the hardware to run it, but I'd like to be able to show it to people and say "I did that".

In twenty years, I want to find my GP2X in a dusty old box somewhere and spot an SD card with "STPPC2x v1.0". I want to plug it in and show any kids I have: This is what I did. This is how we used to make computers work. This is the code and tools I used to do it. This is what a lot of companies "these days" try to make you think is done in a magic box at Microsoft. Look, despite it being 20 years ago, I can still load this stuff up, I can still know how it works, I can still fix it when it goes wrong. Let's have a quick game of it before I put it back.