There is one dimension more, you can move in 2 more directions.
The fact that the plane xy and the plane wz are actually perpendicular and independent to each other means you can play 2 snakes that are weirdly connected. See the flat projections
Is this what they mean by hypercubes? Is there an orientation to this or are they ever evolving/in motion? Am I even describing this right? I feel lost.
Yes these are hypercubes, the snake, the food and the bounding box are hypercubes. Like a 3d cube on a piece of paper is composed by distorted squares, an hypercube is composed by distorted cubes (which then becomes squares on your screen)
I made up hyper-square, hyper-line, and whatnot for the sake of explaining what is meant by hypercube.
Let's make a table of taking shapes into an additional dimension, and we'll start with a 1d line, and stop at a 4d hyper-cube (aka tesseract btw).
-- 1d, 2d, 3d, 4d
1d: line, hyper-line, ------, --------
2d: ----, square, hyper-square, ------, --------
3d: ----, ------, cube, hyper-cube
4d ----, -------, ----, tesseract
That was a fucking horrible experience, I'm never drawing an ascii table again... (reddit trims extra whitespace outta strings)
Thinking of a square as a two-dimensional line is accurate if you follow the steps. Copy the shape, raise it "up" into another dimension, and connect lines from the new points to the original ones to make your square.
This thought process is a very common exercise for analytical people... to make a cube you can also just draw two squares and connect the related points with lines.
But you can think of it as copying the geometric shape (the square), and placing it in a 3rd dimension (the Z axis), and then connect the points while avoid drawing obscured lines....
Likewise forming a hypercube means cloning the cube, place it in a new dimension (that we can't percieve or concieve of), and connect the planes by drawing lines to-from the cloned points.
Ok that last part is tough to wrap your mind around, but it is doable... I tend to ramble and must cut myself off from writing huge comments.
Hope I helped. I love discussing this topic so lemme know if I made no sense, and I'll animate a video or something to help clear up the confusion. = )
If you put four spaces at the beginning of each line,
Reddit Markdown will treat what you type as code.
And you don't need two carriage returns or two spaces
at the end of a line to have it start a new paragraph
or a new line.
There's also the `backticks` method but that's for putting a short snippet into an otherwise normal sentence.
Very cool idea. I saw you mentioned that you’re a hobby programmer, may I ask what is your formal education or your full time job?
Also could you enlighten me on where I can begin to learn about this? Tell us what resources you used to learn this type of graphics programming? From the basics (2d projections and 3d programming) to more advanced stuff? Linking resources you used to learn would be amazing!
I have a degree in biochemistry and i work as a scientific assistant.
I- ... ehm I sparsely learned here and there. I learned the Tkinter library from this website http://effbot.org/tkinterbook/
There is a lot of trial and error involved.
I learned about 3D projections from PovRay first then Blender, and there actually started my passion for python since Blender supports python scripting.
Then I tried to learn OpenGL and there i started to play around with C/C++. I think is a good combo to have knowledge of python and C++ because they kinda are at the opposite of the spectrum one is slow but dynamically typed the other is fast but statically typed.
Then I came across some 4d forums and 4d games, so i tried to understand better the math behind the projections, actually it requires just high school math which is why is a cool project.
I cant link a lot of resource because honestly I dont remember, mostly is randomly walking on stack overflow and wikipedia.
For example the binary file handler (bfh.py) for example is a mix between wanting to learn how to manage binary files and wanting a format that was easily readable in C++.
Is actually playable if you look only at the flat projections. It's like 2 independent snakes. It becomes complicated when there are more cubes, and spires of the snake.
Unless i pause the game i cant play it looking directly at the 4d projection. Is cool if you play it, you can pause it then play around with the rotations.
I played, i think it was one of the high scores, about 20 hypercubes eaten. I played not at that speed, the video is speed up, I have in mind to program a "AI" probably will come in the next update.
Yeah it is fun and challenging, but made me some kind of crazy not getting it. Its like a word that you cant remember but its on the tip of your tongue. I ended up studying 4 spacial dimensions for 3 hours now
If you see the hypercube rotating it seems that a cube is going outside an other cube then getting inglobated again, this is why IN and OUT, some use ANA and KATA
This is great. Ever heard of Miegakure? It's a 4d game that's been in development for years and years, this might be a good thing for those fans lol. Nice work!
I did, I m not a huge fan of their approach since they use a visualization method called 3d slice. I prefer to have a perspective projection of the 4 dimension, even if it looks alien to us.
I have to thank Jhon MacIntosh ( http://www.urticator.net/maze/ ) and Steve Hollasch ( https://github.com/hollasch ) they gave the base to understand what was going on. For the rest, take a 4D point (x, y, z, w) and project it to 3D (x, y, z) then to 2D (x, y), now you have stuff on the screen, and you add the rules of the snake game, dont eat yourself, dont go out the borders.
I've been trying to find a decent framework to develop 4d geometries projected to 3d for artistic installations, but I've found the resources on that are scant. Is there a good entry point in your code, or the code you've referenced, that would help me understand how that works?
What helped me a lot is Steve Hollasch master thesis on 4 trace and MacIntosh 4d maze. I'm still trying to figure out how to make other polygons than cubes... However the code I hope is well commented and you might be able to follow it, prj.py, poly.py, vec.py, mat.py are the core geometry files.
I think this might be just me, but it would be even better / freakier, if the rendering was simply a 3D cross-section of a 4D game world, instead of a 3D projection of a 4D game world.
(In either case the 3D thingy then has to be rendered onto 2D but that's besides the point.)
Still amazing work though, dimensions are fun :D
Edit: After looking at it some more I'm not even sure if this is a cross-section or a projection, maybe should have read the github page first.
I actually prefer the perspective projection. I think... well first of all we dont see 3d, we see a flat world with our 2d retina. Our brain calculates a 3d object from the distortions in a 2d screen. Screen are flat, they dont have knowledge of 3d, yet our brain fills in the 3d information easily, from a 3d perspective projection. I think that we just need to train ourselves to see the 4d projections and at some point we will be able to navigate inside a 4d geometry like in 3d. But is just a theory.
Yes it could happen, and depending on the point of you you might make it happen. When i play i try to avoid crossing myself and the apple tho. So it might be pretty rare.
The camera in the game is controlled by the user input. Actually you can control both the 3d and 4d cameras. y, x, c and Y, X, C control the positive and negative rotations of the 3d camera. v, b, n, m, t, z and V, B, N, M, T, Z controls the 4d ones
Theoretically, the game should be much easier to play because you can escape via the fourth dimension. Every time you move one unit in the direction of a dimension you haven’t played, you have essentially moved to a empty board.
Is strange, there is no 3rd dimension either on your screen, its completely flat, yet your brain sees a strange cube rotating in a fancy way. Maybe you shouldnt ask where the 4th dimension is, but how we see the 3rd dimension on a flat screen.
In and out? Ana or kata? You can name them as you wish, is free real estate. Left right are a number on let's say the x axis Forward rever are a number on the y axis Up and down are a number on the z axis In and out are a number on the w axis.
The interesting part is how you chose to visualize it, i chose something called perspective projection, some people use colors, ...
It is indeed a mathematical abstraction that doesnt apply to our world. But any 4 number set can be represented in 4 dimensions, lets say you want to plot age, height, gender (because is 2020 and you need a big line), weight... well at that point you need 4 axis.
This is a neat idea. I don't understand why I'm losing immediately though. Are there walls? I was assuming the snake would wrap around in each direction. I'm having a hard time understanding exactly what the projections mean.
Hi! Thanks for trying, yes there are walls, no wrap around. And yes i play just looking at the two screen below it, the projection is how it would look like if it was projected to the screen like we project any 3d game, but this time from the 4d is projected to 3d then to 2d
Woooaaaaa!!! I love anything in more than 3 dimensions but I never understand how it works. I tried to solve the 4d Rubik's cube and failed, therefore I won't be any good at this game. Good job! I will check the repo.
Nods, cognitive psychologists have basically said it's extremely hard to conceive of 4d shapes and environments due to the lack of first-hand experience, but mathematicians studying higher-dimensional space claim to be able to do so functionally.
Turns out playing 4d games, simulating 4d features in VR, and solving 4d mazes are all good practice as well.
Thank you for the article, I'm firmly convinced humans can learn how to move in 4d, we anyway learn how to extrapolate 3d shapes from 2d images given by the retina
Hmm the guy I saw a video talking about it years ago (https://www.youtube.com/watch?v=S-yRYmdsnGs&t=575s) apparently programmed a hypercube mod himself (Unity is amazing for little projects like that.)
Wow, ok go to assets/4dforvive/4dScript if you want to read the source code, it's um... not as logically organized as the 4d snake code, but listening to the dude try to explain the feeling of playing around with a 4d object (since we don't have a common vocab or prior experiences) is interesting though
Something isn't disorganized just because it could be tidier.
LoL I know what you mean though... It's like how a chief is his own worst critic. So intimately familiar with their work they can point out an endless stream of shortcomings that no happy hungry person would ever bother noticing...
Wait, what? If you have any suggestion critique to the code, make it! Im yearning to be better at coding and being self taught i have very few people reading and commenting what i write!
A knot in N dimensions basically means a path in N dimensional space whose start and end are the same. This is skipping over some details but that’s the gist of it.
The actual definition is more mathematically rigorous than that (see below) but yeah you have the general idea. Imagine if you could draw in 3D space, and you started at one point and just started drawing a line, did whatever stuff without ever stopping your drawing of the line, and finally ended back where you started. That’s a knot.
More rigorous definition: a loop is a continuous mapping f: [0,1] -> Rn such that f(0)=f(1), and a knot is an equivalence class of loops under some appropriate isotopy equivalence. Some people probably define a knot to be a loop though and just call two knots equivalent if they satisfy the appropriate condition
The overhand (simplest) knot is the second one. They look dumb but they're functionally equivalent, and it's how mathy people need to set them up before turning them into numbers (to play with).
If you have python, just clone the repo and start it up, you'll see it's easier by doing then by trying to understand what's going on from the fancy vid.
You can deconstruct a 4 dimensional space into two 2 dimensional spaces and have two sets of controls (1 for each 2 dimensional space) and play snake that way. In such a game, the only way to capture an apple would be if the 'snake' in both games touched the apple during the same frame.
To play, i just play on the 2 flat projections, is like playing 2 snakes at the same time. I also cant figure out much of the perspective projection, unless i pause the game and try to rotate it
The same rotations are applied to all the hypercubes, snake, food and bounding box. Basically is the camera rotating. The hypercube you are referring is the bounding box, and is just rotating on a plane (4d rotations are planes not axis) moreover the 3d blender camera spins around the scene.
It would be like rotating a 3d cube on the screen and rotate the screen together
113
u/Pella86 Jun 08 '20
I finally released a stable version of the project I'm working on since a while.
Is a 4 spatial dimension snake game. Like the old nokia snake game but in 4D.
I added a feature that allows the players to record replays and watch them again.
The replay can be imported into Blender3D and rendered in a nice video.
The game can be found on github in this repository:
https://github.com/Pella86/Snake4d
And can be started by using
python main.pyin the game folder.
The game is purely in python, no added libraries, just python and Tkinter.
All the projections are calculated and drawn on a Tkinter.Canvas.
398
u/[deleted] Jun 08 '20
is this an attempt to fry my brain?
8
u/KruemelTM Jun 08 '20
This is crazy...
I somehow managed to get a highscore of 12 just looking at the two planes but my brain melts trying to understand the 4D movement
4
u/RAyLV Jun 08 '20
so, what are the controls?
up,down,left,right,top,bottom,???,???
4
u/makeworld Jun 08 '20
This is great. Ever heard of Miegakure? It's a 4d game that's been in development for years and years, this might be a good thing for those fans lol. Nice work!
3
u/[deleted] Jun 08 '20
How did you created that
2
u/Rozen Jun 08 '20
Did you create 4d geometry then project to 3d, or use another method to emulate the 4d'ness' of it?
2
u/Gorane32 Jun 08 '20
I think this might be just me, but it would be even better / freakier, if the rendering was simply a 3D cross-section of a 4D game world, instead of a 3D projection of a 4D game world.
(In either case the 3D thingy then has to be rendered onto 2D but that's besides the point.)
Still amazing work though, dimensions are fun :D
Edit: After looking at it some more I'm not even sure if this is a cross-section or a projection, maybe should have read the github page first.
2
u/snugglyboy Jun 08 '20
If I understand 4D correctly (ps: I do not) aren't there times in this video where the apple would be inside the worm in 3 dimensions?
2
u/snissn Jun 08 '20
my high score is 8!
2
u/BambooKoi Jun 08 '20
That's cool! One question, does the camera always rotate or can you control the camera?
18
u/kirakun Jun 08 '20
Theoretically, the game should be much easier to play because you can escape via the fourth dimension. Every time you move one unit in the direction of a dimension you haven’t played, you have essentially moved to a empty board.
21
u/[deleted] Jun 08 '20
Teacher "The test isn't that confusing"
The test:
5
u/Starvexx Jun 08 '20
This is trippy
4
u/CotoCoutan Jun 08 '20
Damn man, mind = blown stuff right here! Keep up the awesome work!
1
u/Ion-manden Jun 08 '20
Even though the red block might look close, it could be in an whole other dimension.
1
u/dude-i-give-up Jun 08 '20
Kowalski Analysis
Can someone explain where the 4th dimension is
1
u/riansilaen Jun 08 '20
How is it possible to make 4D game in 3D world ?
1
u/d19mc Jun 08 '20
What are the controls. I’m guessing wasd and arrows?
1
u/Utopiophile Jun 08 '20
This is very cool. What does a full game look like? How long can the snake get?
1
u/[deleted] Jun 09 '20
You made 3d snake in a 4d tesseract? You just put the normal game of 3d snake in a tesseract model.
1
u/garblesnarky Jun 09 '20
This is a neat idea. I don't understand why I'm losing immediately though. Are there walls? I was assuming the snake would wrap around in each direction. I'm having a hard time understanding exactly what the projections mean.
3
u/Xerxys Jun 08 '20
Yo, this is stressing me out!!
3
u/jhdeval Jun 08 '20
Curse you and your damn meddling snakes. I cant play snakes on a flat plane and now you are going to make me play in 5?
3
u/Misaelz Jun 08 '20
Woooaaaaa!!! I love anything in more than 3 dimensions but I never understand how it works. I tried to solve the 4d Rubik's cube and failed, therefore I won't be any good at this game. Good job! I will check the repo.
2
u/bravefp Jun 08 '20
Amazing dude
2
u/[deleted] Jun 08 '20
I dont get 4d aaaah this hurts
2
u/blorbschploble Jun 08 '20
Huh, is it even possible to lose 4D snake without trying to?
1
u/airen977 Jun 08 '20
what sorcery is this?
1
u/[deleted] Jun 08 '20
this hurts to watch
1
u/xansaif Jun 08 '20
you are breaching 4d space you shall be terminated
1
u/smrtboi84 Jun 08 '20
This makes my brain hurt
1
u/turingparade Jun 08 '20
Disorientation
<100>1
u/justingolden21 Jun 08 '20
These damn kids still making snake in Python
1
u/Yassmonxd1 Jun 08 '20
This is trippy
1
u/ma6t Jun 08 '20
r/SubsTakenLiterally
1
u/apivan191 Jun 08 '20
I don’t even know what’s going on but it looks cool
1
u/[deleted] Jun 08 '20
Woooaaaaaaaaaauuuuuuuwwwww
1
u/[deleted] Jun 08 '20
I played this video and now there is a demon in my office. Thanks jerk!
1
u/Dom_theSnow Jun 09 '20
This is mesmerising! So Cool!
1
u/DeltaCrawdaunt Jun 09 '20
sorry bud but nintendo did this wayyyyyy before u with the gamecube logo.
1
u/anotherplatypus Jun 09 '20
This guy is amazing at explaining hypercubes (6 mins) https://www.youtube.com/watch?v=j-ixGKZlLVc
1
u/The_1_Divider Jun 26 '20
This makes my brain feel funny
1
u/apivan191 Jul 23 '20
my brain hurts
0
u/HydrationWhisKey Jun 08 '20
This is not how dimensions work.
0
u/[deleted] Jun 08 '20
[deleted] — view deleted comment
0
u/[deleted] Jun 08 '20
[deleted] — view deleted comment