1.27 Example: a bug in Angband
The author mentioned that there was a bug in an old rogue-like game from the nineties that had a fascinating bug carrying the spirit of "Roadside Picnic" by the Strugatsky brothers or the TV series "The Lost Room":
The frog-knows version was full of bugs. The funniest one allowed a devilish cheating technique in the game, which players called "mushroom farming". If there were more than a certain number (around five hundred) of objects in the dungeon, the game would corrupt, and many old things would turn into objects thrown on the floor. So the player would enter the dungeon, dig long corridors (with a special spell), and walk through those corridors creating mushrooms using another spell. When there were enough mushrooms, the player would drop and pick up, drop and pick up any useful item, and the mushrooms one by one would turn into that item. The player would then exit with hundreds of copies of the useful item.
How the bug works
In short, the game used fixed-size global arrays to store all the objects (weapons, armor, mushrooms, treasures...) present on the floor of the level. The game counted the number of items on the floor, and when that count exceeded a certain limit (around 256 items) the bug would trigger.
The game used a fixed-size array (such as t_list[MAX_TALLOC] or sorted_objects[MAX_DUNGEON_OBJ]).
The MAX_DUNGEON_OBJ was 423, but when the number of items on the floor exceeded 256 (not 423!), the index would wrap around or cause a memory overflow. The result was that every old thing (artifacts, weapons, etc.) would turn into "objects thrown to the floor". Players discovered they could exploit this by doing "mushroom farming" creating hundreds of mushrooms with a spell, then dropping and picking up a useful item, and the mushrooms would turn into that item one by one. They would exit with hundreds of copies.
Here is the code the author found in the source (version 2.4 fk):
#define MAX_DUNGEON_OBJ 423 // maximum number of objects allowed on dungeon floor
int16 sorted_objects[MAX_DUNGEON_OBJ]; // array of sorted object indices (fixed size = 423)int8u object_ident[OBJECT_IDENT_SIZE]; // object identification flagsint16 t_level[MAX_OBJ_LEVEL+1]; // object level tableinven_type t_list[MAX_TALLOC]; // full inventory list of all dungeon objectsinven_type inventory[INVEN_ARRAY_SIZE]; // player's personal inventorySince I don't like just reading, I decided to download this old game, find the version that contains the bug, and try to reproduce it myself. I found it, and to be honest I also modified several things in the game so that when the bug triggers it would give me something like an alert to confirm that it actually fired.
Anyway, let's try it.
Reproducing the bug
First thing after launching the game I set up the character:
Then I entered the game:
I set the level to the highest level as the book described, and started placing 300 elements to trigger the bug:
Then I used Ctrl+G to drop items:
And indeed they were placed around me. I started moving and trying to pick up whatever was there and drop it until the alert appeared:
And that is exactly what we explained above.
Of course I tried to make this as hands-on as possible so the concept would be explained and understood more clearly and be visible nothing more. Besides, the game has newer versions released, but I did this just to apply it myself and share the experience that's all.
If this article helped you, please share it with others!
Some information may be outdated





