> temp > à-trier > how-do-non-euclidean-games-work-bitwise-digidigger

How do non-euclidean games work? | Bitwise

DigiDigger - 2020-08-24

I'm a professional programmer who works on games, web and VR/AR applications. With my videos I like to share the wonderful world of programming with everyone!

What are "non-euclidean" games and how do they work? We'll discuss the inner workings of games like Antichamber and Superliminal as well as discussing the theory behind non-euclidean geometry.

References
HyperRogue trailer https://www.youtube.com/watch?v=xAFrKKApHTY
Zeno Rogue https://twitter.com/ZenoRogue/status/1245367263936512001

Unity stencil buffer tutorial https://www.alanzucconi.com/2015/12/09/3873/

No! Euclid! GPY Ray Tracer game https://www.youtube.com/watch?v=tl40xidKF-4
Channel CNLohr https://www.youtube.com/channel/UCG7yIWtVwcENg_ZS-nahg5g

Hyperbolica trailer https://www.youtube.com/watch?v=EMKLeS-Uq_8
Hyperbolica devlog #1 https://www.youtube.com/watch?v=zQo_S3yNa2w
Channel CodeParade https://www.youtube.com/channel/UCrv269YwJzuZL3dH5PCgxUw

Antichamber https://store.steampowered.com/app/219890/Antichamber/
Superliminal https://store.steampowered.com/app/1049410/Superliminal/
Hyperbolica https://store.steampowered.com/app/1256230/Hyperbolica/
HyperRogue https://store.steampowered.com/app/342610/HyperRogue/


Music in in outro:
Besus y Abrazor - Rolemusic: https://freemusicarchive.org/music/Rolemusic available under a Creative Commons Attribution license https://creativecommons.org/licenses/by/4.0/

ZenoTheRogue - 2020-08-26

Thanks for the shout-out! Here are some comments:

* you say that "the shortest line on a sphere is not necessarily a straight line" but what is a straight line? It is a kind of meaningless concept until you define it. In my opinion a straight line is one that is (locally) shortest, making this "axiom" a definition. For a creature actually living in a non-Euclidean world, the shortest lines are indeed straight. If you are a creature living in a (two-dimensional) spherical geometry, the third dimension simply does not exist for you, and the great circles are perfectly straight lines, because they curve neither to the left nor to the right.

Also, if you try a computer simulation of a spherical or hyperbolic three-dimensional space, the shortest lines will look straight (this is not the case in non-isotropic geometries though).

* I definitely agree that all the games are just tricks. However, it does not matter! It is the effect which is important, not how it was achieved.

The problem with games such as Antichamber or Superliminal is that they do not give a feeling of being in a non-Euclidean space at all. You do not see the visual or geometric effects typical for non-Euclidean geometry when playing these games. The effects you see have nothing to do with non-Euclidean geometry.

* you sound as if non-Euclidean geometry was something accessible only to geniuses, and game development was easy. Most people are born with great math skills, which then deteriorate because of bad teaching. The math of non-Euclidean geometry is not really much more difficult than the Pythagorean theorem or trigonometry. The bigger problem is conceptual, not mathematical: people have their Euclidean intuitions so deeply ingrained that if you show them that they are wrong, they will not believe you and make the same Euclidean assumption again.

* Also it is the best to just play a true non-Euclidean game and see for yourself. That is way better than watching videos or reading books. Everything can be experienced in HyperRogue.

happinesstan - 2021-05-29

​@Christopher Savignon But the earth isn't flat, and the car doesn't go straight.

Joseph Coon - 2021-05-30

@Christopher Savignon “Stalin” 😂

Calm down kid. 😂

Savage van wizardwitch - 2021-07-13

𝔃𝓱 - 2021-08-09

a straight line is a line that is defined by two points..... not hard to define at all....

Maselek - 2021-09-13

It feels weird seeing people from the hypermine discrod (so totemica and that's basically it)

The Swag Slayer - 2020-09-20

The original non euclidean space is the infinite staircase in Mario 64

Joseph Coon - 2021-06-03

@Christopher Savignon Of all the comments that I would “flagbot,” why wouldn’t I have your first one taken down? The one where you THOUGHT you sounded smart and was so proud of? 😂 😂 😂 😂

I just went back and took a snapshot of it and reread it as I did so.

In the context of your subsequent comments, I can understand just how desperate you want people to think u r smrt!!! 😂 😂 😂

Christopher Savignon - 2021-06-03

@Joseph Coon
Man, you really need the attention, do you.

Joseph Coon - 2021-06-03

@Christopher Savignon Says the guy trying to flaunt his superior spatial relationships understanding. 😂 😂 😂

It’s also ironic that you HAVE to respond to me while claiming that I need the attention.

Further irony...claiming that I am deleting YOUR comments while also claiming that I seek attention. What kind of attention is it if I look like I’m talking to nobody?

Actually, YOUR responses look stupid after I show you how little you understand, so you THINK deleting your comments will just make ME look crazy. When, in fact, I have screenshots of your comments, and can easily prove how stupid you actually are. Being embarrassed at your stupidity is a good sign. Hiding it is not. Embrace the fact that you are ignorant and motivate yourself to rectify it. 😂 😂 😂

Sour D - 2021-06-24

Zelda on NES had a non euclidean forest, no?

BinaryCounter - 2022-02-16

The original "Asteroids" had a circular space. You can wrap around the screen edges

Lightning McHick - 2020-11-16

Dude, if my geometry teacher explained it like this, I wouldn't have done summer school

AndroidGamerStar 123 - 2021-04-16

@Tyee Elu if it is not a meme you are very wrong

Sure Lock - 2021-05-12

But then you wouldn't be as jaded, and where's the fun in that?

AndroidGamerStar 123 - 2021-05-12

@Sure Lock I don't know why he says that is teacher's fault but anyway

I'm a funny boy and you are not!!!! - 2021-05-26

yeah because he skipped most of the math, which is what you need to learn to get more than a surface level grasp on it

Army of Ninjas - 2021-07-19

Liar. You didn't learn noneuclid in geometry. You learned EUCLIDEAN geometry. Non-euclidean geometry is used in physics and satellite tracking etc.

Simple Brian - 2020-09-10

Before portal 2, valve experimented with a concept called "f-stop" it basically had the same rules as the game seen near the end. You had a "magic" camera that takes pictures, take a picture of an object and suddenly you can place a much larger or smaller version of that object by just using the portrait.

It was an interesting concept that never saw the light of day but at least its idea exists in many games today.

zarrowthenorse - 2020-11-18

A bit off topic but Portal 2 is an amazing game

Gamer Therapy: Console Yourself - 2020-12-09

Seems a lot like Superliminal, definitely a head trip of a game.

Sam29 - 2021-03-04

@Julia Li sadly, no

MrCalhoun - 2021-03-23

@Vindextra Viewfinder.

Markskelebone - 2021-06-26

@zarrowthenorse i got the game today, and its amazing, im very late to the party but still

Mark Gearing - 2020-09-09

Q: How can games be non-Euclidian?

A: It’s software. It doesn’t have to model the real world.

onearthonelegion - 2021-03-10

Real world is not euclidean

Stag Dragon - 2021-03-29

it's like: ok I need you to make it this long, and this wide, and this tall, and then make it this size in the fourth dimension

Computer: aight.
Person... But how did you do that the universe isn't like that!
Computer: what's a universe?

Patrick Shannon - 2021-05-11

Sometimes, developers try very hard to actually simulate the world you perceive through their game. Sometimes, they use 'cheap tricks' to manipulate your perception. In either case, the end result tends to be enrapturing and mind-blowing.

Puspam Adak - 2021-06-29

Exactly

Twisted Code - 2021-08-28

I'm sorry I just reread your comment and am now thinking of the bee movie script
"the software of course, is non-Euclidean anyway, because computers don't care what humans think is impossible"

Glân von Brylân - 2020-09-04

It's funny how so many people imagine weird, eldritch stuff when hearing "non-euclidean"... Scared of a term they don't know, like with chemicals. Not realising they encounter non-euclidean geometry on a daily basis. Drew a face on a balloon? Had a tattoo? Congratulations, you made non-euclidian geometry.
I guess we partly have to blame Lovecraft for that.

T - 2021-03-03

@Masketta Man the importance of a knowledge really depends on the environment you live in

Geno Blade - 2021-03-05

@Anders Naugle damn bro, become a historian well done lmao

Trisha Schuman - 2021-03-14

Same with getting their minds blown when it comes to numerical notation in non-standard bases, forgetting that time is (mostly) described in base-60!

Tornado Taylor - 2021-04-15

Best example i can think of is dihydrogen monoxide

SANDIPAN BORTHAKUR - 2021-06-17

The mathematics of Euclidean geometry is far simpler than the non-euclidean. That's why it is not taught in schools. You need to have an understanding of vectors, matrices and more importantly tensors besides other things.

sonicnaruto12345 - 2020-09-28

Hyperbolica is an actual true Non-Euclidean game with curved space instead of a locally Euclidean game which occasionally breaks it's own space

zzasdfwas - 2020-08-28

There's multiple ways of being non-Euclidean. Portal and Antichamber are mostly flat and Euclidean as long as you aren't close to a portal, but globally are not simply connected and so the axioms don't hold. But hyperbolic and spherical spaces are curved, and so the axioms don't hold. I wouldn't say one is more truly non-Euclidean. But the former are not even smooth manifolds, having sharp edges where space breaks down. If you were to stand in a Portal portal and move sideways, would you be sliced in half by the sharp edges of space?

Eryx - 2020-09-12

@pyropulse "Euclidean space" usually means this specific thing: https://en.wikipedia.org/wiki/Euclidean_space

However, "non-Euclidean" means "Riemannian manifold which is not an Euclidean manifold" i.e. "Riemannian manifold whose geometry is not Euclidean". So Portal is an Euclidean manifold, but not the three-dimensional Euclidean space, and it is not non-Euclidean.

Magic Gonads - 2020-09-16

@zzasdfwas

perfect

Pawel Nowinski - 2020-10-06

@Kitulous Gamedev Channel Just touching it should be hard enough though. I mean knives can cut and they're many atoms thick

katie - 2021-01-26

Einstein is that you?

Mt. Core - 2021-02-02

yeah. that's what he said in the video.

Steve Carter - 2020-09-08

I love the way these "impossible" things are happening in a world that has taken decades to tune so that it didn't routinely do these kinds of reality-breaking things.

Japan Panda - 2021-06-11

Yeah it would be quite fun if these things actually did happen IRL though.

Matthew Doucette - 2020-09-10

2:51 - Actually... a straight line is still the shortest in the curved space shown (sphere). The curve you see is extra-dimensional and is not an actual curve within the curved space.

Dan Kelly - 2020-11-16

Agreed.

Bugsydor - 2020-12-01

If you want to get really technical, the line postulate being violated in spherical geometry is about there being exactly one shortest line between two points

Matthew Doucette - 2020-12-02

@Bugsydor Because some points have infinite lines that are all the shortest?

Bugsydor - 2020-12-02

@Matthew Doucette
Yes, if I recall correctly. Though I'm having trouble recalling whether it's exactly two lines, or an infinite number.

Matthew Doucette - 2020-12-03

@Bugsydor Well I was thinking north pole to south pole, and all other such examples.

Nova Gamma - 2020-08-24

What a great video, just like the other of the bitwise series, I always love to see and understand how these games mechanics works with a great explanation and plenty of examples

Algodude87 - 2020-09-03

4:34 So my early 3d drawing program wasn't faulty, it was just simulating spherical space

Earnest Kane - 2021-02-02

Such a great introduction of how physical geometry could work in game engine. Inspiring and fantastic, appreciate your work:)

Liar-Face - 2020-09-13

Anti-Chamber was so fun.
My favorite mechanic is finding out that you are expected to break the game.
Set aside proper notions and see how often you have to do the exact opposite of what you think.

Plebis Maximus - 2020-11-01

This is one trick where explaining the magic has only made it cooler. Simple, yet extremely effective.

Alperen Aydaş - 2020-08-24

actually, it was disappointing to know that non-euclidean games are actually euclidean lol

Scorn - 2021-02-22

Hyperbolica would be an exception

Its developer also shows off the differences between Euclidean, non-Euclidean hyperbolic, and non-Euclidean spherical spaces

OneDerscore One - 2021-03-07

hyperbolica

𝗧𝗛𝗘 𝗙𝗢𝗨𝗡𝗗𝗔𝗧𝗜𝗢𝗡 - 2021-03-07

they can't break the laws of physics y know

Scorn - 2021-03-07

@𝗧𝗛𝗘 𝗙𝗢𝗨𝗡𝗗𝗔𝗧𝗜𝗢𝗡
They can check out Hyperbolica, though

Vampire The SpiderBat God - 2021-06-16

My god, dummy. Please get a life. These aren't Euclidean

John Harris - 2020-08-30

You mentioned Zeno Rogue! He's awesome, and his game Hyperrogue is a way to help wrap your head around what hyperbolic planes are like interactively.

NefariousHippie - 2020-11-24

This was so fascinating!! Plus I can't wait to try some of these games, they seem really trippy.

Madesta - 2020-08-24

Great video! You teach people by using an unusual and most importantly an interesting example - games. As a 15 year old student, I am VERY interesting to watch this, thanks. I played Antichamber almost 5 year old, but still remember that masterpiece, i should play it again!

Ronald Kyle Butler - 2021-05-12

Their teleportation had to be on point, literally. They make sure that you teleport not only to the hallway but to the corresponding position in the destination hallway. I love these games!

sequorroxx - 2020-11-11

That first game is a masterpiece. It gets a bit repetitive at the end when the block tools are the only remaining puzzles to solve but its still amazing.

Nincadalop - 2020-09-05

I was really impressed with superliminal when it came out. Literally didn't know how it was achieved. Now it looks so simple, but it's great.

Spuner - 2020-09-12

Your content is truly amazing. I wish there was more of it.

Nonkel Jef - 2020-10-26

Really interesting games. Highly recommend Monument Valley as well. It uses isometric perspective with Escher-like tricks, where things that look connected are corrected.

Saffet Sinanoglu - 2020-08-24

Bro you're giving us hope like this, making amazing videos and whatnot

Saffet Sinanoglu - 2020-08-24

Dont leave again? Deal.

happinesstan - 2020-09-28

Really? Your hope lies in computer games? Welcome to the simulation, sir.

Amis Thysia - 2021-01-07

I'm honestly blown away that I haven't found this channel before - combining two of my favourite topics. Just excellent content. Bless the algorithm, for once. Earned a sub.

The Ammo Store - 2020-09-04

Fun fact: when antichamber first released, something was bugged in that hypercube room. It looked almost like a multi-monitor setup with a video stretched between each screen, only it was just a partial match to each side of the cube. While the method you showed off is cool, I think they just used render targets. Hopefully a dev can correct me though

Frank Bruder - 2020-08-28

I'm sure some are looking for this and were disappointed that it's not provided in the video. So:

Use Möbius transformations of quaternions. (Look it up if it's new to you. I won't give full explanations here.)

Quaternion rotations are represented as Möbius transformations of the form
q 0
0 q

A parallel transport (translation) of distance s in the direction of unit vector v is...
in a flat Euclidean space:
1 sv
0 1

in a spherical space of curvature 1:
cos(s) sin(s)v
sin(s)v cos(s)

in a hyperblic space of curvature -1:
cosh(s) sinh(s)v
-sinh(s)v cosh(s)

This works with coordinates in a polar projection for spherical and a Poincaré disk for hyperbolic space. Geodesic surfaces are represented as surfaces of constant curvature (spheres and planes). If you want to use standard Z-buffer based 3d graphics, then for rendering you need to transform the hyperbolic coordinates to the Beltrami-Klein model and the spherical coordinates to a central projection. The central projection can only map half of the sphere, and that's ignoring limits of floating point precision. So you'd need think about how you can slice and dice your frustrum to render beyond that.

In all of this we use the imaginary space of the quaternions as our three-dimensional world. But we're using four-dimensional quaternions internally. So this can easily be expanded to a four-dimensional world by allowing rotations into the real-valued axis of the form
q 0
0 q*
(where q* is the conjugate of q)
and allowing v to have non-zero real values.

James Beans - 2020-08-24

Great video! I definitely think the in engine examples you show put your vid a step above other explanations that I've seen of antichamber.

XelusPrime - 2020-09-05

This reminds me of the old days with Unreal 1 Zone portals and Serious Sam 1. I love games that do this sort of thing.

Unreal 1 (UE1) Zone portals were so fascinating, wish they became more popular again. You could design some seriously cool levels with them.

Whypper - 2020-10-04

I found this video very well explained and the examples were very helpful!

BewbsOP - 2020-09-01

I always thought that those cubes in antichamber were made via a creative use of "projection" tech. Alot of screens in video games will have a room with a virtual camera pointed somewhere within them, and then "project" the view of that virtual camera onto the "screen." In those games, however, the screens appear flat (as they should) because the viewpoint of the virtual camera is static. If you were to take the player's camera and the character movement into account, you can replicate the appearance of a space behind the "projection" and it becomes believable because, even though the surface is flat, our brains believe it because of the accurate parallax. It's a similar idea to how the "looking glass" worked in prey 2017.

timdood3 - 2020-11-15

HyperRogue was my first introduction to non-euclidean geometry in a game. Exploring a hyperbolic world is quite fun.

Matthew Silkwood - 2021-06-23

I think another interpretation is that it's a 2D representation of a 3D or 4D space, much the same as how Asteroids can technically be mapped onto a torus based on the rules of the program. So rather than trickery, I would say it's simulated.

eriodas - 2020-12-15

this is actually very helpful, thanks for the great explanation!!

Kobe Neilson - 2020-09-08

Hey, around 1:35, perspective geometry claims that parallel lines intersect at infinity. On another note, there is another game similar to those showcased in which the player has a camera that takes photos, then can put the picture anywhere, and the picture becomes physical.

Probably - 2020-11-23

I still think that super liminal was one of the most mind boggling games to date. I wonder if you have played the entire game yet

Scorn - 2021-02-22

Recommend checking out Hyperbolica for some fun non-Euclidean hyperbolic spaces

Its developer also shows off the differences between Euclidean, non-Euclidean hyperbolic, and non-Euclidean spherical spaces

digimaks - 2020-09-19

Trippyyyy!!
I kinda did that effect in Unreal Tournament long time ago, when they had "portal" zoning mechanics.
It did exactly that by a geometry plane displaying the other geometry plane in another part of the map. So you could literally walk from one part of the map to the other without noticing space bending.

Sterling Hazelton - 2021-02-02

When dealing with parallel lines example, the issue is you transformed it through a second dimension, the three dimensional sphere is irrelevant. Same with the shortest distance from a to b, you only arbitrarily chose to make it wrap around a two dimensional part of the sphere.

SilverDiamond - 2020-09-11

Nice video. Few things remained unexplained. Such as "making" of the objects in Superliminal. You have a painting, clearly. Then you reach a way point, and there is no more paint or wall, there is only that object. Or how portals in Antichamber change where they lead when you're not looking at them. Keep creating.

yeehaw - 2020-08-30

I love this content man, incredible work.

ErrantOverflow - 2020-08-25

This was a very interesting topic to cover. You always deliver with your videos!

invghost - 2020-09-09

I love non-euclidean puzzle games. Working out something that breaks everything you're meant to know is immensely satisfying.

RedFathom - 2020-11-04

i remember back in the day unreal tournament had mirrors, and portal zones. you could do stuff like the stuff in antichamber! my favorite being CTF-FinalFace where the base only had one level inside but 3 outside. you could even shoot thru the openings.

tamis - 2020-08-25

ayyy, glad to know you're back dude!! hope you continue with your work in these videos, they are really great. Have fun making them, 'cause we're sure having fun watching 'em

The Fonke Monke - 2020-11-17

We were discussing the basic Euclidian Geometry in class, and I mentioned how some video games use their platform in creative ways to bend those Euclidian rules. I shared this video with the teacher, and made a 10 point extra credit assignment for the class if we could give a 150 word reaction of this video, discussing the stuff you went over.

InfoKub Arcade - 2020-09-06

Thanks ! I wanted more infos after watching Huperbolica devlog and this was amazing. Nice examples and explanations !

CRTY - 2020-11-25

dude you earned a sub from me. wow! what a compelling breakdown and stellar explanation

Create Username - 2020-09-15

I love these concepts a lot more fun than being stranded with physics