# Prototype Portals implemented (Was Non-Euclidean Level design?)

I came across this video of a non euclidean( acutally doubt that the word non euclidean is the correct term) level for Portal earlier today and, I thought that It would be really interesting if the labs in game were able to recreate some of those illusions. Mostly the most “simple” ones, like having square corridors in which you have to make more 4 90* turns to return to your starting point and those that involve corridors being longer (or even infinite) to transverse when traveling in a specific direction but very short when going on the opposite direction as well as having rooms that are way more big than what should be logically possible.

The illusions on that video seem to have been created with very clever use of portals (yay for thinking with portals) and I was simply wondering if its something we could eventually have in the game. Implementing the portal mechanic is probably the easier part, the true challenge surely lies on all the outside the box thinking one would have to do in order to come up with a random level generator that could design solvable non Euclidean mazes.

Well actually having certain labs be a complete non euclidean maze would probably be to horrendous to complete (both from a programming and player point of view) but at least having the occasional infinite corridor in the middle of a lab would be nice.

Non-euclidean would be a valid term, yes.

That said doing stuff like this can be incredibly difficult. It might be theoretically possible (though almost certainly hardcoded) to put this type of stuff into our framework, but it would be incredibly difficult to do.

I think of all the possibilities that could be done with this.

Endless.

Day 3 of walking through corridor.

I’m out of water, going back. Probably not gonna make it.

Day 3 1/4

Fucking Bastard Asshole Scientists.

[quote=“Mrnocamera, post:4, topic:5607”]Day 3 of walking through corridor.

I’m out of water, going back. Probably not gonna make it.

Day 3 1/4

Fucking Bastard Asshole Scientists.[/quote]

That is exactly an illusion that i thought.

Have you heard of HyperRogue?

Sounds Lovecraftian. Gotta love it, gotta craft it.

To make you continue, i respond: no. Checking, btw.

Anyone read House of Leaves? I could see this being a thing in labs or similar. An easy-ish method would be to dynamically regenerate map tiles to swap between two or more predefined floor layouts. This is definitely possible via the current code used to regenerate missing or corrupted submaps, but hasn’t been done AFAIK and I feel like it’d need to be implemented carefully. this would also wipe any objects or monsters contained in the old area.

It would also turn any of those tiles into infinite loot locations, as every time they regenerated they would generate new loot.

interestingly enough, while actual non-ecludian geometry would be pretty difficult, it might be possible to implement Portal portals. I’m a bit concerned about what it would do to performance though.
Short outline, when we do shadowcasting for LOS, we could mark the shadow behind the portal as visible on a seperate visibility map, and when we draw terrain we could simply draw the map on the other side of the portal on top of the shadow. wonder if I have time to implement that tonight…

[quote=“Kevin Granade, post:11, topic:5607”]interestingly enough, while actual non-ecludian geometry would be pretty difficult, it might be possible to implement Portal portals. I’m a bit concerned about what it would do to performance though.
Short outline, when we do shadowcasting for LOS, we could mark the shadow behind the portal as visible on a seperate visibility map, and when we draw terrain we could simply draw the map on the other side of the portal on top of the shadow. wonder if I have time to implement that tonight…[/quote]

Coding actual hyperbolic geometry is surely not worthwhile considering the whole rework one would have to do for, well actually, I don’t know what would the advantages would be.

But its great that you are making/planning to make progress on portals, those are actually the only thing needed to create this illusion of non euclidean-space. Well the infinite corridor is surely more tricky if you don’t want the illusion to break if the player drops an item while walking through it. But ones like the two doors that have a long corridor between them while also being adjacent is a very simple illusion (in comparison at least). And the possible puzzles get even weirder if you consider the possibility of having portals only trigger when walking into them from specific directions and portals that are exit only. (Aka you enter to the room from a door and as you exit you find yourself in a completely different hallway, and backtracking by entering the room again isn’t working!) No need to say that I am super hyped from knowing this, pretty sure its noticeable.

Like, very much thanks, the simple mention that you want to work on this pretty much made my day.

Try this on for size then (very rough prototype, but not a mock-up):

Wow, I love the portal idea.

PRed if you want to gaze upon the horrific visage of the code that creates this: https://github.com/CleverRaven/Cataclysm-DDA/pull/6951
Also my TODO list for what it needs before it’s ready for inclusion.
Working prototype in one long evening, now my face is melting, I hope you’re happy with yourself.

Wow! That is completely awesome. I am going to download it right now for sure!

Thanks lots of em’ thanks.

Oh wow stargate. Can it link to an entirely different map section? I’d imagine that right now it won’t really work unless both points are within the reality bubble.

[quote=“Kevin Granade, post:13, topic:5607”]Try this on for size then (very rough prototype, but not a mock-up):

[/quote]

It looks incredibly awesome, but i think it has minor problems with shadows.

Now we need it to actually teleport the player object and to color them blue and orange.

I actually like the “shadow” it casts.
If it gets fixed i’m afraid we’ll hardly be able to see anything through the 1x1 portal.
And we can always imagine the portals bend light coming through like a fisheye lens.

there are some rough edges to the rendering algorithm, but I think the shadow around the edge will probably stick around.
reality bubble shmeality bubble, it generates a new reality bubble on-demand at a random location in the current overmap, and even that’s a placeholder, eventually I’d like it to be able to connect to roughly anywhere in the game.
Teleporting through them should be embarrasingly simple.