2022 - Non-Euclidean Doom: what happens to a game when pi is not 3.14159…

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] all righty thank you for the warm welcome and thank you for being out and about at almost 11 o'clock at night this is non-euclidean doom if you are here for euclidean doom you are in the wrong room so to begin with doom classic first person shooter space marine fighting invading demons from hell released 1993 the initial team was only a handful of people john carmack being one of the main folks behind it it was open sourced in 1997 under non-profit license and then open sourced under gpl in 1999 and there's a bunch of ports i'm using chocolate doom which is a port that intends to be very true to the original game and it was shareware initially so you would download it and then you could play it and then if you liked it to buy the full game you would send its software some money and then you could have the full game so this is what it looks like [Music] this is what it looks like when pie is just a little off so it looks mostly fine all right so let's take a very very brief segway to 1993. the minimum requirements for the game was a 386 with four megabytes of ram running a very very small 320 by 200 resolution no 3d acceleration and networking we not tcp it was ipx and also in 1993 we had hacking at the end of the universe so the predecessor conference to this conference was also taking place at that time and very very brief segway to hacking at the end of the universe i just love the description from that conference about there will be a guarded depository for your laptops and valuables and you might get your stuff back and then also um you could make payment at the door which we don't have now and then very important bring many guitars and laptops was for a 1993 hacker camp so anyway back to doom so john carmack wrote the networking stack for it and he made a big mistake he thought that only a couple of packets would not cause any problems when people were playing the game networked but it turned out it did so you could actually there were denial of service attacks that were caused inadvertently by people playing doom so you would have a few dozen players that could completely a network with a few thousand endpoints and then there was a lot of network administrators at universities that wound up banning doom or restricting it because it would literally take the network down if you are playing the game and the other thing is it runs on everything people have ported doom to all sorts of platforms including your badge so runs on doom and sylvain lefebvre did the fpga port so it's actually an fpga port of of the game game originally of course was written in c so pi we all know pi the ratio of the circumference to the diameter of a circle all right well this is going to be some crowd crowd interaction here all right one four no no that's not right but but that's what the original game was compiled with so rather than then then four would would be the appropriate digit there it was compiled with seven and then one person said happy pi day the source code includes an incorrect approximation of pi instead of the correct one i hope someone got fired for that blunder which is very very mean um especially again back in 1993 it was not that easy to just go online and get the value and then john himself admitted it he incorrectly recalled the 10th digit of pi so john i think we forgive you for this mistake it was not noticeable in the game and it was left in the source uh incorrect um so of course where does pi come up in doom well there are some lookup tables and this is the original source um so look up tables do not try to look them up so that's in the original source of doom and then the order of appearance so there's one lookup table for tangents um there is a binary representation of angles um they're doing some bit shifts everything is memory constrained it's 1993. uh sign lookups guess what it serves as coastline too because you can just shift it remarkable thing is how to use bams with this so unanswered comment in the code i guess some things don't change since 1993. um and then tan to angle arctan lookup table maps the tan of the angle to the angle fast got a search so this is in the original source and now you say like well it's it's just a lookup table why but why would you do a lookup table for simple trigonometry um this is the the initial uh values of the lookup table for find sign it's it's just a simple trigonometric function why would you even do a lookup table well the reason um for that i'll go ahead into in a little bit but this is the source for example for for calculating the fine sine lookup table again very very simple doing some very basic operations you know it doesn't really seem to make sense why you would need a lookup table for just some trigonometry but never forget this is why so the game is going to be running on this right so no 3d acceleration you're going to be having to make all of those queries fast and it turned out that in 1993 the way to make those queries fast was to pre-compute a lookup table and then the value of pi is embedded in those lookup tables so now we're going to get to the fun part we're going to change pi um and then we're going to figure out whether it compiles and whether it plays so first we're going to make pi equal to 2 pi okay so does it compile anyone yes does it play no um i know not fun all right so now we're gonna make pi equal four does it compile yes it does does it play uh also not fun the the hyperbolic values are not very very good uh we're going to make pi equal to pi does it compile actual pi not the wrong value yes it does compile does it play yes it plays and of course it the game looks like normal because it was changed at the 10th digit so that's very very far out so you don't really have a difference in terms of how it looks but remember how this looks because this style of play through i'm going to do for the other values so this is what it looks like with the correct value of pi everything seems to be very logical and makes sense now pi is equal to three does it compile yes does it play yes it does now it gets interesting all right so here is the non-euclidean doom alright so you can see that in the demo that plays in the beginning of the game it's it's completely shifted so this is the same script that plays in the normal doom but you it winds up killing you because because the game isn't expecting that that dynamic now we're gonna see what it looks like when it pi is equal to three so you start to see things kind of move a little bit so things are a little off the walls are moving in a way that you do not expect and so things start to shift right so because it's non-euclidean now there's you know a straight line is no longer the shortest path between two points and one thing i was curious about is whether whether the the shots would actually be straight and weirdly enough the shots were straight that's probably because of the the the uh the target detection that they were doing but everything else starts to kind of be a little weird but but it's playable with with pi equal to three um and yeah so that starts to look kind of interesting now we're going to make pi equal to e does it compile yes does it play also yes so now it will get a little more interesting alright so now yeah yeah it's it's dancing yeah yeah with enough intoxication you can recreate this and then the other funny thing that happens is they disappear if you move or they they kind of jump left and right as well but it starts to yeah it's really it starts to get really funky all right pi over two does it compile yes does it play yes it does all right it's getting more interesting now so now it starts to just be yeah it's uh it's yeah um a little yeah pretty pretty hard to play at this point and then like the wall boundaries start are also kind of get in the way um but there is there's still collision detection here so it's not that easy to clip through walls even with this kind of rendering um so yeah this is pi equal to pi over 2. all right pi equals 0.0001 does it compile yes does it play surprisingly it does all right that's yeah unfortunately it plays but not a very fun game all right pi equals zero does it compile no that's right it does not divide by zero and of course it doesn't play negative pi it compiles unfortunately does not play that one would have been good negative one million yes it compiles unfortunately it does not play so there's the table for the values i tried um i'm curious if there's other interesting values um for those look up tables that that that could make this game also kind of interesting so if you want to try this yourself you can get chocolate doom you can modify the value of pi right in the source there's two functions that generate those lookup tables so they're com they're normally commented out because those tables are pre-generated so you uncomment them then you generate those three lookup arrays save those lookup arrays compile there's a builds tool that helps with the compilation as well then you download a map file of your choice so everything here i did was on on doom 1 the original but you can you can try this on doom 2 and other games and see see how it looks and enjoy and you could try this yourself so um to end off with i want to go over some other projects so one person for example did ray tracing doom so this is making the game look better so it's the original game but with wayne tracing this was done by soul team this is open source as well if you'd like to see this um ray tracing in a game that's from 1993 is kind of interesting jpeg injection this is also really really interesting so this is a jpeg that's 117 kilobytes normal jpeg or it looks like a normal jpeg normal image you can download it it renders fine it's jpeg image but if you take this jpeg and you save it as a doom save file and then you load it there's going to be something interesting that happens and so this is a video of that that's right code injection via jpeg that has been renamed [Applause] [Music] all in 117 kilobytes so that was a great great project that was done by keg sws on twitter uh there's other non-euclidean games weirdly enough they all look kind of similar in terms of kind of spatial orientation um so there's a great xena rogue did a great post listing a lot of new games that were deliberately made to be non-euclidean if you'd like to to read through them there's uh there's a great post there that lists i think there's over 20 at this point where they all kind of do different things with geometry there's a fun little tidbit which is so now that there's this incorrect value of pi that was placed in the source code well like is this value has have other people just copied this value thinking it was the correct value of pi and used it and the answer to this question is yes so there and then these most of these are not forks of the game so these are just new projects where someone copied this incorrect value enough times that there's now 2 000 code results on github that use the wrong value of pi and then on google there's about four and a half thousand results i don't know how many of them reference doom and how many of them are just people incorrectly copying the value but if you want to look through those code results there's the github link and that's all so thank you so much and happy to take questions [Applause] i'm left ah we do have some time left so if you have any questions please line up at the microphones and feel free to ask them anyone yes perfect so we saw some examples of pi being smaller and still playable are there any examples of pi being larger and also still playable yeah so the the value that john carmack used in the original game was larger marginally and still playable um uh one thing i'd like to do is do a search to find the largest playable value which would be interesting i haven't done that experiment yet but i i know it's between the incorrect value that john used them for because four is not playable so it'd be interesting to see what the largest playable pi value is as for the game okay thanks if you find it tell me back microphone please thanks thanks for your talk it was really funny um i was wondering how is not playable defined like i mean obviously the you showed some examples were also not very playable yeah so yes so i define not playable as basically the game's psych faults when you try to play it so it's a hard crash um so the ones that were listed as not playable it would load and then the game would crash um so you literally couldn't do anything it would psycfault uh i didn't trace into the code to see where it was psych-faulting but but non-playable meant meant that the game's like faulted at start or at load okay and the front microphone hello thanks for the talk soon you've been saying you've been tweaking the argument of the sine and the cosine function but have you been tweaking the sine and the cosine function itself as well no but that would be another great like thing to do as a follow-up is to change those lookup tables if it if it expects a cosine and you give it a sign for example right and c see how that kind of modifies the the geometry and this and the same for the for the changes because i think it's you get really odd results as well i guess but uh okay thanks okay are there any more questions if that is not the case ah you have a question okay you don't good if that if you have a question you can probably also ask him afterwards he will probably be available just outside the tent so thank you for the really vivid talk i really enjoyed it and give him a warm round of applause [Applause] you
Info
Channel: MCH2022
Views: 831,108
Rating: undefined out of 5
Keywords: 2022, Battery 🔋, Day 2, Luke Gotszling, MCH2022 Curated content, contain, hacker, may, mch, mch2022, mch2022 eng, mch2022 ov
Id: _ZSFRWJCUY4
Channel Id: undefined
Length: 19min 13sec (1153 seconds)
Published: Sun Jul 24 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.