Line of sight (field of vision, LOS, FOV)
Posted: Mon Dec 24, 2012 4:03 pm
There has been discussion of the changes to LOS code in ToME in various threads, and in the in-game chat, and so on. I figured it would be good to have a thread actually dedicated to it, rather than having it creep into other threads (not that we can prevent that).
Some history, first:
Nethack, late 1980s: Ranged attacks in nethack are done by "throwing" (firing) a projectile from a launcher. You press t and then a direction key. Thus, firing only takes place in eight directions, or straight up in the air (to shoot yourself). Fast creatures have a huge advantage over slow creatures, because they can remain out of the line of fire (very different from the line of sight) of their pursuers. At least one in-game monster (unicorn) takes full advantage of this, always trying to stay out of the player's lines of fire (and very capable of doing it, due to its speed).
Wands worked the same way as projectiles, just using a different command. The only differences vs. projectiles are that some wand effects beam (pass through creatures and keep going), and some wand effects ricochet off walls (straight back at you if you hit a wall N/S/E/W, or a 90 degree bounce if you hit a wall diagonally). Spells were added at some point in the 1990s. Apart from the very few spells that have cone-shaped or ball-shaped areas of effect, the rest work just like wands (some are beams, some bounce off walls, etc.).
Some niche/joke weapons like boomerangs were also added. The boomerang flies in a circular path, back to the thrower, unless it hits a monster along the way. But these are not serious tactical options for the most part.
(Some may argue that ToME is not derived from Nethack in any way, but it would be disingenuous to ignore the influence of Nethack upon the entire genre.)
Angband, early 1990s: Ranged attacks in Angband target a creature, or a tile, rather than specifying a compass direction. The game calculates a flight path from the thrower/shooter to the target tile. Depending on the type of projectile, the attack may stop and fail when it hits a wall/creature, or it may continue through creatures (beam), or it may explode into a ball when it hits the wall/creature, etc.
It is very important to note that the flight path calculation goes straight to the target whenever possible, insofar as the square grid map allows. For example,
Shooter A can hit the target t, because the flight path from A to t goes east, then southeast. However, shooter B cannot hit target t, because the flight path from B to t goes east, then southeast, then east -- but the southeast step hits the wall.
However, it may be possible to target a tile inside the wall to the east of t. If shooter B targets tile x inside the wall, then the flight path from B to x goes 2 tiles east, then southeast, then 2 tiles east. This path takes the projectile through the real target t.
Thus, optimal play often requires tedious targeting beyond the actual creature you're trying to shoot. (The game actually makes this less painful than it sounds, because options can be set to let it remember a target. Once the target has been fixed, you can rapidly shoot at it several times. Still, many players dislike this.)
Under no circumstances can the creature at t shoot either A or B. There is no conceivable flight path that will not hit the wall first. The best t can do is step south, out of the line of fire. Failing that, it may be able to use a ball-shaped blast, catching A and/or B somewhere inside the blast radius (and also potentially harming itself in the process).
This makes proper positioning vitally important. Proper use of the terrain is a fundamental gameplay tactic. Many of the toughest battles in fact require terrain alterations (digging tunnels) to create conditions where the player has a chance to survive. (Bear in mind, the monsters are many, many times more powerful than the player. Virtually every significant endgame monster has mass summon spells, so if you are standing in an open room with the monster, you will be dead very quickly.)
ToME 2, late 1990s: As an Angband/Zangband variant, ToME 2 inherited the basic tactics of Angband. ToME 2's summoning capabilities (both on the part of the player and the monsters) were even stronger than Angband's, so if anything, the use of terrain alterations and line of sight tactics to compensate for hideously strong summoners was even more pronounced in ToME 2 than it was in Angband.
ToME 4, betas 1 through 33, early 2010s: In all the early betas of ToME 4, line of sight and field of fire worked exactly like they did in ToME 2. Which is to say, exactly like Angband. There were some versions where targeting beyond the monster was broken (with physical projectiles, but not with spells -- those always worked properly). But those bugs eventually did get fixed.
ToME 4, betas 34 through 43, early 2010s: In the later betas of ToME 4, field of fire changed to match line of sight. The new paradigm was if you can see it, and it's in range, you can shoot it.
In beta 34, not only could B shoot t without moving the target indicator, but so could C. Or someone standing even farther west. This didn't really change anything for single-target fire, because you could have targeted beyond the monster to make the shot, but it did eliminate the tedium of doing that.
However, it did change some things for talents that performed automatic targeting. Various Archer talents used multiple-target selections, and Angband-style targeting would often calculate flight paths that hit walls, rather than the creatures, which made these talents largely useless in the early betas. But in beta 34, they suddenly became powerful.
Take for example the Archer talent "Dual Arrows". You select a 3x3 area, and the game picks two targets inside that area and launches one arrow at each target, using automatic path calculation. In beta 33 and earlier, the archer standing at @ would not be able to hit the drakes (d), because each arrow would hit a wall. Single-target manual selection would have allowed the archer to target beyond the monster, and therefore hit either one of them, but Dual Arrows didn't work that way. But in beta 34, suddenly Dual Arrows was able to hit both of these monsters. The same goes for Volley of Arrows (but not Scatter Shot, which works completely differently).
The same issues applied for Anorithils using Corona, which produces automatically targeted projectiles on spell critical hits. This became dramatically more useful in beta 34.
ToME 4, RC1 through ??, 2012: In ToME 4 RC1, line of sight was changed to be "symmetric". The new paradigm was if you can see it, it can see you. This made the targeting resemble that of Dungeon Crawl (history not covered here). This changed battle tactics in a fundamental way:
In ToME RC1, not only could B or C shoot t, but t could shoot back. Characters with limited ranged capability could no longer use the terrain in the same ways they had been doing previously. Instead, they needed to change their entire tactical arsenal -- adding some ranged attack capability, or ranged defense, or mobility talents that would allow them to close the gap with ranged attackers.
Some history, first:
Nethack, late 1980s: Ranged attacks in nethack are done by "throwing" (firing) a projectile from a launcher. You press t and then a direction key. Thus, firing only takes place in eight directions, or straight up in the air (to shoot yourself). Fast creatures have a huge advantage over slow creatures, because they can remain out of the line of fire (very different from the line of sight) of their pursuers. At least one in-game monster (unicorn) takes full advantage of this, always trying to stay out of the player's lines of fire (and very capable of doing it, due to its speed).
Wands worked the same way as projectiles, just using a different command. The only differences vs. projectiles are that some wand effects beam (pass through creatures and keep going), and some wand effects ricochet off walls (straight back at you if you hit a wall N/S/E/W, or a 90 degree bounce if you hit a wall diagonally). Spells were added at some point in the 1990s. Apart from the very few spells that have cone-shaped or ball-shaped areas of effect, the rest work just like wands (some are beams, some bounce off walls, etc.).
Some niche/joke weapons like boomerangs were also added. The boomerang flies in a circular path, back to the thrower, unless it hits a monster along the way. But these are not serious tactical options for the most part.
(Some may argue that ToME is not derived from Nethack in any way, but it would be disingenuous to ignore the influence of Nethack upon the entire genre.)
Angband, early 1990s: Ranged attacks in Angband target a creature, or a tile, rather than specifying a compass direction. The game calculates a flight path from the thrower/shooter to the target tile. Depending on the type of projectile, the attack may stop and fail when it hits a wall/creature, or it may continue through creatures (beam), or it may explode into a ball when it hits the wall/creature, etc.
It is very important to note that the flight path calculation goes straight to the target whenever possible, insofar as the square grid map allows. For example,
Code: Select all
########
.BA..###
####t#x#
####.###
However, it may be possible to target a tile inside the wall to the east of t. If shooter B targets tile x inside the wall, then the flight path from B to x goes 2 tiles east, then southeast, then 2 tiles east. This path takes the projectile through the real target t.
Thus, optimal play often requires tedious targeting beyond the actual creature you're trying to shoot. (The game actually makes this less painful than it sounds, because options can be set to let it remember a target. Once the target has been fixed, you can rapidly shoot at it several times. Still, many players dislike this.)
Under no circumstances can the creature at t shoot either A or B. There is no conceivable flight path that will not hit the wall first. The best t can do is step south, out of the line of fire. Failing that, it may be able to use a ball-shaped blast, catching A and/or B somewhere inside the blast radius (and also potentially harming itself in the process).
This makes proper positioning vitally important. Proper use of the terrain is a fundamental gameplay tactic. Many of the toughest battles in fact require terrain alterations (digging tunnels) to create conditions where the player has a chance to survive. (Bear in mind, the monsters are many, many times more powerful than the player. Virtually every significant endgame monster has mass summon spells, so if you are standing in an open room with the monster, you will be dead very quickly.)
ToME 2, late 1990s: As an Angband/Zangband variant, ToME 2 inherited the basic tactics of Angband. ToME 2's summoning capabilities (both on the part of the player and the monsters) were even stronger than Angband's, so if anything, the use of terrain alterations and line of sight tactics to compensate for hideously strong summoners was even more pronounced in ToME 2 than it was in Angband.
ToME 4, betas 1 through 33, early 2010s: In all the early betas of ToME 4, line of sight and field of fire worked exactly like they did in ToME 2. Which is to say, exactly like Angband. There were some versions where targeting beyond the monster was broken (with physical projectiles, but not with spells -- those always worked properly). But those bugs eventually did get fixed.
ToME 4, betas 34 through 43, early 2010s: In the later betas of ToME 4, field of fire changed to match line of sight. The new paradigm was if you can see it, and it's in range, you can shoot it.
Code: Select all
########
CB...###
####t###
####.###
However, it did change some things for talents that performed automatic targeting. Various Archer talents used multiple-target selections, and Angband-style targeting would often calculate flight paths that hit walls, rather than the creatures, which made these talents largely useless in the early betas. But in beta 34, they suddenly became powerful.
Code: Select all
##########
#........#
#........#
#..d.d...#
#........#
####.#####
####.#####
####.#####
####@#####
####.#####
The same issues applied for Anorithils using Corona, which produces automatically targeted projectiles on spell critical hits. This became dramatically more useful in beta 34.
ToME 4, RC1 through ??, 2012: In ToME 4 RC1, line of sight was changed to be "symmetric". The new paradigm was if you can see it, it can see you. This made the targeting resemble that of Dungeon Crawl (history not covered here). This changed battle tactics in a fundamental way:
Code: Select all
########
CB...###
####t###
####.###