Sunday, March 22, 2009

ObHack 005a released

One thing that has always annoyed me a bit about ObHack is the fact the library for the underlying random number generator only allows a 32-bit seed to be used.

I have fixed this. Instead of using the Mersenne twister as a random number generator, ObHack now uses the 32-bit version of RadioGatĂșn as the RNG. This allows us to take advantage of the fact that RadioGatĂșn allows an arbitrarily long input as its "seed" and can output a arbitrarily long stream.

Since RadioGatĂșn is (as far as this academic cryptographic community knows) a secure stream cipher, its output is indistinguishable from random noise.

I have changed the relevant parts of the LUA scripts to seed the random number generator with a string instead of a number, and have changed the GUI dialog code to allow any string up to 16 characters long to be inputted as the RNG seed.

If a seed longer than 16 characters is desired, this can be done by invoking ObHack from the command line. To do this:
  • Open up the ObHack gui from the directory containing ObHack
  • Configure, in the GUI, the type of game you want ObHack to make (level size, number of monsters, game type, number of maps to make, etc.)
  • Leave the GUI without making a level
  • Now, invoke ObHack from the command line with the first command line argument the seed of the map you want to make that starts with a number. For example, to use the seed '12345-long-ObHack-seed.wad' invoke ObHack as ObHack 12345-long-ObHack-seed.wad. It will generate a .wad file with both the name and seed '12345-long-ObHack-seed.wad' (yes, the .wad extension will be part of the RNG seed).
  • This can be done repeatedly from a script if you have a few DVD-R blanks you want to fill up or what not
  • Did I make it clear that a map generated from the command line must start with a number?
Note that there is a minor bug in ObHack: When I wrote the code to implement the new RNG last night, I neglected to free the memory used by the old seed when re-seeding the RNG; this means the program leaks 240 bytes of memory for every level generated by ObHack in a megawad; when making a Heretic megawad (55 levels), this leaks 13200 bytes of memory. Since it's rare to generate more than one wad file each time one invokes ObHack (following the above steps to repeatably invoke ObHack with a script restarts ObHack every time we make a .wad), so we only leak up to 13200 bytes, this isn't a serious enough bug for me to make a new release of ObHack to fix.

ObHack 005a can be downloaded at Here is the Doomworld thread I use to announce new releases of Obhack there.