 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. Release 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 id software some money, and then you could have the full game. So this is what it looks like. This is what it looks like when pi is just a little off, so it looks mostly fine. All right, so let's take a very, very brief segue to 1993. The minimum requirements for the game was a 386 with 4 megabytes of RAM, running a very, very small 320 by 200 resolution, no 3D acceleration, and networking, not TCP-IP, 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 a very, very brief segue 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, you could make payment at the door, which we don't have now. And then very important, bring many guitars and laptops was for 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 cripple 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 were 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 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, where this is gonna be some crowd interaction here, all right? One, four. One, four. Nope, nope, that's not right. But that's what the original game was compiled with. So rather than four 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. 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 incorrect. So of course, where does Pi come up in Doom? Well, there are some lookup tables and this is the original source. So lookup 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. There is a binary representation of angles. They're doing some bit shifts. Everything is memory constrained. It's 1993, sign lookups. Guess what? There's this cosine two 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. And then tan to angle, arc tan, 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, well, it's just a lookup table. But why would you do a lookup table for simple trigonometry? This is the initial values of the lookup table for fine sign. It's just a simple trigonometric function. Why would you even do a lookup table? Well, the reason for that, I'll go into it in a little bit. But this is the source, for example, for calculating the fine sign lookup table. Again, very, very simple. Doing some very basic operations. 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 gonna 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 gonna get to the fun part. We're gonna change pi. And then we're gonna figure out whether it compiles and whether it plays. So first, we're gonna make pi equal to 2pi. Okay, so does it compile? Anyone? Yes. Does it play? No. I know. Not fun. All right. So now we're gonna make pi equal 4. Does it compile? Yes, it does. Does it play? Also not fun. The hyperbolic values are not very, very good. We're gonna 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, 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 playthrough 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. All right. So you can see that in the demo that plays in the beginning of the game. It's completely shifted. So this is the same script that plays in the normal DOOM, but it winds up killing you because the game isn't expecting that dynamic. Now, we're going to 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. Because it's non-Euclidean now, a straight line is no longer the shortest path between two points. And one thing I was curious about is whether the shots would actually be straight. And weirdly enough, the shots were straight. That's probably because of the target detection that they were doing. But everything else starts to kind of be a little weird, but it's playable with pi equal to three. 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. All right, so now, yeah, yeah. It's dancing. Yeah, with enough intoxication, you can recreate this. And then the other funny thing that happens is they disappear if you move, or 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, yeah. Little, yeah, pretty hard to play at this point. And then the wall boundaries also kind of get in the way. But there's still collision detection here, so it's not that easy to clip through walls, even with this kind of rendering. So yeah, this is pi equal to pi over two. All right, pi equals 0.0001. Does it compile? Yes, does it play? Surprisingly, it does. All right, yeah. That's, yeah, unfortunately, it plays, but not a very fun game. 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, it 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. I'm curious if there's other interesting values for those lookup tables that could make this game also kind of interesting. So if you wanna try this yourself, you can get chocolate to doom. You can modify the value of pi right in the source. There's two functions that generate those lookup tables. So they're normally commented out because those tables are pre-generated. So you can comment 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 doom one, the original, but you can try this on doom two and other games and see how it looks and enjoy it. And you could try this yourself. So to end off with, I wanna 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 Sulteam. This is open source as well, if you'd like to see this. 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 a 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 all in 117 kilobytes. So that was a great, great project that was done by KGSWS on Twitter. There's other non-Euclidean games, weirdly enough, they all look kind of similar in terms of kind of spatial orientation. So there's a great, Xenorogue did a great post listing a lot of new games that were deliberately made to be non-Euclidean. If you'd like to read through them, 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. And 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, 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, and then 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 used the wrong value of pi. And then on Google, there's about 4,500 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 wanna look through those code results, there's the GitHub link. And that's all. So thank you so much and happy to take questions. Time 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 value that John Carmack used in the original game was larger, marginally and still playable. 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 know it's between the incorrect value that John used in four because four is not playable. So it'd be interesting to see what the largest playable pi value is for the game. Okay, thanks. If you find it, tell me. Back microphone, please. Thanks for your talk. It was really funny. I was wondering how it's not playable, defined. I mean, obviously you showed some examples where we're also not very playable. Yeah, so I define not playable as basically the game's psych faults when you try to play it. So it's a hard crash. So the ones that were listed as not playable, it would load and then the game would crash. So you literally couldn't do anything. It would psych fault. I didn't trace into the code to see where it was psych faulting, but non-playable meant that the game psych faulted at start or at load. Okay, and the front microphone. Hello, thanks for your talk. So 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 thing to do as a follow-up is to change those lookup tables. If it expects a cosine and you give it a sine, for example, right? And see how that kind of modifies the geometry. And the same for the changes, because I think you get really odd results as well, I guess, but okay, thanks. Okay, are there any more questions? If that is not the case, you have a question? Okay, if you don't, good. 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, please. Thank you.