Make a dimension shift device

I recently bought Titanfall II. That game has an ability called phase shift, which I think would be very interesting to have in this game.

What this ability does is that it momentarily teleport you into an identical but player free game world, lets you walk a few paces and then returns you to reality, possibly telefragging a player.

Heres a video of how it looks like

Now no Idea of how its implemened in there, I imagine it simply applies a filter to yor vision and turns your models visibility/hit-detection off.

Now the real question, how do I implement this in Cataclysm?

Should I grab the current terrain, making a copy of it somewhere not usually accessible (say current z-level +100) and then teleport the player there and back; or would it be better to make the player completely invisible and turn their collision off, even if that means filling the game movement, vehicle and monster detection code with special cases?

I imagine the terrain copying approach is better and wanted to ask were the relevant code for saving/loading the map is?

Actually teleporting the player is going to be simpler and more robust, so I’d recommend doing that.
Also that leaves open things like there being other monsters in the new area…

Probably the code you’re looking for is mapbuffer.cpp, that’s the class that “owns” the map data and is in charge of saving and loading it.

Alright, thank you!

Gonna read around there to make sense of it. Probably going to bother you again in a few days, well If i get anything working.

This sounds really hard to be honest.
If I were doing it the mapbuffer way, I’d expect 6+ hours of hard work with my skills. Unless you can come up with some shortcut that I’m not aware of.

The way I see it, you’d want to change the mapbuffer to remember which “dimension” you’re looking at.
If the dimension was the “prime” one, you’d let it happen like usual. If it was the “other” one, you’d first look up saved maps from “other” and load those (if they exist), otherwise load (possibly invoking mapgen) “prime” map and then strip it off monsters and items and save this stripped copy as “other” map.
You’d need to save “other” maps in some different directory from the “prime” ones, so that you can always tell them apart.

Holy crap, John, Hi.

My question is why no one seems to have cracked the code of directed teleportation. Seems kinda hazardous to have people teleport completely randomly…

I was thinking abut just creating the submaps somewhere up in the sky when the device is triggered and then removing them without saving when the player teleport’s out. Basically like a one time use z-level.

In fasct the place could just be a big open plain of “Subspace matter” ground and maybe randomized features, that would probably be easier to code and serve the gameplay just as well.

But yes I can see how this could be extremely hard to do.

This sounds really cool, but it could be fun to have some danger/cool stuff as well. Maybe this plane occasionally has artifacts in it? Or special monsters? Maybe corrupted copies of items that exist in the real world show up, and these have randomized stats or the evil ability.

The z-level idea is risky: all z-levels are interconnected and can’t “hang” infinitely high in the sky, so you’d be altering the 10th z-level. Now, 10th z-level is unused (except for very adventurous birds and spores), but it’s still visible from the ground in 3D FoV mode and can be heard on 0 z-level even without it.
If you dug a hole in 10th z-level and jumped down, you’d splatter on 0 z-level.
-10th z-level is similar, but in the opposite way. It is also much easier to reach - you can dig down to it.

If it’s necessary to implement a truly extradimensional z-level to do this, wouldn’t it be also be useful for implementing some flavor of alien dimension to explore, as well as a somewhat complicated short-range teleporter?

Z-level manipulation wouldn’t be particularly stable, but the good news is I think Coolthulu is overestimating how hard it would be to create a new save directory etc. I’m not saying it would be trivial, but it is fairly straightforward.

And yes, this kind of feature would build some groundwork for other extra-dimensional exploration.

I think Coolthulu is overestimating how hard it would be to create a new save directory etc.

I tried to do it once and found that the game/map/mapbuffer are rather hard to separate. Though I tried to do it “the right way” and not with hacks on globals.
Still, even the hacks on globals may require a lot of weird special cases. For example, NPCs are on the overmap and not the map.

It should be pretty easy to implement direction teleportation in Lua using game.choose_adjacent function.

Activate an item, select one of eight directions and teleport player in that direction a few tiles, destroying or swapping terrain/trap/furniture/monster in the process (or just telefragging monster).

Alright thanks for the further suggestions!

Try this one: