Difference between revisions of "Discussion:Field of Vision"

From RogueBasin
Jump to navigation Jump to search
(Re-structure, added obstructing diamonds method)
Line 1: Line 1:
__TOC__
__TOC__
= Tenants =
These were [http://angband.oook.cz/forum/showpost.php?p=20814&postcount=48 originally posted by PaulBlay], and were later expanded.  All of these are not necessarily desirable, and some of them may be mutually exclusive.
Visibility properties:
# '''Symmetry'''. Everything you see can see you, and vice versa.
# '''Expanding pillar shadows'''.  Standing directly next to a pillar produces an expanding shadow.
# '''Efficiency'''. Reasonably fast code can be produced to implement the FOV, etc.
# '''No blind corners'''.  Moving diagonally around a corner does not place you in melee range of a previous non-visible tile.
# '''Expansive visible walls'''.  You can see all of a room's walls while while standing anywhere inside of it, and all walls of a long, straight corridor.  Special cases could be used to give the player extra information about walls for a system which does not inherently possess this property.
# '''No hidden ghosts'''.  Passwall monsters inside of visible walls are always visible.
Targeting properties:
# '''Visible = Targetable'''.  You can target any visible tile.
# '''Non-exploitable'''. No trick shots required or possible to hit monsters that you can't target directly.
# '''No lost targeting'''.  Casting stone-to-mud on a walled, targetable ghost does not cause you to lose targeting on that tile.
Combining ''expansive visible walls'' with ''no hidden ghosts'' and ''visible = targetable'' would produce a system where pass-wall monsters had a significant threat advantage over the player, much more so than even in the current Angband system.
= Algorithms =
== Digital FOV ==
=== Description ===
[[Digital field of view]] was [http://angband.oook.cz/forum/showpost.php?p=20799&postcount=38 first mentioned by Atanvarno].  The player and monsters are treated as diamonds, with the four points centered on the containing tile's edge.  Drawing an unobstructed line from any part of one diamond to another diamond implies visibility.  Walls may be treated as diamonds as well, both for visibility and obstruction. 
=== Properties and advantages ===
''Symmetry, efficiency, no blind corners, expansive visible walls, no hidden ghosts''.  A demo implementation already exists, and has no known visibility artifacts.
=== Possible disadvantages ===
DFOV lacks ''expanding pillar shadows''.  From any location inside a corridor, the player can see 1 tile around the corner.  By standing on the corner, the player can see all the way down both corridors, including walls.  Combined with a targeting system that implements ''Visible = targetable'', pass-wall monsters may become significantly more challenging.
=== Consequences ===
Digital FOV ex.  %'s are walls out of sight.
  %%%%#%%
  %  . 
  %% ###%%
  % ...#
##....#
@.....#%%%%
##........#%
  % ...###...
  %  ..# %%%%
  %%%%##
A room 25% full of pillars.
  ..    ...    ..      #.#    #.#    #.#
. .#  #.#  #. .      ...    ...    ...
.. ..  ...  .. ..        #.#  #.#  #.#
  #. .# #.# #. .#          ...  ...  ...
  .. ....... ..            #.# #.# #.#
    #. .#.#. .#              .........
    .. ... ..        .#.#.#.#.#.#.#.#.#.#.
.#.#.#.#.#.#.#.#.    .....................
........@........              #@#
.#.#.#.#.#.#.#.#.    .....................
    .. ... ..        .#.#.#.#.#.#.#.#.#.#.
    #. .#.#. .#              .........
  .. ....... ..            #.# #.# #.#
  #. .# #.# #. .#          ...  ...  ...
.. ..  ...  .. ..        #.#  #.#  #.#
. .#  #.#  #. .      ...    ...    ...
  ..    ...    ..      #.#    #.#    #.#
== Diamond walls, point visibility ==
=== Description ===
Walls are considered diamond-shaped obstructions, with the 4 points of the diamond centered on the edges of the containing tile.  Visibility between two tiles is implied by drawing an unobstructed line between the centers of the two tiles.  The four points of the obstructing diamond do not obstruct visibility unless that point is adjacent to another wall tile (this allows extra visibility around corners, but prevents sight through walls).
=== Properties and advantages ===
''Symmetry, expanding pillar shadows, efficiency, no blind corners, no hidden ghosts.''  Ghosts are not visible in corridor walls from great distances, and thus pose no problem for a targeting system that uses ''visible = targetable''.
=== Possible disadvantages ===
This method lacks ''expansive visible walls'' which means part of a room's walls will not be visible to a player standing inside the room, if he is close to a wall or a corner.  This is more pronounced the closer to a wall, and the larger the room.  This could be corrected by automatically adding map memory for the walls of lit rooms, so while only some of the walls would be visible (and marked with a special color) all the walls of the room would appear to the player.  Additionally, a second point-to-diamond "tile visibility" check could be made to add extra visibility for wall tiles, but this would break ''no hidden ghosts'' and possibly ''no lost targeting''.
=== Consequences ===
Not all walls (or doors/monsters in those locations) are visible from all locations inside of a room.
####?????    #####????    ?#####???    ??#####??
#@.......    #.@......    #..@.....    #...@....
#........    #........    #........    #........
#........    #........    #........    #........
?........    #........    #........    #........
?........    #........    #........    #........
?........    ?........    #........    #........
?........    ?........    #........    #........


== Half-width walls, center to center ==
== Half-width walls, center to center ==
Line 107: Line 203:


Fig 12. @ can just see D (by allowing zero width cross).
Fig 12. @ can just see D (by allowing zero width cross).
== Digital FOV ==
[http://angband.oook.cz/forum/showpost.php?p=20799&postcount=38 First mentioned by Atanvarno]
See [[Digital field of view]] for details. Digital FOV is a symmetrical system.
Consequences.
  %%%%#%%
  %  . 
  %% ###%%
  % ...#
##....#
@.....#%%%%
##........#%
  % ...###...
  %  ..# %%%%
  %%%%##
Fig 14. Digital FOV ex.  %'s are walls out of sight.


== Traditional (Angband) ==  
== Traditional (Angband) ==  
Line 155: Line 230:
Fig 16. @ can see M, but M can't see @.
Fig 16. @ can see M, but M can't see @.


== Wouldn't it be nice if ... ==
[http://angband.oook.cz/forum/showpost.php?p=20814&postcount=48 Suggested by PaulBlay]
Wouldn't it be nice if ...
# What you see is what you can hit with a spell (and vice versa).
# What you see can also see you (and vice versa).
# Standing directly next to a pillar should produce an expanding shadow.
# Reasonably fast code can be produced to implement the FOV, etc.
# No 'trick shots' required (or possible) to hit monsters that you can't target directly.
Is everyone agreed on the above (if they are possible)?
How does the current system specifically differ from the above?
Are any of those points not possible?
PowerDiver and [http://angband.oook.cz/forum/showpost.php?p=20858&postcount=66 Atanvarno] are of the opinion that it is not possible to have all five of those at the same time.
[http://angband.oook.cz/forum/showpost.php?p=20880&postcount=75 zaimoni] disagrees that point 2 is a good thing, and Zaiband does not support it.
* Case 1 fails point 3.
* I'm not sure that Case 2 fails any, except possibly point 4.
* I'm not sure that Case 3 fails any.
* I think Case 4 fails point 3.
* Case 5 fails point 5 (also 1 and 2?)
* Case 6 intentionally fails point 2.
== Other points for consideration ==
Should @'s and M's have an infinite field of view?
#################################################################################################
.@.............................................................................................M.
#################################################################################################
Fig 17. Should @ see M ?
Special cases for walls (etc.)
* [http://roguebasin.roguelikedevelopment.org/index.php?title=Discussion:Field_of_Vision#Half-width_walls.2C_center_to_center Case 1] half-width walls. and [http://roguebasin.roguelikedevelopment.org/index.php?title=Discussion:Field_of_Vision#Digital_FOV Case 2] Digital FOV.
################################################################################################
.@..............................................................................................
Fig 18. @ can see the wall, and monsters in the wall, for as far as it goes.
* [http://roguebasin.roguelikedevelopment.org/index.php?title=Discussion:Field_of_Vision#Monsters_occupy_half_the_width.2Fheight_of_grid Case 2] and [http://roguebasin.roguelikedevelopment.org/index.php?title=Discussion:Field_of_Vision#Center_to_Center.2C_subdivided_grid Case 3]
####?%%%%%%
.@.........
Fig 19. @ can see #, % are walls he can't see, ? is indeterminate
The question is whether walls (but not monsters in walls) should be filled in when they are not visible, but are adjacent to room / corridor tiles that are visible and lit.
#####G#####
.@.........
Fig 20. @ can't see G (but can see wall G is in).


== See also ==
= See also =


[[Field of Vision]]
[[Field of Vision]]

Revision as of 16:17, 25 June 2009


Tenants

These were originally posted by PaulBlay, and were later expanded. All of these are not necessarily desirable, and some of them may be mutually exclusive.

Visibility properties:

  1. Symmetry. Everything you see can see you, and vice versa.
  2. Expanding pillar shadows. Standing directly next to a pillar produces an expanding shadow.
  3. Efficiency. Reasonably fast code can be produced to implement the FOV, etc.
  4. No blind corners. Moving diagonally around a corner does not place you in melee range of a previous non-visible tile.
  5. Expansive visible walls. You can see all of a room's walls while while standing anywhere inside of it, and all walls of a long, straight corridor. Special cases could be used to give the player extra information about walls for a system which does not inherently possess this property.
  6. No hidden ghosts. Passwall monsters inside of visible walls are always visible.

Targeting properties:

  1. Visible = Targetable. You can target any visible tile.
  2. Non-exploitable. No trick shots required or possible to hit monsters that you can't target directly.
  3. No lost targeting. Casting stone-to-mud on a walled, targetable ghost does not cause you to lose targeting on that tile.

Combining expansive visible walls with no hidden ghosts and visible = targetable would produce a system where pass-wall monsters had a significant threat advantage over the player, much more so than even in the current Angband system.

Algorithms

Digital FOV

Description

Digital field of view was first mentioned by Atanvarno. The player and monsters are treated as diamonds, with the four points centered on the containing tile's edge. Drawing an unobstructed line from any part of one diamond to another diamond implies visibility. Walls may be treated as diamonds as well, both for visibility and obstruction.

Properties and advantages

Symmetry, efficiency, no blind corners, expansive visible walls, no hidden ghosts. A demo implementation already exists, and has no known visibility artifacts.

Possible disadvantages

DFOV lacks expanding pillar shadows. From any location inside a corridor, the player can see 1 tile around the corner. By standing on the corner, the player can see all the way down both corridors, including walls. Combined with a targeting system that implements Visible = targetable, pass-wall monsters may become significantly more challenging.

Consequences

Digital FOV ex.  %'s are walls out of sight.

  %%%%#%%
  %  .   
 %% ###%%
 % ...#
##....#
@.....#%%%%
##........#%
 % ...###...
 %  ..# %%%%
 %%%%##


A room 25% full of pillars.

 ..    ...    ..       #.#     #.#     #.#
. .#   #.#   #. .       ...    ...    ...
.. ..  ...  .. ..        #.#   #.#   #.#
 #. .# #.# #. .#          ...  ...  ...
  .. ....... ..            #.# #.# #.#
   #. .#.#. .#              .........
    .. ... ..         .#.#.#.#.#.#.#.#.#.#.
.#.#.#.#.#.#.#.#.     .....................
........@........              #@#
.#.#.#.#.#.#.#.#.     .....................
    .. ... ..         .#.#.#.#.#.#.#.#.#.#.
   #. .#.#. .#              .........
  .. ....... ..            #.# #.# #.#
 #. .# #.# #. .#          ...  ...  ...
.. ..  ...  .. ..        #.#   #.#   #.#
. .#   #.#   #. .       ...    ...    ...
 ..    ...    ..       #.#     #.#     #.#

Diamond walls, point visibility

Description

Walls are considered diamond-shaped obstructions, with the 4 points of the diamond centered on the edges of the containing tile. Visibility between two tiles is implied by drawing an unobstructed line between the centers of the two tiles. The four points of the obstructing diamond do not obstruct visibility unless that point is adjacent to another wall tile (this allows extra visibility around corners, but prevents sight through walls).

Properties and advantages

Symmetry, expanding pillar shadows, efficiency, no blind corners, no hidden ghosts. Ghosts are not visible in corridor walls from great distances, and thus pose no problem for a targeting system that uses visible = targetable.

Possible disadvantages

This method lacks expansive visible walls which means part of a room's walls will not be visible to a player standing inside the room, if he is close to a wall or a corner. This is more pronounced the closer to a wall, and the larger the room. This could be corrected by automatically adding map memory for the walls of lit rooms, so while only some of the walls would be visible (and marked with a special color) all the walls of the room would appear to the player. Additionally, a second point-to-diamond "tile visibility" check could be made to add extra visibility for wall tiles, but this would break no hidden ghosts and possibly no lost targeting.

Consequences

Not all walls (or doors/monsters in those locations) are visible from all locations inside of a room.

####?????     #####????     ?#####???     ??#####??
#@.......     #.@......     #..@.....     #...@....
#........     #........     #........     #........
#........     #........     #........     #........
?........     #........     #........     #........
?........     #........     #........     #........
?........     ?........     #........     #........
?........     ?........     #........     #........

Half-width walls, center to center

Suggested by Eddie(PowerDiver).

This is a symmetrical system.

Consequences:

################D
@

Fig 1. @ can see D, D can see @

##D
##
@

Fig 2. Indeterminate (probably resolve to not visible).

#m
#
@#

Fig 3. Vital that @ can see m in this case.

......................
.@#                 M
......................

Fig 4. @ cannot see M (by zero-width blockage sub-rule - see fig 2)

.......
.@.....
...#...
..... .
.......

Fig 5. Discontinuous gaps in viewable area (by zero-width blockage)

Monsters occupy half the width/height of grid

Suggested by jv123.

Monsters, characters, items are in the center of their grid's square taking up half the width/height. If lines from any point in the @'s sub-square can go to any point in the M's sub-square without crossing a wall then each is visible by the other. Walls take up the full grid square.

This is a symmetrical system.

Consequences.

#####D######
@

Fig 6. @ cannot see D.

####D#######
@

Fig 7. It is indeterminate whether @ can see D or not (zero-width cross).

###D########
@

Fig 8. @ can see D and D can see @

Center to Center, subdivided grid

Suggested by Marble Dice

Any tile that can have a line drawn from the center of the @ to the center of the tile is without crossing an obstructed point is visible. Each wall takes up the middle 2x2 of the 4x4 sub-divided grid.

For visibility purposes a monster on a wall-tile is not treated differently from a monster on a floor tile.

Consequences.

#######.#######
#######@#######
????.......????
?.............?

Fig 8. From the entrance of a room.

................?
.........????????
.@.###?????M?????
.........????????
................?

Fig 9. @ cannot see M.

@...........
...#?.......
.....????...
.......?????
.........???

Fig 10. Expanding shadow triangle from pillar.

####D
@...

Fig 11. @ cannot see D.

###D#
@...

Fig 12. @ can just see D (by allowing zero width cross).

Traditional (Angband)

First mentioned by Atanvarno

Trick shots are possible (e.g. you can shoot at indirectly targeted grids that you cannot see or target directly).

Consequences.

###X.B
A.....

Fig 15. A cannot see X but can hit it by shooting at B.

Intentionally unsymmetrical

Suggested by will_asher

Monsters caught in open hallway have no where to hide. Intelligent @'s can peek round corners without being spotted.

    #.#    
#####@#
..M...#
#######

Fig 16. @ can see M, but M can't see @.


See also

Field of Vision