Pack UI = artificial stupidity?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Timo Pietilä
    Prophet
    • Apr 2007
    • 4096

    Pack UI = artificial stupidity?

    I think we need to revise now a very old pack behavior AI. That ambush-AI just doesn't work, hounds, spiders etc. that charge "stupidly" at you are more dangerous than hounds that don't.

    The very least is to make that AI force attack when monster is hurt, no matter if player is in sight or not. It feels stupid that I can stand on corridor infinitely and blast hounds with ball-spells until they all are dead, when that same group of monsters could make minced meat out of me by attacking immediately.

    Best AI would be "ambush" with some knowledge of other members of the group, so that if one of them get hurt they all attack at once. This still allows dealing with them one by one, but that standing in corridor blasting monsters with ball-spells would turn deadly.

    Or just plain remove that AI. It is no use as it is now.
  • buzzkill
    Prophet
    • May 2008
    • 2939

    #2
    Aggravation .
    www.mediafire.com/buzzkill - Get your 32x32 tiles here. UT32 now compatible Ironband and Quickband 9/6/2012.
    My banding life on Buzzkill's ladder.

    Comment

    • ewert
      Knight
      • Jul 2009
      • 707

      #3
      I second the idea of making pack AI so that if any member of the pack is hurt, it "turns off" (as in they get "stupid" and try to kill the player that is killing them from safety).

      Comment

      • Derakon
        Prophet
        • Dec 2009
        • 9022

        #4
        The main issue there is that it requires tracking the pack so that monsters can appraise each other of how they're doing.

        An alternate approach would be to charge the player (permanently disabling ambush AI) if they have not moved towards the room for a few turns. That could be used as a shorthand for "player knows the pack is in the room". Ambush AI is only really useful for surprising players who haven't detected the monsters, so as soon as the monsters suspect that's happened, they should give up on an ambush.

        Alternately you could use the act of detecting itself to toss the monsters out of ambush mode, but that seems weird.

        Comment

        • ewert
          Knight
          • Jul 2009
          • 707

          #5
          Maybe have pack monsters have a "shriekerlike" effect, doing a LoS "aggravate" on same type pack monsters that turns off the AI? Doesn't sound too complicated, mostly adding a monster ability and check on AI based on the ability turned on?

          Comment

          • d_m
            Angband Devteam member
            • Aug 2008
            • 1517

            #6
            I think it could be even simpler... a monster only acts using pack AI if none of the other visible monsters are damaged.
            linux->xterm->screen->pmacs

            Comment

            • Nick
              Vanilla maintainer
              • Apr 2007
              • 9647

              #7
              Originally posted by d_m
              I think it could be even simpler... a monster only acts using pack AI if none of the other visible monsters are damaged.
              I like it.
              One for the Dark Lord on his dark throne
              In the Land of Mordor where the Shadows lie.

              Comment

              • fizzix
                Prophet
                • Aug 2009
                • 3025

                #8
                Originally posted by d_m
                I think it could be even simpler... a monster only acts using pack AI if none of the other visible monsters are damaged.
                This is good.

                I might propose a slight change. Monsters need to be the same type.

                Comment

                • Derakon
                  Prophet
                  • Dec 2009
                  • 9022

                  #9
                  Yeah, that sounds good.

                  Also turn it off it there are fewer than N visible monsters of that type (N = 3?).

                  Comment

                  • fizzix
                    Prophet
                    • Aug 2009
                    • 3025

                    #10
                    Originally posted by Derakon
                    Yeah, that sounds good.

                    Also turn it off it there are fewer than N visible monsters of that type (N = 3?).
                    I originally wrote this also but then erased it.

                    I think it's actually smart behavior for single animals to retreat to rooms to ambush you and get the first breath in.

                    Comment

                    • camlost
                      Sangband 1.x Maintainer
                      • Apr 2007
                      • 523

                      #11
                      Originally posted by Derakon
                      Yeah, that sounds good.

                      Also turn it off it there are fewer than N visible monsters of that type (N = 3?).
                      So revert to normal mode once the pack is mostly dead by rushing (i.e. ambush unless player is wounded)?

                      Code:
                      bool comrade_hurt(monster_type *m_ptr, bool include_self)
                      {
                      	monster_type *n_ptr;
                      	int i;
                      
                      	if (m_ptr->hp < m_ptr->maxhp && include_self) return (TRUE);
                      
                      	/* Loop over all monsters */
                      	for (i = 1; i < m_max; i++)
                      	{
                      		/* Get the monster */
                      		n_ptr = &m_list[i];
                      
                      		/* Check monster index */
                      		if (n_ptr->r_idx != m_ptr->r_idx) continue;
                      
                      		/* Check HP */
                      		if (n_ptr->hp == n_ptr->maxhp) continue;
                      
                      		/* Check LOS */
                      		if (!projectable(n_ptr->fy, n_ptr->fx, m_ptr->fy, m_ptr->fx, PROJECT_JUMP)) continue;
                      
                      		/* We can see a hurt comrade */
                      		return (TRUE);
                      	}
                      
                      	return (FALSE);
                      }
                      Here's my code fragment for checking on this; it seems to work. I'd have to give some thought to the behavior once the pack dwindles.
                      a chunk of Bronze {These look tastier than they are. !E}
                      3 blank Parchments (Vellum) {No french novels please.}

                      Comment

                      • ewert
                        Knight
                        • Jul 2009
                        • 707

                        #12
                        This was a morning bleary eyes post. =P

                        Anyways, does that check the whole dungeonfull of monsters? Yeah we have plenty of headroom on computers nowadays ... just feels wasteful to me to check that each and every time for all monster for each monster. Computing power saving was the reason I initially thought about a LoS "shriekereffect" ... it's only called if the monster gets hurt, and effects only monsters in LoS. =P

                        Comment

                        • camlost
                          Sangband 1.x Maintainer
                          • Apr 2007
                          • 523

                          #13
                          Originally posted by ewert
                          This was a morning bleary eyes post. =P

                          Anyways, does that check the whole dungeonfull of monsters? Yeah we have plenty of headroom on computers nowadays ... just feels wasteful to me to check that each and every time for all monster for each monster. Computing power saving was the reason I initially thought about a LoS "shriekereffect" ... it's only called if the monster gets hurt, and effects only monsters in LoS. =P
                          I don't know about other variants, but here's a snippit from S's project_los function.

                          Code:
                          	/* Mark monsters in LOS */
                          	for (i = 1; i < m_max; i++)
                          	{
                          		monster_type *m_ptr = &m_list[i];
                          
                          		/* Paranoia -- Skip dead monsters */
                          		if (!m_ptr->r_idx) continue;
                          
                          		/* Location */
                          		y = m_ptr->fy;
                          		x = m_ptr->fx;
                          
                          		/* Apply character-centered test */
                          		if (line_of_fire)
                          		{
                          			/* Require line of fire */
                          			if (!player_can_fire_bold(y, x)) continue;
                          		}
                          
                          		/* Apply generic grid test */
                          		else
                          		{
                          			/* Get distance between source and monster */
                          			d = distance(y0, x0, y, x);
                          
                          			/* LOS extends only to max sight range */
                          			if (d > MAX_RANGE) continue;
                          
                          			/* Check LOS if not at grid or adjacent */
                          			if (d > 1)
                          			{
                          				/* Ignore if not in LOS */
                          				if (!los(y0, x0, y, x)) continue;
                          			}
                          		}
                          
                          		/* Mark the monster */
                          		m_ptr->mflag |= (MFLAG_TEMP);
                          	}
                          All the monsters isn't a lot when the first filter eliminates most of the monsters. The only slow calculation in that code is the project code, which is why it's last.

                          But I should probably use the los function now that I know it exists.
                          a chunk of Bronze {These look tastier than they are. !E}
                          3 blank Parchments (Vellum) {No french novels please.}

                          Comment

                          • ewert
                            Knight
                            • Jul 2009
                            • 707

                            #14
                            The difference is, a "is friend hurt" is checked at every pass, whereas "I'm hurt guys" only happens when hurt. Say a pack of 12 hounds:

                            Every monster turn: 12 checks for if hurt for all LoS
                            vs.
                            Player damages monster: 1 check for all LoS to set "hurt" flag per damaged monster. It could even check for "hurt" flag prior checking LoS, since that is a single boolean check vs. complex LoS computing.

                            Okay we have officially gone into geekdom now, we have gigahertz computers and we are debating code efficiency in an ascii game! ... =P Woooot!

                            Comment

                            • ewert
                              Knight
                              • Jul 2009
                              • 707

                              #15
                              THOUGH I have to say, on my netbook the game is NOT as fast as on my desktop. It's not slow (well starting a new char takes a couple of secs), but it definitely is not the "instantspeed" of my desktop.

                              Comment

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