{"id":31540,"date":"2025-10-30T14:33:52","date_gmt":"2025-10-30T14:33:52","guid":{"rendered":"https:\/\/naijaglobalnews.org\/?p=31540"},"modified":"2025-10-30T14:33:52","modified_gmt":"2025-10-30T14:33:52","slug":"how-an-error-in-cult-classic-game-doom-sparked-new-appreciation-for-pi","status":"publish","type":"post","link":"https:\/\/naijaglobalnews.org\/?p=31540","title":{"rendered":"How an Error in Cult Classic Game Doom Sparked New Appreciation for Pi"},"content":{"rendered":"<p>\n<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Everyone makes mistakes\u2014and sometimes those mistakes can lead to surprising discoveries. In the early 1990s, while programming the computer game Doom, game developer John Carmack set the value of pi (\u03c0) by hand\u2014and in true nerd fashion, he wrote the number down to the ninth decimal place from memory: 3.141592657.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Do you notice anything strange about that figure? The last digit is wrong. The number should instead be 3.141592654. (Pi is often truncated without rounding, in which case the ninth decimal place would be filled by 3, but it rounds to 4 because the subsequent digit is 5.)<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Fortunately, this error has little impact on the game. In Doom, one of the earliest first-person shooters with three-dimensional graphics, you take on the role of a space marine who, because of a failed teleportation experiment, ends up on a moon of Mars, where he fights demons and zombies. The game has a great story but terrible graphics. That\u2019s not because of the incorrect pi value but rather a reflection of how little computing power was available in the 1990s.<\/p>\n<h2>On supporting science journalism<\/h2>\n<p>If you&#8217;re enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Still, the error inspired U.S. engineer Luke Gotszling to investigate the possible consequences of incorrectly programming pi at a larger scale in the game\u2014an idea he presented at a hackers conference in 2022.<\/p>\n<h2 id=\"when-pi-is-wrong-in-a-computer-game\" class=\"\" data-block=\"sciam\/heading\">When Pi Is Wrong in a Computer Game<\/h2>\n<p class=\"\" data-block=\"sciam\/paragraph\">Because Doom is an open-source computer game, you can download the code\u2014and modify it. Gotszling did just that, testing what would happen if he changed the programmed values of pi.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The results can make a viewer feel a bit nauseous. When Gotszling set \u03c0 = 3, for example, the pixelated world of Doom became distorted, with walls and pillars moving in unexpected ways. Nevertheless, the game was playable.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">When pi was set to the value of Euler\u2019s number, 2.718&#8230;, the strangeness intensified. As a player moved straight in the game world, surrounding objects would move to different sides. Enemies could appear out of nowhere and disappear again. \u201cWith enough intoxication, you can re-create this,\u201d Gotszling joked in his presentation.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Things got really bad when he set a value of \u03c0\u20442 for pi. Walls would flash and disappear. Invisible obstacles block the player\u2019s movement. The game wasn\u2019t particularly fun in this state.<\/p>\n<h2 id=\"pi-isnt-always-314159\" class=\"\" data-block=\"sciam\/heading\">Pi Isn\u2019t Always 3.14159&#8230;<\/h2>\n<p class=\"\" data-block=\"sciam\/paragraph\">Why is pi so powerful? To answer that, we need to think about the consequences of changing pi more deeply.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Originally, pi was defined as the ratio of a circle\u2019s circumference to its diameter. In our everyday world, we assume circles are round. But in the narrower mathematical sense, a circle is defined by all points that are equidistant from a common center. In a flat, two-dimensional world, where distances are defined as the shortest straight lines, a circle is round. That means pi\u2019s value can change.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">For example, imagine you\u2019re standing in downtown Manhattan. If you want to find out which places are exactly one kilometer away from you, the shape you can create will no longer be round. That\u2019s because you can\u2019t walk through walls. Instead you have to follow the checkerboard layout of the streets. A circle has a square shape in the \u201cManhattan metric,\u201d as it\u2019s called in mathematical jargon. And if you define pi in this context as the ratio of circumference to diameter, the number takes on completely different values: in the Manhattan metric, pi is exactly 4.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">If you look closely, the value of pi in our world isn\u2019t exactly 3.14159\u2026. Instead, the ratio of circumference to diameter takes on a different value\u2014and, worse still, this value varies!<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">If you are standing at the North Pole and looking at all the places exactly 1,000 kilometers away from you, for instance, these points form a circle on the surface of a sphere\u2014but its circumference is smaller than that of a circle on a flat surface, thanks to the curvature of Earth. The closer you get to the equator, the stronger this effect becomes, and the corresponding value of pi deviates more and more from the usual 3.14159&#8230;.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The new value of pi is therefore not constant but instead depends on the radius of the circle. And this isn\u2019t just the case when considering a spherical surface. Any type of curved surface yields variable values for pi.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">Mathematicians refer to such curved worlds as \u201cnon-Euclidean\u201d geometries. (More than 2,000 years ago, the scholar Euclid laid out the rules of geometry most of us learned in school\u2014ideas that only apply on a flat world.)<\/p>\n<h2 id=\"creating-a-trippy-vision-of-doom\" class=\"\" data-block=\"sciam\/heading\">Creating a Trippy Vision of Doom<\/h2>\n<p class=\"\" data-block=\"sciam\/paragraph\">The quirky landscape Gotszling created by tweaking Doom\u2019s source code is something else entirely. To understand it, we have to go back to the 1990s: a time when every arithmetic operation consumed a huge amount of resources. To manage that challenge, programmers made efforts to determine possible calculations in advance and store them in \u201clookup tables.\u201d<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">When developing 3D graphics for a computer game, trigonometric functions such as sine, cosine and tangent play an important role. They can be used to describe how objects move through space over time. To save processing power, Doom\u2019s developers calculated important values of the trigonometric functions for various angles in advance and stored them in the lookup tables. And this is where pi comes into play: you have to multiply an angle in degrees by pi to get the corresponding value in radians, which the computer uses.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">So if Gotszling used a value of pi that was too small, the angles would be converted incorrectly. Because developers only store a finite number of angles, he created lookup tables with values that no longer include the full rotations: Instead of describing an environment in which an object only reappears in the same place after a 360-degree rotation, this occurs after a significantly smaller angle. As a result, in extreme situations, objects suddenly disappear or reappear out of nowhere.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">The Doom world Gotszling has created is incredibly strange. Nevertheless, it\u2019s a nice way to get people thinking about mathematics and the value\u2014in every sense\u2014of pi. One small mistake by a game developer has sparked a much larger experiment into the strange circle number.<\/p>\n<p class=\"\" data-block=\"sciam\/paragraph\">This article originally appeared in Spektrum der Wissenschaft and was reproduced with permission.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Everyone makes mistakes\u2014and sometimes those mistakes can lead to surprising discoveries. In the early 1990s, while programming the computer game Doom, game developer John Carmack set the value of pi (\u03c0) by hand\u2014and in true nerd fashion, he wrote the number down to the ninth decimal place from memory: 3.141592657. Do you notice anything strange<\/p>\n","protected":false},"author":1,"featured_media":31541,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[16420,7238,6271,6202,7282,413,7606],"class_list":{"0":"post-31540","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-science","8":"tag-appreciation","9":"tag-classic","10":"tag-cult","11":"tag-doom","12":"tag-error","13":"tag-game","14":"tag-sparked"},"_links":{"self":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/posts\/31540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31540"}],"version-history":[{"count":0,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/posts\/31540\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=\/wp\/v2\/media\/31541"}],"wp:attachment":[{"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naijaglobalnews.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}