1
\$\begingroup\$

In Prince of Persia, using cheats in certain rooms can access "secret" rooms with strange graphics, like in this video. This effect is caused by the game referencing parts of memory which are invalid or containing garbage. For games running on MS-DOS with little bounds checking and no virtualisation, such memory access doesn't result in a crash, but in the game trying to interpret it as a valid and relevant memory instead.

If the data doesn't cause any other crash (e.g. divide by zero), the game might interpret the memory as an entirely new location in the game (room, level), possibly even with new graphics (with "random" pixels) or enemies.

I would like to know how this effect of misintepreting incorrect parts of memory as valid game locations is called.

The affected games that I know about:

  • Prince of Persia, using cheats or modified rooms to enter undefined rooms with weird tiles or enemies.
  • Commander Keen 4, saving with the viewport near the level edge displays garbage graphics after subsequent load.
  • Dangerous Dave, entering a non-existing warp zone displays parts of other levels or weird tiles.

I am also curious about other games where this can be found.

\$\endgroup\$
2
  • \$\begingroup\$ I'm not aware of any specific term, but "side-effect of a bug" is what I'd call it. \$\endgroup\$ Dec 19, 2017 at 14:27
  • 2
    \$\begingroup\$ I also don't know a general term for this. Cases I've seen frequently get their own unique & colourful names applied to them by the player/speedrunning community, based on their particular effects or trigger conditions, like Wrong Warping or Reverse Bottle Adventures. (In these examples it's not memory outside the game's allocation being read, but normal game memory being interpreted incorrectly leading to unintended effects) \$\endgroup\$
    – DMGregory
    Dec 19, 2017 at 14:55

2 Answers 2

3
\$\begingroup\$

One source for such bugs can be a buffer over-read. A bug in your program reads beyond the boundaries of an allocated array, so it reads whatever is stored beyond it.

Another possible source is use after free. The program tells the runtime environment to deallocate the memory a pointer points to, but still keeps a pointer to it around. The runtime then allocates something else to that supposedly no longer used memory. When the program later reads data from the pointer, it reads whatever is now stored there but interprets it in the context of the pointer.

The bug in Commander Keen might be uninitialized variables. When you create a new variable and don't assign any value to it, most programmers intuitively assume that that data will be empty (full of 0's). With many modern high-level programming languages, that's in fact the case. But with many older or more low-level languages, the data will be filled with whatever was there in memory before. So when you forget to write to allocated data before reading from it, you might find strange things in there. The programmer of Commander Keen likely allocated an array as large as the screen to store the tiles currently on-screen, but then stopped writing to it when the border of the map was reached. So the off-level portion of the screen stayed uninitialized.


You might wonder why you see such glitches so rarely in modern games. The reason is that while these glitches are quite interesting in the context of a game, they can have disastrous consequences in any software where security and/or correctness matters. So the software development community (beyond game development) has put considerable effort into making them a thing of the past.

  • The memory managers of operating systems try to detect and prevent such unusual memory access patterns, usually by crashing the program ("segmentation fault").
  • With multitasking operating systems there are multiple processes allocating and deallocating memory. The memory management of the operating system is a lot more sophisticated and hence less predictable than in a single-task operating system like DOS. That means if such bugs occur and do something interesting, you might not be able to reproduce it.
  • High level programming languages like C# with bound checking, garbage collection and implicit variable initialization built in are raising in popularity among game developers. With such languages, the above bugs are no longer that easy to create accidentally.
  • And even the low-level programming languages like C/C++ have evolved in the past 30 years. This applies to both the language features themselves and to the best practices used by developers.
\$\endgroup\$
2
  • \$\begingroup\$ This is a good answer on its own for explaining the source of such an effect, or the consequences for serious applications, but what I am interested in specifically is if there is some general name for this effect when talking about games, like something I can Google for (i.e. "examples of something in MS-DOS games"). Originally, I posted the question on Arqade, but was redirected here. \$\endgroup\$
    – IS4
    Dec 19, 2017 at 13:00
  • \$\begingroup\$ @IllidianS4 it doesn't really have a name, since it's caused by different things in different games. It may be a buffer overflow in one or no-terminator in another. \$\endgroup\$
    – Bálint
    Dec 19, 2017 at 14:30
1
\$\begingroup\$

Glitching:

Glitching is an activity in which a person finds and exploits flaws or glitches in video games to achieve something that was not intended by the game designers. Gamers who engage in this practice are known as glitchers. Glitches can help or disable the player.

Note: not everyone is going to necessarily associate this particular definition with this term. In general, I'd argue that most all non-game development software engineers would use glitch as a synonym for error or bug. For instance, the wikipedia definition for computer glitch reads:

A computer glitch is the failure of a system, usually containing a computing device, to complete its functions or to perform them properly.

In public declarations, glitch is used to suggest a minor fault which will soon be rectified and is therefore used as a euphemism for a bug, which is a factual statement that a programming fault is to blame for a system failure.

It frequently refers to an error which is not detected at the time it occurs but shows up later in data errors or incorrect human decisions.

Even among game development practitioners, usage will probably be mixed. Due to the ambiguation, it would probably be wise to establish your usage / context rather than assume a shared vocabulary. But if you're just interested searching on it for yourself, start with glitch level & glitch run.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .