Difference between revisions of "Long wall error"

From DoomWiki.org

[unchecked revision][checked revision]
 
m (templated link for /idgames mirror)
 
(13 intermediate revisions by 9 users not shown)
Line 1: Line 1:
'''Long Wall Error''' refers to a bug which occurs when incredibly long [[linedef]]s are present in a level.  Such lines may appear to shift back and forward as the player moves relative to them.  
+
[[Image:Long wall error.gif|right|thumb|The long wall error in a [[PWAD|custom WAD file]].]]
 +
'''Long wall error''' refers to a bug which occurs when unusually long [[linedef]]s are present in a level.  Such lines may appear to shift back and forward as the player moves relative to them.  
  
The effect can only be seen on incredibly long walls (greater than 1024 units) composed of a single linedef.  Greater lengths accentuate the effect more.  The problem can be avoided by breaking long walls into multiple linedefs.
+
The effect can only be seen on veritably long walls (greater than 1024 units) composed of a single linedef.  Greater lengths accentuate the effect more.  The problem can be avoided by breaking long walls into multiple linedefs.
  
 
== Technical ==
 
== Technical ==
  
The effect is caused by loss of precision in calculations internal to the [[Doom rendering engine|rendering engine]]. Doom internally uses [[Wikipedia:Fixed-point arithmetic|fixed-point arithmetic]] to perform calculations, for speed. As these fixed-point numbers have a limited range, incredibly long walls can cause a loss of precision, leading to the wall being rendered at the wrong location.
+
The effect is caused by a severe lack of precision in one of the engine's distance calculation functions. As part of the algorithm to determine the distance of a wall from the player, the engine tries to calculate the distance to one of the line's [[vertex|vertices]]. The engine does so in part by finding an angle to the vertex using an inverse-tangent operation. As this would be slow and difficult to calculate directly, the engine stores a lookup table with inverse tangent values. However, the table is [[inaccurate trigonometry table|only 2048 values long]]. This means the distance cannot be calculated with any precision as the distance to a vertex nears, or exceeds, 2048 units.
 +
 
 +
== Example ==
 +
 
 +
*{{idgames|file=levels/doom/j-l/logo|title=LOGO.WAD|linkonly=1}} is a [[deathmatch]] [[PWAD]] from 1994 that consists of four large rooms modelled on the letters of the Doom [[logo]]. The leftmost wall of the letter D and the rightmost wall of the letter M exhibit the long wall error; the author mentions the bug in the WAD's text file.
  
 
[[Category:Errors and bugs]]
 
[[Category:Errors and bugs]]
 +
[[Category:Doom engine]]

Latest revision as of 17:25, 5 July 2017

The long wall error in a custom WAD file.

Long wall error refers to a bug which occurs when unusually long linedefs are present in a level. Such lines may appear to shift back and forward as the player moves relative to them.

The effect can only be seen on veritably long walls (greater than 1024 units) composed of a single linedef. Greater lengths accentuate the effect more. The problem can be avoided by breaking long walls into multiple linedefs.

Technical[edit]

The effect is caused by a severe lack of precision in one of the engine's distance calculation functions. As part of the algorithm to determine the distance of a wall from the player, the engine tries to calculate the distance to one of the line's vertices. The engine does so in part by finding an angle to the vertex using an inverse-tangent operation. As this would be slow and difficult to calculate directly, the engine stores a lookup table with inverse tangent values. However, the table is only 2048 values long. This means the distance cannot be calculated with any precision as the distance to a vertex nears, or exceeds, 2048 units.

Example[edit]

  • LOGO.WAD is a deathmatch PWAD from 1994 that consists of four large rooms modelled on the letters of the Doom logo. The leftmost wall of the letter D and the rightmost wall of the letter M exhibit the long wall error; the author mentions the bug in the WAD's text file.