Chaosforge Forum

  • May 25, 2024, 18:09
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: LOS / bullet path issues  (Read 2565 times)

rchandra

  • Elder
  • Major
  • *
  • *
  • Offline Offline
  • Posts: 359
    • View Profile
LOS / bullet path issues
« on: March 01, 2011, 22:02 »

I thought it would be a good idea to collect the known LOS issues in one place, in case Kornel feels like tweaking the system.  Not sure if that place is Bug Report or Feature Request :)

1) Firing around a corner with a shotgun behaves asymmetrically
2) sometimes the auto-aim ([f]) will select a path through a wall to shoot a visible target.  you can generally work around this by aiming manually until you have a clear path.

3) not sure if this one is intentional:

You see : out of vision                                                       
 You hear the scream of a freed soul!                                           
                                                              #################
                                                              #...............#
                                                              #0..............#
                                                              #.>.....%.......#
                                                              #.........0.^...#
                                                              #...............#
                                           .                  #...............#
                                          %                   #...............#
                             ############/#####               #...............#
                             ...........}.......              #...............#
                            .......}..@..|......              #...............#
                            ......0.|.%.........              #.....%.........#
                             ########/#############           #....0..........#
                            0.......................          #...............#
                             ##############/###################...............#
                                  .....%....................../..............^#
                                  #/###########################........0......#
                                                              #...............#
                                                              #...............#
                                                              #################
 Rahul                      Armor : modified red armor [6/6] (84%) (P)         
 Health: 60%  Exp:  3/53%   Weapon: chaingun (1d6)x4 [24/40]                   
 cautious                                                    Phobos Base  Lev4 

the former human killed to my northeast where the % is was able to shoot me, but I couldn't see him (you can see the corpse is still in the "dark")

examples of point #1 in the above image: the door to my southeast (around 4-5 spaces).  standing immediately NE or NW of that and next to it, I cannot hit the wall 2 spaces to the south of the door by aiming at it with the combat shotgun, even though it is visible to me. I can stand SW/SE of the door and hit the wall 2 spaces to the north.

Feel free to add others, guys - I'm pretty sure there was at least one more oddity.
Logged
0.9.9.1-4: Arch-Vile Br. General [25/25/17/5/1]
0.9.9.5-7: Hell Baron Major [ 21 16 12 4 1 0 ]

Solarn

  • Sergeant
  • *
  • Offline Offline
  • Posts: 74
    • View Profile
Re: LOS / bullet path issues
« Reply #1 on: March 20, 2011, 04:53 »

Number 3 is basically the same thing as you firing from cover at an enemy that you can see, but which can't see you. It's just employed against you in this case.

Number 2 is, I think, due to the limitations of this being an ASCII game. Firing occurs in a straight line, but a straight line is represented on computers by a repeating pattern of pixels that look like a line from a distance (see attached image). Since a map tile is the smallest unit DoomRL can work with, it tries to use them as "pixels" to represent a straight line, resulting in firing paths that should be valid, but go through a wall.
Logged

Stormlock

  • Elder
  • Lance Corporal
  • *
  • *
  • Offline Offline
  • Posts: 36
  • Lost Soul
    • View Profile
Re: LOS / bullet path issues
« Reply #2 on: March 20, 2011, 09:01 »

Would be nice to see the mechanics of the current system laid out as far as what you can hit from what positions. The assymetry is what always gets me, standing in a doorway with a shotgun and then remembering I cant hit anything in the hallway in whatever direction. IIRC this can also depend on which shotgun you use and whether you aim far down the hall or diagonally so the edge of the blast should go down the hallway.
Logged

appuru

  • Elder
  • Sergeant
  • *
  • *
  • Offline Offline
  • Posts: 74
    • View Profile
Re: LOS / bullet path issues
« Reply #3 on: April 10, 2011, 22:11 »

Number 2 is, I think, due to the limitations of this being an ASCII game. Firing occurs in a straight line, but a straight line is represented on computers by a repeating pattern of pixels that look like a line from a distance (see attached image). Since a map tile is the smallest unit DoomRL can work with, it tries to use them as "pixels" to represent a straight line, resulting in firing paths that should be valid, but go through a wall.


The granularity of the lines shouldn't be an issue. I don't know exactly how it's implemented in the source code, but the targeting probably uses some variation of this:

http://en.wikipedia.org/wiki/Bresenham's_line_algorithm

If this is the case, auto aim can just discard the line being generated if the current pixel is being drawn on a wall while running the algorithm. Afterwards, you could just default to manual targeting if there are no more possible targets. If there are other valid paths between the same two points (I'm not sure if this is possible in-game, actually), then it would be neat if it automatically tried to use those if it finds a wall with the first choice.

I personally find it annoying that auto aim locks on to a target with an invalid path, but I can see it being somewhat useful for manually adjusting your shot after starting auto aim (by moving the cursor around the target to get a clear shot).
« Last Edit: April 10, 2011, 22:13 by appuru »
Logged

tehtmi

  • Programmer
  • Local Inquisitor
  • Lieutenant Colonel
  • *
  • *
  • Offline Offline
  • Posts: 458
    • View Profile
Re: LOS / bullet path issues
« Reply #4 on: April 10, 2011, 22:47 »

If you are inclined to learn more about how DoomRL handles LOS, most of the LOS related code is open source as part of valkyrie.  Look at vvision.pas.  (Or at least, as far as I could tell, DoomRL still uses this code.)

In short, the LOS code is a modification of Isaac Kuo's fast beam-casting algorithm.
Logged
Pages: [1]