{"id":4814,"date":"2022-08-06T23:55:00","date_gmt":"2022-08-07T02:55:00","guid":{"rendered":"https:\/\/www.blogs.unicamp.br\/zero\/?p=4814"},"modified":"2023-02-01T10:39:20","modified_gmt":"2023-02-01T13:39:20","slug":"trigonometry-in-heretic","status":"publish","type":"post","link":"https:\/\/www.blogs.unicamp.br\/zero\/4814\/","title":{"rendered":"Trigonometry in Heretic"},"content":{"rendered":"\n<p class=\"eplus-wrapper\">Heretic was one of the first computer games I came across. I remember that my aunt got a Windows 95 at the time when that was something revolutionary, and we had a CD with several demo games, including Heretic. This is a game of the FPS genre, those in which we have a first-person view and usually only see our weapon\/hand, but at the time I still didn&#8217;t have the necessary dexterity to move the character, so I was just on the shoot button and my aunt controlled it the character. But shooting monsters was a secondary diversion, what was exciting about this game were the secret passages and traps. Think you&#8217;re walking down a hallway and find a powerful weapon\u2026 but as soon as you pick up the weapon, the lights go out and we start hearing monsters around you (shortly we start losing life points), or the ceiling starts to descend in our heads\u2026 but it also happened that we passed through monotonous places with nothing interesting\u2026 there was probably a secret passage there that his lack of curiosity ignored. Anyway, this is a very fun game, which makes you think and gives you some despair and fear peaks, especially when you start to hear the monsters nearby and you have little ammo\u2026 At the end of each phase it showed how many monsters there were in the level, how many items and how many secret passages, and how many of each you discovered. This caused a serious frustration of feeling that we missed something, and we kind of retraced the entire itinerary looking for where the secret passage that still needed to be discovered could be.<\/p>\n\n\n\n<p class=\"eplus-wrapper\">However, an issue that we have in common with most games of this genre, the fact that we can adjust the character&#8217;s aim to the maximum value, but the game does not tell us what this angle is. We can simply accept that this information is not offered to the players, or else, find in elements internal to the gameplay itself, ways to calculate this value. Of course we chose the second option :).<\/p>\n\n\n\n<p class=\"eplus-wrapper\">Let&#8217;s first draw our situation. We have the character with his weapon pointed at the default height:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img fetchpriority=\"high\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0001.jpg\" alt=\"\" class=\"wp-image-4558\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0001.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0001-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0001-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">When he fires, the shot travels straight to the target.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0002.jpg\" alt=\"\" class=\"wp-image-4559\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0002.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0002-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0002-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">On the other hand, we can adjust the crosshairs up to the maximum top angle.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0021.jpg\" alt=\"\" class=\"wp-image-4561\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0021.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0021-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0021-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">When he fires, the shot follows in a straight line to the target (it is important to emphasize here that the trajectory is not parabolic).<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0003.jpg\" alt=\"\" class=\"wp-image-4560\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0003.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0003-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0003-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">That is, the angle we are looking for can be expressed from a right triangle, with opposite side z (given by the difference in heights between the two shots), and adjacent side y (equal to the distance from the character to the target). Knowing these values, we can say that the tangent of this angle x will be z\/x.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0004.jpg\" alt=\"\" class=\"wp-image-4562\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0004.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0004-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0004-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">Well, knowing enough about the game, we can find these values. In this case, this wall is very suitable for what we want, as it is completely formed by isosceles (or almost) right triangles.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0005.jpg\" alt=\"\" class=\"wp-image-4563\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0005.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0005-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0005-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">Checking where the maximum angle shot hits, we can get an idea of the difference in heights.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0006.jpg\" alt=\"\" class=\"wp-image-4564\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0006.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0006-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0006-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">But we still need to think of a unit of measurement for our calculations\u2026 for that, we&#8217;ll use the character&#8217;s steps. That is, how much the character moves at the slightest tap on the keyboard. Thus, with 7 little steps we completely pass the section that corresponds to this wall with water. I chose this section specifically because of that, because you can see the change in height when the character goes down into the water, and when he comes out of the water.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0007.jpg\" alt=\"\" class=\"wp-image-4565\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0007.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0007-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0007-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">So, to make the math easier, I did 10 steps backwards.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0008.jpg\" alt=\"\" class=\"wp-image-4566\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0008.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0008-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0008-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">Then each half of one of the right triangles, which will also be a right triangle, will have height and base equal to 6\/7 steps.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0010.jpg\" alt=\"\" class=\"wp-image-4567\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0010.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0010-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0010-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">Finally, we estimate the height difference of the shots from these triangles, concluding their height must be 18\/7 steps.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full eplus-wrapper\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"360\" src=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0013.jpg\" alt=\"\" class=\"wp-image-4568\" srcset=\"https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0013.jpg 614w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0013-300x176.jpg 300w, https:\/\/www.blogs.unicamp.br\/zero\/wp-content\/uploads\/sites\/187\/2022\/08\/gnome-mpv-shot0013-500x293.jpg 500w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<p class=\"eplus-wrapper\">So, when we go back to the initial calculations, we can figure out what the angle x should be.<\/p>\n\n\n\n<p class=\"has-text-align-center eplus-wrapper\">tang(x) = (18\/7)\/10<\/p>\n\n\n\n<p class=\"has-text-align-center eplus-wrapper\">tang(x) = 9\/35<\/p>\n\n\n\n<p class=\"has-text-align-center eplus-wrapper\">arctang(9\/35) = 14.42\u00ba<\/p>\n\n\n\n<p class=\"eplus-wrapper\">There are certainly several inaccuracies in our method, as well as the game developers would be unlikely to choose a non-integer angle. So I dare say that the maximum angulation should be 15\u00ba.<\/p>\n\n\n\n<p class=\"eplus-wrapper\">The interesting thing about this text is not exactly the calculation, as there is nothing new in using sides of a right triangle to find its angle. However, the way in which the information needed to model our triangle was deduced within Heretic&#8217;s own gameplay. We therefore invite you to discover this game (you can easily download it or play online) and also to look for other mathematical models within digital games.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Heretic was one of the first computer games I came across. I remember that my aunt got a Windows 95<\/p>\n","protected":false},"author":434,"featured_media":4570,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"pgc_sgb_lightbox_settings":"","_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"categories":[1225],"tags":[],"class_list":["post-4814","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-v-8-ed-2"],"_links":{"self":[{"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/posts\/4814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/users\/434"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/comments?post=4814"}],"version-history":[{"count":1,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/posts\/4814\/revisions"}],"predecessor-version":[{"id":4815,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/posts\/4814\/revisions\/4815"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/media\/4570"}],"wp:attachment":[{"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/media?parent=4814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/categories?post=4814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blogs.unicamp.br\/zero\/wp-json\/wp\/v2\/tags?post=4814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}