# Topology and game design

Aside from being bad at math, I am also bad at Final Fantasy XIV. So it happened that, while attempting to be less bad at Final Fantasy XIV and better understanding an aspect of one of the game’s encounters, I actually became less bad at math, and now I wonder if game developers should incorporate more involved topology into their games’ design.

Final Fantasy XIV as it is.

Let me review how raiding on Final Fantasy XIV works, for those unfamiliar. A group of eight characters, each controlled by one player, fights one “boss” monster. The boss’ attacks are frequently lethal, so to avoid a game over, the players must avoid avoidable attacks. The game is designed so that if an attack can be avoided, it can only be avoided in a particularly precise, and often opaque, manner. Examples of this include deciphering lines of iambic poetry, executing intricate but scripted movement patterns, or interpreting the way to avoid a truly bizarre instant-kill attack using obscure tidbits from the game’s lore. And don’t let yourself get distracted by the head-banging soundtrack

A recent boss, the Shadowkeeper, introduced in Futures Rewritten, has an attack known as Giga Slash which can be solved by thinking of it as inducing an orientation on the platform in which the battle takes place.

Let me remind the reader that an orientation of a curve (a one-dimensional space) is a choice of which direction is considered “right”; an orientation of a surface (a two-dimensional space) is a choice of which direction is considered “clockwise”; an orientation of a three-dimensional space is a choice of which coordinates are considered “right-handed”; and so on. [1]

Giga Slash involves Shadowkeeper drawing a sword, which she then slashes either to the left or to the right of her with, depending on which hand she draws the blade with. In particular, the attack will divide the platform into two rectangles, one of which is lethal to stand in and the other of which is not. What makes Giga Slash more interesting is that frequently Shadowkeeper’s “shadow” — a separate entity — or the player characters’ shadows, will be the origin of the attack instead.

In the former case, the party must either all stand to the left or to the right of the boss’s shadow, where “left” and “right” depend not on the player’s perception but the direction the shadow faces; thus the boss’s position induces a one-dimensional orientation on the platform, which is the orientation that one must use to resolve the attack, rather than the “natural” orientation given by the fact that there is a canonical choice of north, south, east, and west built into the game; players often refer to this orientation as the “absolute positions” and the orientations given by boss positioning (and in this case, shadow position) as “relative positions”.

The fact that the party has to deal with “relative positions” is hardly unusual. What makes Shadowkeeper more unusual is the second case, wherein four characters’ shadows are each the origin of a copy of the attack. In that case, their shadow appears as a black blob which is always to the absolute north, south, east, or west, of the characters, no matter how the characters moves. More abstractly, the shadow can be viewed as a unit vector which originates at the character, and is translated but otherwise not acted on by player movement (and also not acted on by anything else, for that matter). One player is assigned absolute north, one absolute west, et cetra.

The point is that the character shadows will always slash to their left if the boss is holding the sword in her left hand, and vice versa. The goal of the players is to aim the slashes in such a way that there is a safe rectangle. Many guides involve trickery with rotating the camera and so on to ensure that this happens, but there is a simple solution. The hand the boss is using is equivalent to a choice of orientation on the platform. If the boss raises her left hand, then the orientation is counterclockwise; otherwise it is clockwise. Now the players must all stand so that their shadow vector is tangent to the circle centered on the boss’s hitbox, radius a little large than the boss’s hitbox, and oriented according to the boss’s hand, and this will ensure that the interior of the boss’s hitbox is safe, as demonstrated here. Unfortunately, because right and counterclockwise are usually the “positive” orientations in mathematics, but here right is associated with clockwise, I still frequently do this trick incorrectly…ðŸ˜ž

Whether the tactic I just outlined is easier or more difficult to execute than just manipulating the camera angle, it demystified how choices of orientation “look” in practice to me. Unfortunately, while topology is my weakest area of math, one needs to choose an orientation in order to define curl [2] and so I wasted a lot of time trying to understand what the vorticity equation was actually trying to say, until Shadowkeeper cleared things up for me.

Final Fantasy XIV as it could be.

In Final Fantasy XIV, most platforms have a very simple geometry, either being a square or a circle. When there have been exceptions, the players have often exploited the geometry to avoid attacks in ways the developers did not intend to be possible, causing the developers to shy away from introducing any nontrivial geometry or topology into the fights. But the above discussion got me thinking: what if we fought a boss on a nonorientable surface, such as a MÃ¶bius strip? [3] Along with my friend Greg DeFillippo (who was the mastermind behind some of the below proposed attacks), I have tried to find out.

The first obstacle is determining which direction gravity faces. For this model, I think it’s reasonable that the gravity always face towards the MÃ¶bius strip, a la Super Mario Galaxy. However, one could also have a mechanic which reverses the flow of gravity at the whim of one of the players; then if the players are “above” the strip they need the gravity to point downwards, and if they are “below” the strip they need it to point upwards.

One simple attack could consist of a blade that sweeps across the MÃ¶bius strip, killing anyone it touches; the only way to dodge it is to simply jump to the other side of the strip. Since the MÃ¶bius strip only has one side, the blade eventually sweeps over the entire strip, forcing everyone to dodge twice.

A more interesting example requires the use of a mechanic commonly seen in Final Fantasy XIV known as “proximity”. Proximity requires that two characters be sufficiently far from each other when the attack completes, or they will die. However, since the attack is on a MÃ¶bius strip, if the players run too far they will end up close to each other, in spite of how far they have run. (This attack could also be done on a torus, as in Pac-Man, so it does not use nonorientability, but it does use the existence of a nontrivial topology.)

Another example uses a mechanic known as “forced march”. This assigns an arrow to each character which causes them to run in that direction relative to the direction they are facing at the start of the attack. For example, a character that is facing towards true north and assigned a right arrow will run east at the start of the attack. The goal is for the player to face their character in a direction so that they avoid the (possibly several) other attacks that go out at the same time as the forced march. This requires the player to think about orientation; but this becomes much harder to do when the platform itself is nonorientable! For example, if the arrow faced right and the character faced true north to avoid an attack to the west, the character would run east, but then find themself in the west, exactly where they did not want to be.

The forced march can be modified to more strongly use nonorientability. One can locally define what it means to be clockwise, say on the top of the MÃ¶bius strip, and this will contradict what it means to be clockwise on the bottom of the strip. If the forced march, instead of a straight line, forced characters to run in a circle, the forced march would have two different effects if the character was on the top or the bottom of the strip. (If the character was on the side of the strip, either the attack would have to kill them instantly, or simply be completely unpredictable.)

I’d love to see other examples of mechanics that are designed for platforms with nontrivial topology. If you can cook up any particular cruel examples, post them in the comments below ðŸ˜ˆ

Technical notes.

[1] More abstractly, recall that if $A \in GL(d)$ is a $d \times d$ invertible matrix, then the determinant of A is either positive, in which case we say it is orientation-preserving, or negative, in which we case we say it is orientation-reversing. A change of coordinates is said to be orientation-preserving (resp. reversing) if its Jacobian matrix is orientation-preserving (resp. reversing). Thus on an orientable manifold there exist two possible orientations — in the low-dimensional cases, right and left, clockwise and counterclockwise, and right-handed and left-handed.

[2] The curl of a vector field V is by definition the Hodge dual of the derivative of the Hodge dual of V, and Hodge duality is only defined up to a choice of orientation. A much more concrete definition of curl is to first declare that if V is a vector field on a surface, then the curl of V is the angular momentum of a unit mass particle whose velocity field is V, and then if V is a vector field on a three-dimensional space, then the curl of V in the direction of a unit tangent vector e is the curl of V in the plane $e^\perp$. The trouble is that angular momentum of a particle rotating in positive orientation is by definition positive, so one first needs to decide what one means by positive orientation.

[3] Originally I wanted to do this on a Klein bottle but could not determine how to depict raids on a surface that does not embed in three-dimensional space.