Bug: new-style monster list does not correctly report line-of-sight

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jv123
    Scout
    • May 2009
    • 37

    Bug: new-style monster list does not correctly report line-of-sight

    The new-style monster list doesn't always report line-of-sight correctly. Take a look at this save file. The character has telepathy and so is aware of the pack of hounds in the nearby room, but although he can target 3 of them directly, the monster list reports that he can't see any of them.

    Note that /without/ telepathy he likely wouldn't be able to see any, since the room isn't lit --- I guess that's how it's calculating things at the moment. But I think a different algorithm is needed to cope with things like this: for each monster you're aware of, you need to check directly to see if it's in line-of-sight.

    Cheers,
    JV.
    Attached Files
  • jv123
    Scout
    • May 2009
    • 37

    #2
    It also reports that you can see a monster, when you can't! Again, an example is attached.
    Attached Files

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #3
      Originally posted by jv123
      The new-style monster list doesn't always report line-of-sight correctly. Take a look at this save file. The character has telepathy and so is aware of the pack of hounds in the nearby room, but although he can target 3 of them directly, the monster list reports that he can't see any of them.

      Note that /without/ telepathy he likely wouldn't be able to see any, since the room isn't lit --- I guess that's how it's calculating things at the moment. But I think a different algorithm is needed to cope with things like this: for each monster you're aware of, you need to check directly to see if it's in line-of-sight.
      It already does that, using player_has_los_bold() - which clearly isn't working. I thought the 'bold' bit meant that it didn't check to see whether the square was lit, so it should have picked up this case.

      Thanks for the report - I've opened a ticket for this.
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • ajps
        Apprentice
        • May 2007
        • 50

        #4
        Originally posted by Magnate
        It already does that, using player_has_los_bold() - which clearly isn't working. I thought the 'bold' bit meant that it didn't check to see whether the square was lit, so it should have picked up this case.

        Thanks for the report - I've opened a ticket for this.
        I think player_has_los() is for actual genuine line-of-sight, not awareness or projectability and all that jazz. If you want everything targetable, use target_able() instead. If you want everything the player is aware of that might be able to get him with a breath, erm... you might have to do that yourself.

        Comment

        • Magnate
          Angband Devteam member
          • May 2007
          • 5110

          #5
          Originally posted by ajps
          I think player_has_los() is for actual genuine line-of-sight, not awareness or projectability and all that jazz. If you want everything targetable, use target_able() instead. If you want everything the player is aware of that might be able to get him with a breath, erm... you might have to do that yourself.
          Hmm. I'll try player_has_los() and see if it picks up this case of monsters sensed by ESP who are not visible to the naked eye. Thanks.
          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

          Comment

          • Magnate
            Angband Devteam member
            • May 2007
            • 5110

            #6
            Originally posted by Magnate
            In conclusion, I don't think there's anything wrong with the monlist code. I think the bug has revealed an underlying problem with the ESP code, in that monsters sensed by ESP do not update cave_info[] as viewable. Will look into this further. I'm working on an assumption that this bug only occurs with ESP - if anyone observes otherwise, let me know.
            Fixed in r1439.
            Last edited by Magnate; June 13, 2009, 14:19.
            "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

            Comment

            • Magnate
              Angband Devteam member
              • May 2007
              • 5110

              #7
              Ok, I have committed r1438 which uses player_can_see_bold rather than player_has_los_bold. I'm not sure if this will work (as it may rely on the grid being lit), but please test with ESP.
              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

              Comment

              • Magnate
                Angband Devteam member
                • May 2007
                • 5110

                #8
                Originally posted by Magnate
                Ok, I have committed r1438 which uses player_can_see_bold rather than player_has_los_bold. I'm not sure if this will work (as it may rely on the grid being lit), but please test with ESP.
                That wasn't the answer. The answer is to use (m_ptr->mflag & MFLAG_VIEW), which is designed to record visibility. It wasn't being set properly when monsters in LOS were detected by ESP - fixed in r1439.
                "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                Comment

                • jv123
                  Scout
                  • May 2009
                  • 37

                  #9
                  Thanks Magnate, a speedy fix as usual!

                  Comment

                  • Magnate
                    Angband Devteam member
                    • May 2007
                    • 5110

                    #10
                    Originally posted by jv123
                    Thanks Magnate, a speedy fix as usual!
                    Well, I gave up and used projectable() in r1441, as I think the LOS concept is broken with respect to ESP.
                    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                    Comment

                    • PowerDiver
                      Prophet
                      • Mar 2008
                      • 2820

                      #11
                      Originally posted by Magnate
                      That wasn't the answer. The answer is to use (m_ptr->mflag & MFLAG_VIEW), which is designed to record visibility. It wasn't being set properly when monsters in LOS were detected by ESP - fixed in r1439.
                      I wonder if that explains some of the disturb behavior I thought needed a change.

                      Comment

                      • PaulBlay
                        Knight
                        • Jan 2009
                        • 657

                        #12
                        Originally posted by Magnate
                        Well, I gave up and used projectable() in r1441, as I think the LOS concept is broken with respect to ESP.
                        Actually I think projectable may be more useful. Isn't it more useful to know what monsters can hit you with a spell / missile than which monsters you can see?
                        Currently turning (Angband) Japanese.

                        Comment

                        • jv123
                          Scout
                          • May 2009
                          • 37

                          #13
                          The original idea was that it should tell you which monsters you can target. That's the most useful thing.

                          Comment

                          • Magnate
                            Angband Devteam member
                            • May 2007
                            • 5110

                            #14
                            Originally posted by jv123
                            The original idea was that it should tell you which monsters you can target. That's the most useful thing.
                            Well, projectable() does that - but Paul should note that it's not symmetrical, so it doesn't necessarily capture everything that can target you.
                            "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                            Comment

                            • PaulBlay
                              Knight
                              • Jan 2009
                              • 657

                              #15
                              Originally posted by Magnate
                              Well, projectable() does that - but Paul should note that it's not symmetrical, so it doesn't necessarily capture everything that can target you.
                              Code:
                              if ((projectable(p_ptr->py, p_ptr->px, m_ptr->fy, m_ptr->fx, PROJECT_NONE) || 
                                      (projectable(m_ptr->fy, m_ptr->fx, p_ptr->py, p_ptr->px, PROJECT_NONE))
                              OK, now it's symmetrical.
                              Currently turning (Angband) Japanese.

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎