PalmKobo logo

The PalmKobo Stage Sets System

PalmKobo gets information about the stages (levels) to be played from databases. Each database contains a single stand-alone 'set' of stages. The game's behaviour when the player successfully completes the last stage in a set is determined by a setting in the game's Stages dialog: they either start again with a more difficult version of the set's first stage or they see a congratulatory message and the game is over.
PalmKobo can cope with up to sixty-four sets of stages at once. It remembers which set of stages was being played last as well as the highest stage reached and the highest score attained in each set.

The Stages dialog allows the player to select:

  • a set of stages to be played;
  • the stage to start on (If the set has not been played before, only stage number one may be selected. Otherwise any stage up to and including the highest one previously reached may be selected);
  • whether to end the game or to return to the first stage after the set's last stage is completed.

PalmKobo allows any stage(s) in a set to be encrypted so that they can be accessed only if the player enters the correct key-code for that particular set of stages. Key-codes also depend on the device owner's HotSync ID - they are not 'portable' between devices with different HotSync IDs. All this makes it possible to restrict and/or sell access to any or all of the stages in any set.
To provide a little security to the encryption system, stage encryption and key-code generation can only be done by the author. At present I do not intend to charge any kind of fee for this service as it will be largely automated and I don't see it placing a heavy demand on my time.

The format of stage set databases is very simple. They are standard PalmOS .pdb files with no appInfo block and no sortInfo block. Each stage is represented by a single record in the database. Each record consists of three sections.
The first section is the stage header. It contains the following data

  • startX - a 16-bit value containing the x co-ordinate of the 'tile' where the player enters the stage
  • startY - a 16-bit value containing the y co-ordinate of the tile where the player enters the stage
  • hardTurretRatio - a 16-bit value indicating the ratio of hard (wall-like) end-points to normal turrets. Zero means all normal turrets, 256 (or more) means all hard ends.
  • turretEnemyID - an 8-bit ID code representing the type of projectile fired by the turrets.
  • turretInterval - an 8-bit value indicating how often turrets fire.
  • coreEnemyID and coreInterval - like the 'turret' versions, but for the fortress cores instead of the turrets.
  • numEnemySets - an 8-bit count of the number of enemy sets defined in the next section of the record.
  • numBases - an 8-bit count of the number of bases (fortresses) defined in the final section of the record.
The code that uses some of this data has not yet been written, so it is yet to be determined what the final details of that data's meaning will be.

The second section of each record defines the sets of enemies that are 'spawned' at the beginning of the stage. If the numEnemySets field above holds a value of zero, this section is empty (non-existent). Each enemy set is defined by three values

  • enemyTypeID - an 8-bit ID code like turretEnemyID and coreEnemyID above.
  • speed - an 8-bit number representing the speed of movement for the enemies in this set
  • number - a 16-bit number indicating how many of these enemies to spawn.
Finally, each record contains a section defining the bases (fortresses) in the stage. Note that this section should never be empty - a stage with no fortresses is finished before it starts! Each base is defined by these four numbers
  • x - the x co-ordinate of the tile containing the fortress's core.
  • y - the y co-ordinate of the tile containing the fortress's core.
  • width - the horizontal 'radius' of the fortress.
  • height - the vertical radius of the fortress.

I have written a somewhat 'quick and dirty' Java application to convert C-style stage set text files into .pdb files. This application expects the fields to appear in the text file in a slightly different order than they are listed above. I used the original XKobo data structure layout so as to be able to convert the original XKobo stages relatively unedited. Anyway, a 17K zip file is available here. It contains 'README.txt', 'StagesText2PDB.jar' (an executable jar file), 'StagesText2PDB.java' (the source code), 'StagesText2PDB.mf' (the manifest file used to create the jar file), 'XKobo stages.txt' (the stages from Kobo Deluxe's 'scenes.cpp' file), and 'XKobo stages.pdb' (the PalmOS database version of 'XKobo stages.txt' produced by the program).

I have not yet started to write a GUI editor, but one day I will...