Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old January 10, 2009, 15:27   #1
half
Knight
 
half's Avatar
 
Join Date: Jan 2009
Posts: 898
half is on a distinguished road
(not) running into molds

There was recently a post about modifying the 'run' algorithm to avoid running into immobile monsters like molds. I had a look at the algorithm and one just needs to add the following to run_test() before it goes into the part where it looks for an open area. I've tested it and it seems to work well.


Code:
	/* Look at every soon to be newly adjacent square. */
	for (i = -max; i <= max; i++)
	{		
		/* New direction */
		new_dir = cycle[chome[prev_dir] + i];
		
		/* New location */
		row = py + ddy[prev_dir] + ddy[new_dir];
		col = px + ddx[prev_dir] + ddx[new_dir];
		
		/* Visible immovable monsters abort running */
		if (cave_m_idx[row][col] > 0)
		{
			monster_type *m_ptr = &mon_list[cave_m_idx[row][col]];
			monster_race *r_ptr = &r_info[m_ptr->r_idx];
			
			/* Visible monster */
			if (m_ptr->ml && (r_ptr->flags1 & (RF1_NEVER_MOVE))) return (TRUE);
			
		}
	}
half is offline   Reply With Quote
Old January 11, 2009, 11:13   #2
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,828
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by half View Post
There was recently a post about modifying the 'run' algorithm to avoid running into immobile monsters like molds. I had a look at the algorithm and one just needs to add the following to run_test() before it goes into the part where it looks for an open area. I've tested it and it seems to work well.
Thanks for this, when I go through fixing bugs in 3.1, I'll get this in.
takkaria is offline   Reply With Quote
Old May 20, 2009, 12:08   #3
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,054
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate Send a message via Skype™ to Magnate
Quote:
Originally Posted by takkaria View Post
Thanks for this, when I go through fixing bugs in 3.1, I'll get this in.
Has this already been done? Looking at pathfind.c, there is some very similar code in it now (r1402), but it is applied to *any* visible monster, rather than just those with NEVER_MOVE.

So does anything else need to be changed?
Magnate is offline   Reply With Quote
Old May 20, 2009, 12:49   #4
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,828
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by Magnate View Post
Has this already been done? Looking at pathfind.c, there is some very similar code in it now (r1402), but it is applied to *any* visible monster, rather than just those with NEVER_MOVE.

So does anything else need to be changed?
Hm, there should be a ticket for it somewhere, but I can only guess the answer is "no" because I don't remember doing it.
__________________
"Physician, heal thyself."
takkaria is offline   Reply With Quote
Old May 20, 2009, 12:55   #5
Cauldron
Apprentice
 
Join Date: May 2009
Posts: 62
Cauldron is on a distinguished road
Hallelujah, cause I lost my last character to a Trapper in the middle of a room. Killt me in 1 step.

-P
__________________
I miss autoscum... but not that much.
Cauldron is offline   Reply With Quote
Old May 20, 2009, 13:18   #6
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,054
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate Send a message via Skype™ to Magnate
Quote:
Originally Posted by takkaria View Post
Hm, there should be a ticket for it somewhere, but I can only guess the answer is "no" because I don't remember doing it.
It's ticket #700, and I think I'm failing to understand the changes proposed in this thread. Perhaps what is needed is an additional code block as posted above, which comes before (or after) the existing code block about visible monsters. So that we look one square further away for immobile monsters. Maybe.
Magnate is offline   Reply With Quote
Old May 20, 2009, 22:37   #7
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
Seems like it'd be easier to add something in update_mon() which makes it disturb you whenever you're adjacent to a (visible) monster. (That's what I was going to do to address the same problem)
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old May 23, 2009, 21:30   #8
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,054
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate Send a message via Skype™ to Magnate
Quote:
Originally Posted by will_asher View Post
Seems like it'd be easier to add something in update_mon() which makes it disturb you whenever you're adjacent to a (visible) monster. (That's what I was going to do to address the same problem)
But by the time you're adjacent to a monster, it's too late. I think the existing code already does that. I think the suggestion proposed by the OP is to look one square further away and stop *before* we step adjacent to a monster. Since running no longer cuts corners, this should be legitimate - you'd stop in the corner if the floating eye was two squares from it, the moment it became visible.

I just don't understand how the OP's code should be applied to the existing code, as it's not in patch format.
Magnate is offline   Reply With Quote
Old May 24, 2009, 00:50   #9
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,054
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate Send a message via Skype™ to Magnate
Quote:
Originally Posted by Magnate View Post
But by the time you're adjacent to a monster, it's too late. I think the existing code already does that. I think the suggestion proposed by the OP is to look one square further away and stop *before* we step adjacent to a monster. Since running no longer cuts corners, this should be legitimate - you'd stop in the corner if the floating eye was two squares from it, the moment it became visible.

I just don't understand how the OP's code should be applied to the existing code, as it's not in patch format.
I finally worked it out. The OP wasn't talking about running into molds/eyes as you round corners - that was already working. He was talking about running into molds that you can already see. It never occurred to me that anyone would run towards a mold they could already see, so I didn't understand what he was getting at.

Fixed in r1413 - thanks for the patch.
Magnate is offline   Reply With Quote
Old May 24, 2009, 02:35   #10
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Quote:
Originally Posted by Magnate View Post
It never occurred to me that anyone would run towards a mold they could already see,.
You've never run into a monster you didn't notice?

Damned youngsters with perfect vision and attention to detail can't understand the problems of dotards playing while under the influence of one too many Guinness.
PowerDiver 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
Problems running Angband ChodTheWacko Vanilla 12 January 12, 2011 08:43
Feature Request: running around still monsters Donald Jonker Vanilla 3 January 2, 2009 21:25
Sangband running slow on Leopart vnat Variants 0 November 1, 2008 16:03
Disturbs when running. Zero Vanilla 1 June 19, 2008 17:30
Anyone running the nightlies... takkaria Vanilla 3 July 13, 2007 17:54


All times are GMT +1. The time now is 21:37.


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