Below are the five most recent posts in my weblog. You can also see a chronological list of all posts, dating back to 2003.

What happens if you remove randomness from Doom?

For some reason, recently I have been thinking about Doom. This evening I was wanting to explore some behaviour in an old version of Doom and to do so, I hex-edited the binary and replaced the random number lookup table with static values.

Rather than consume system randomness, Doom has a fixed 256-value random number table from which numbers are pulled by aspects of the game logic. By replacing the whole table with a constant value, you essentially make the game entirely deterministic.

What does it play like? I tried two values, 0x00 and 0xFF. With either value, the screen "melt" effect that is used at the end of levels is replaced with a level vertical wipe: the randomness was used to offset each column. Monsters do not make different death noises at different times; only one is played for each category of monster. The bullet-based (hitscan) weapons have no spread at all: the shotgun becomes like a sniper rifle, and the chain-gun is likewise always true. You'd think this would make the super-shotgun a pretty lethal weapon, but it seems to have been nerfed: the spread pattern is integral to its function.

With 0x00, monsters never make their idle noises (breathing etc.) On the other hand, with 0xFF, they always do: so often, that each sample collides with the previous one, and you just get a sort-of monster drone. This is quite overwhelming with even a small pack of monsters.

With 0xFF, any strobing sectors (flickering lights etc.), are static. However, with 0x00, they strobe like crazy.

With 0x00, monsters seem to choose to attack much more frequently than usual. Damage seems to be worst-case. The most damaging floor type ("super hellslime"/20%) can hurt you even if you are wearing a radiation suit: There was a very low chance of it hurting whilst wearing the suit (~2.6%) each time the game checked; this is rounded up to 100%.

Various other aspects of the game become weird. A monster may always choose to use a ranged attack, regardless of how close you are. They might give up pursuing you. I've seen them walk aimlessly in circles if they are obstructed by another thing. The chance of monster in-fighting is never, or a certainty. The player is either mute, or cries in pain whenever he's hurt.

If you want to try this yourself, the easiest way is to hack the m_random.c file in the source, but you can hex-edit a binary. Look for a 256-byte sequence beginning beginning ['0x0', '0x8', '0x6d', '0xdc', '0xde', '0xf1'] and ending ['0x78', '0xa3', '0xec', '0xf9'].


Here's a useful shell procedure:

vigg ()
  git grep --color=auto -lz "$1" | xargs -r0 sh -c "vi +/\"$1\" \"\$@\" < /dev/tty"

git grep is a very effective way to run a recursive grep over a git repository, or part of a git repository (by default, it limits its search to the sub-tree you are currently sitting in). I quite often find myself wanting to edit every file that matched a search, and so wrote this snippet.

The /dev/tty-ugliness is to work around vi complaining that it's standard input was set to /dev/null by xargs. BSD xargs has a command, -o, which sorts this out; GNU xargs doesn't, but the manual suggests the above portable workaround. This marks the first time a BSD tool has had a feature I've wanted and the GNU equivalent doesn't.


Now I'm back to Linux on the Desktop for my dayjob, I was slightly nervous about checking out the state of the art for Linux music players; an area I've never felt the Linux desktop was very strong on.

However for the time being I've largely side-stepped the issue by listening to BBC 6 Music for most of the day. For better or worse, I scrobble, and somebody has written a neat web app for scrobbling along to radio stations. When I want to listen to something different for a change, I've been trying out a trial of Google Play Music, for which somebody has written a Chrome extension to scrobble. On the rare occasions I listen to local music, I'm using VLC.

Google Play Music seems pretty good, but I'm not getting a lot from my trial because 6 Music is generally fantastic.

Scrobbling 6 Music has revealed a bit of a disconnect for how I use, and how website thinks you should use it. Within a day or two, my "music compability" with 6 Music was (predictably) "SUPER". Looking at my "Top artists", right near the top are 6 Music's current playlist favourites Courtney Barnett and Nadine Shah, who I can (at least) recall the songs that have been played; just below them are Young Fathers, who I cannot. A little lower are Hot Chip and Slaves: both artists who have current singles out which I enjoyed for a while, but the relentless BBC playlist policy is overdoing them and I'm inclined to switch over when they come on now. If I listen to a whole album in a given week, then the artist will likely (and rightly) be sat at the top of "last 7 days"; if I don't, then it could be something I can't even remember listening to.


Pratchett and I, around 1998

Pratchett and I, around 1998

Terry Pratchett dies, aged 66.

It looks like his last novel will be The Long Utopia, the fourth book in the Long Earth series, co-written with Stephen Baxter.


I thinking archiving is important, is great, and I'm proud of what little contribution I've made to date.

Someone recently pointed out that an upload I had made is now inaccessible. In it's place is a short message: this item is unavailable due to issues with its content. What issues are not made clear.

I've never been contacted by about this, not even to be admonished, should they have felt that to be necessary. I've tried contacting them to find out what the issues are but have heard nothing back.

It's worth remembering: Just because it's available now, even on, doesn't mean it will be Tomorrow!


Older posts are available on the all posts page.