# How Does Ultima 7 manage different floors in 2d

In U7, you can move among floors without the function "tranport" the player to another place, as for example the first ff ones.

How can it tell whenever the character is moving from floor z to floor z+1? (of course, it uses stairs, but what is the logic behind this?) How does pathfinding in those cases work?

The player location is stored using an array. Three variables are used as coordinates X,Y,Z.

The X,Y are the map coordinates, while the Z is the height.

In order for the game look 2.5d when its 2d the entire the lower floor (Z-1) map is moved and has the X and Y coordinates transformed (Y-1) && (X+1). Which creates a nice illusion of 3d background. It also makes changes to the general way the 2.5d coordinate system, I do not remember how did they.

The entire process of the illusion used in 2.5d games is explained in this post, it works really similar to the U7: Perspective projection with 90 degrees between X-Y axis?.

When a player uses stairs he is simply transported, his coordinates are changed and he is transported/teleported to the ground tile the stairs lead to the right. Generally it would work the following way [x+1][y+0][z+1]

It actually isn't pathfinding. It just moves you around the tiles just like teleporting would do. There is no need for a method to avoid obstactles unless you are making a movement method to the stairs~ itself:)

• And by the way, how can you tell if there is floor above your head so you can remove that part of the building to allow full view of the characters? Every time the player moves have to check tiles in higher floors? Commented Apr 30, 2013 at 9:30

As far as I remember it, U7 had a very discrete sense of height. Each stair was +1 to height. If you stack potions, you could climb anything. From a height of 1, you could move to a square that was +/-1 from it, but not something that was +/-2.

It lends itself pretty naturally to pathfinding then, you just consider any node more than +/-1 unit of height away as blocked.

• So, each time one character moves, it is necessary to check over which tile is standing? Commented Mar 31, 2013 at 17:44
• If objects other than the player move (eg doors can open and close by NPC!), then you always have to check each time the character moves if the next desired position is allowed. From the standpoint of pathfinding, (when you double click a destination, or try to pick up an item that is inside a closed area or unreachable) you can determine the reachability by attempting to make a path to it. Commented Mar 31, 2013 at 17:54