Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old October 5, 2017, 11:58   #361
PowerWyrm
Veteran
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,146
PowerWyrm is on a distinguished road
Quote:
Originally Posted by PowerWyrm View Post
But this still doesn't work in some cases. Sometimes, the straight path moves the monster to a position where the straight path is blocked and pathfinding moves the monster back where it was, so there's still an endless loop. In that case, the loop must be broken by still continuing using pathfinding one more time.
It does now. Simply adding old position for monster and checking if the old position is the first step on the straight path (in this case using pathfinding code instead) did the job. I tested with a char inside and outside a permawalled vault, and each time Morgoth was able to find the @ without getting stuck.

Code below (from PWMAngband) if interested (this replaces monster_near_permwall):

Code:
/*
 * Find whether a PASS_WALL or KILL_WALL monster has a clear path to the player.
 *
 * This is a modified/simplified version of project_path().
 */
static bool can_path_player(struct player *p, const struct monster *mon, struct chunk *c)
{
    int y, x;
    int y1 = mon->fy;
    int x1 = mon->fx;
    int y2 = p->py;
    int x2 = p->px;

    /* Absolute */
    int ay, ax;

    /* Offsets */
    int sy, sx;

    /* Fractions */
    int frac;

    /* Scale factors */
    int full, half;

    /* Slope */
    int m;

    /* If player is in LOS, there's no need to go around walls */
    if (projectable_wall(c, y1, x1, y2, x2)) return true;

    /* Analyze "dy" */
    if (y2 < y1)
    {
        ay = (y1 - y2);
        sy = -1;
    }
    else
    {
        ay = (y2 - y1);
        sy = 1;
    }

    /* Analyze "dx" */
    if (x2 < x1)
    {
        ax = (x1 - x2);
        sx = -1;
    }
    else
    {
        ax = (x2 - x1);
        sx = 1;
    }

    /* Number of "units" in one "half" grid */
    half = (ay * ax);

    /* Number of "units" in one "full" grid */
    full = half << 1;

    /* Vertical */
    if (ay > ax)
    {
        /* Start at tile edge */
        frac = ax * ax;

        /* Let m = ((dx/dy) * full) = (dx * dx * 2) = (frac * 2) */
        m = frac << 1;

        /* Start */
        y = y1 + sy;
        x = x1;

        /* Never go back from whence we came */
        if ((x == mon->old_fx) && (y == mon->old_fy)) return false;

        /* Create the projection path */
        while (1)
        {
            /* Stop at destination grid */
            if ((x == x2) && (y == y2)) return true;

            /* Stop at permawall grids */
            if (square_isperm(c, y, x)) return false;

            /* Slant */
            if (m)
            {
                /* Advance (X) part 1 */
                frac += m;

                /* Horizontal change */
                if (frac >= half)
                {
                    /* Advance (X) part 2 */
                    x += sx;

                    /* Advance (X) part 3 */
                    frac -= full;
                }
            }

            /* Advance (Y) */
            y += sy;
        }
    }

    /* Horizontal */
    else if (ax > ay)
    {
        /* Start at tile edge */
        frac = ay * ay;

        /* Let m = ((dy/dx) * full) = (dy * dy * 2) = (frac * 2) */
        m = frac << 1;

        /* Start */
        y = y1;
        x = x1 + sx;

        /* Never go back from whence we came */
        if ((x == mon->old_fx) && (y == mon->old_fy)) return false;

        /* Create the projection path */
        while (1)
        {
            /* Stop at destination grid */
            if ((x == x2) && (y == y2)) return true;

            /* Stop at permawall grids */
            if (square_isperm(c, y, x)) return false;

            /* Slant */
            if (m)
            {
                /* Advance (Y) part 1 */
                frac += m;

                /* Vertical change */
                if (frac >= half)
                {
                    /* Advance (Y) part 2 */
                    y += sy;

                    /* Advance (Y) part 3 */
                    frac -= full;
                }
            }

            /* Advance (X) */
            x += sx;
        }
    }

    /* Diagonal */
    else
    {
        /* Start */
        y = y1 + sy;
        x = x1 + sx;

        /* Never go back from whence we came */
        if ((x == mon->old_fx) && (y == mon->old_fy)) return false;

        /* Create the projection path */
        while (1)
        {
            /* Stop at destination grid */
            if ((x == x2) && (y == y2)) return true;

            /* Stop at permawall grids */
            if (square_isperm(c, y, x)) return false;

            /* Advance (Y) */
            y += sy;

            /* Advance (X) */
            x += sx;
        }
    }
}
Code:
/* If the monster can pass through nearby walls, do that */
if (monster_passes_walls(mon->race) && can_path_player(p, mon, c))
...
__________________
PWMAngband variant maintainer - check http://www.mangband.org/forum/viewforum.php?f=9 to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old October 5, 2017, 15:31   #362
dreembeard
Scout
 
dreembeard's Avatar
 
Join Date: Sep 2017
Location: Netherlands
Posts: 46
dreembeard is on a distinguished road
Exclamation monster memory still based on old pathfinding

Some (newly arrived) cold hounds just burst through a door at relative position 2 S, 36 E. That means that the info in the monster memory "... ever vigilant for intruders, which it may notice from 300 ft" is misleading.

Not sure how the new multi-sense pathfinding works exactly, but I'd say the monster memory should either list max(hearing, smell) instead of hearing as the monster's detection range, or add something like "It can also pick up your scent" or "... follow your scent trail." for monsters that can.
dreembeard is offline   Reply With Quote
Old October 5, 2017, 17:10   #363
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,347
Donated: $40
Pete Mack is on a distinguished road
The easy way to solve this is to set up another path finding table conditionally if a KILL WALL/PASSWALL monster runs into permarock. It's expensive, since it needs to cover every square in the dungeon. But it's a lot simpler codewise than messing around with special cases.

I don't find the permarock issue that big a deal actually.sic The primary effect of it is to make Morgoth too smart to fight @ in a confined space. Yeah, it also keeps certain annoying monsters from finding you in a vault, but that's a lesser issue.

The big thing about pathfinding is that monsters get really stupid around low level (permanently scared) and/or sleeping monsters.
Pete Mack is offline   Reply With Quote
Old October 5, 2017, 22:58   #364
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,702
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
The easy way to solve this is to set up another path finding table conditionally if a KILL WALL/PASSWALL monster runs into permarock. It's expensive, since it needs to cover every square in the dungeon. But it's a lot simpler codewise than messing around with special cases.
That's a good point. I'll have a thin about that vs PowerWyrm's code.

Quote:
Originally Posted by dreembeard View Post
Not sure how the new multi-sense pathfinding works exactly, but I'd say the monster memory should either list max(hearing, smell) instead of hearing as the monster's detection range, or add something like "It can also pick up your scent" or "... follow your scent trail." for monsters that can.
Another good point. Pathfinding currently (essentially) uses sight, sound and smell; in the upcoming monster list rework it would make sense to think of each monster in terms of how good it is at each of these, and report that sensibly in monster memory. It also raises the question of blinding or deafening monsters as a status effect.
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old October 6, 2017, 10:58   #365
PowerWyrm
Veteran
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,146
PowerWyrm is on a distinguished road
Quote:
Originally Posted by PowerWyrm View Post
Found a cursed randart ring with the following properties:

Code:
     It randomly makes you teleport.
     It occasionally makes a loud noise.
     It paralyses you every now and then.
     It makes you too scared to fight.
     Provides resistance to lightning.
     Cannot be harmed by lightning.
     Makes you afraid of melee, and worse at shooting and casting spells.
     Prevents teleportation. Aggravates nearby creatures.
So we have both "teleport" and "no-teleport" effects, and the "terror" effect twice.

When adding a curse, "teleport" and "no-teleport" are conflicting, so an object cannot get both teleportation and anti-teleportation curses. However, for randarts, the code that handles curses (the "make_bad" function) adds the OF_NO_TELEPORT flag directly, and not the anti-teleportation curse, so the conflict can still happen.

For the double "terror" effect, this simply comes from the fact that the "cowardice" curse is added on a randart based off a ring of Escaping.

Looking at append_object_curse(), there's a test made to reject curses where the effect would be foiled by an object property (for ex. paralysis curse on an item with free action), but nothing is done to reject curses with a flag conflicting with an object property (for ex. teleportation curse on an item with OF_NO_TELEPORT), or curses with a flag already present on the object (for ex. cowardice curse on an item with OF_AFRAID).
In PWMAngband, I added a "reject:flag" line in curse.txt to reject curses where the flag is already present on the object (either conflicting or redundant). This impacts teleportation (NO_TELEPORT), impair mana recovery (IMPAIR_MANA), impair hitpoint recovery (IMPAIR_HP), cowardice (AFRAID) and anti-teleportation (NO_TELEPORT) curses. The other curses are not impacted because they often add more maluses than simply a flag (for example: vulnerability adds -AC along with AGGRAVATE, so objects with the AGGRAVATE flag will still "malefit" from the curse).
__________________
PWMAngband variant maintainer - check http://www.mangband.org/forum/viewforum.php?f=9 to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old October 7, 2017, 08:41   #366
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,702
Donated: $60
Nick is on a distinguished road
New builds up on the nightlies page, with the following changes:
  • Line of sight updates correctly after rubble falls (#2043)
  • No more crashes in debug "play with object" (#2051)
  • Door opening and bashing logic corrected and clarified (#2034)
  • No more crash when exiting fullscreen in map mode in the SDL port (#2052)
  • Windows sound now works (#2028)

The issue of characters with RBlind being apparently blind after darkness is cast appears actually to be incomplete refreshing of the field of view - so adjacent grids remain "unknown". I haven't worked out why it's happening yet, though.
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old October 7, 2017, 10:41   #367
Thraalbee
Swordsman
 
Thraalbee's Avatar
 
Join Date: Sep 2010
Location: Stockholm
Posts: 409
Thraalbee is on a distinguished road
Broken savefile in nightlies

I shut down the game properly yesterday. Then today I can't open the savefile.
angband-4.1.0-29-g79244767. It says:
Code:
Cannot read monster 17
Savefile corrupted - Couldn't load block monsters
A pain since I was in perfect shape to accomplish my goal, but I have a savefile from a couple of days ago on a backup so not critical for my part. Still a painful bug so posting here.
Attached Files
File Type: zip Ironien.zip (18.3 KB, 9 views)
Thraalbee is offline   Reply With Quote
Old October 7, 2017, 12:54   #368
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,702
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by Thraalbee View Post
I shut down the game properly yesterday. Then today I can't open the savefile.
angband-4.1.0-29-g79244767. It says:
Code:
Cannot read monster 17
Savefile corrupted - Couldn't load block monsters
A pain since I was in perfect shape to accomplish my goal, but I have a savefile from a couple of days ago on a backup so not critical for my part. Still a painful bug so posting here.
I'll need your randart file too (it should be called randart_0d64e15a.txt).
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old October 7, 2017, 13:25   #369
Thraalbee
Swordsman
 
Thraalbee's Avatar
 
Join Date: Sep 2010
Location: Stockholm
Posts: 409
Thraalbee is on a distinguished road
Thanks. File attached
Attached Files
File Type: zip randart_0d64e15a.zip (8.9 KB, 5 views)
Thraalbee is offline   Reply With Quote
Old October 7, 2017, 14:53   #370
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,702
Donated: $60
Nick is on a distinguished road
This should work:
Attached Files
File Type: zip Ironien.zip (17.9 KB, 4 views)
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Some Sil issues fph Sil 12 January 4, 2013 01:41
Gear Issues Monkay AAR 1 February 25, 2012 18:32
Compilation issues. Tiburon Silverflame Development 8 March 1, 2010 21:34
DaJAngband Issues Prismatic Variants 12 February 15, 2010 16:08
Compiling Issues Gregian Vanilla 13 July 2, 2008 15:35


All times are GMT +1. The time now is 22:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.