Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old January 24, 2020, 06:46   #11
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,596
Donated: $40
Pete Mack is on a distinguished road
I am kinda surprised the game doesn't use ounces. At every other opportunity, the original coding used shift operators as much as possible.
Pete Mack is offline   Reply With Quote
Old January 24, 2020, 06:53   #12
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 312
DavidMedley is on a distinguished road
How does distance affect stealth?

Question: How does distance affect stealth?

Quick Answer: The expected number of turns until a monster wakes is proportional to your distance from it. If you are twice as far, it takes twice as many turns to wake up.

Long Answer:
We know from the monster recall that there's a max distance at which a creature can hear you. This is calculated essentially the same as walking distance i.e., down hallways, around corners, through open/closed/broken doors, over passable rubble, but not through walls or impassable rubble. Additionally, a monster can see you, which ignores all light levels but otherwise works as you would expect (20 squares max, no visual obstructions).

If a monster can "notice [hear] you from 60 feet" you are safe from being heard at 6 squares away or more. In addition, every 3 full points of stealth you have reduces this by 1 square. All monsters can also notice [see] you from 210 feet, so you are safe from being seen at 21 squares away or if LOS is blocked.

If you are within this detection range, distance does not affect your chance to disturb the monster (stealth does). But distance can greatly affect how much you wake the monster per turn. The amount a monster wakes (loses sleepiness) is inversely proportional to the distance: 100/distance (round down). If a monster reaches 0 sleepiness, it wakes.

I'll address just how many sleepiness points a monster has and what your chance to disturb a monster is elsewhere.

Quick word on smell: If you look up a monster's stats (in monster.txt or elsewhere), smell is listed near hearing for most non-humans. This is not used for waking a monster at all. It is used to help an awake monster decide where to go to find you. Stealth has no effect.

-----

Some relevant code snippets

In the code below, local_noise is the distance noise has to travel from the player to the monster in game squares. Shows distance is inversely proportional to sleep reduction (closer wakes more).
Code:
int sleep_reduction = 1;
int local_noise = c->noise.grids[mon->grid.y][mon->grid.x];
/* Test - wake up faster in hearing distance of the player 
 * Note no dependence on stealth for now */
if ((local_noise > 0) && (local_noise < 50)) {
	sleep_reduction = (100 / local_noise);
}
The code below shows that monsters cannot hear you at exactly their "notice from" distance, and that stealth can reduce that distance.
Code:
static bool monster_can_hear(struct chunk *c, struct monster *mon)
{
	int base_hearing = mon->race->hearing
		- player->state.skills[SKILL_STEALTH] / 3;
	if (c->noise.grids[mon->grid.y][mon->grid.x] == 0) {
		return false;
	}
	return base_hearing > c->noise.grids[mon->grid.y][mon->grid.x];
}
Monsters also cannot smell you at their max smell distance
Code:
static bool monster_can_smell(struct chunk *c, struct monster *mon)
{
	if (c->scent.grids[mon->grid.y][mon->grid.x] == 0) {
		return false;
	}
	return mon->race->smell > c->scent.grids[mon->grid.y][mon->grid.x];
}
DavidMedley is offline   Reply With Quote
Old January 24, 2020, 06:54   #13
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 312
DavidMedley is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
I do notice that perfect stealth is not actually possible, as there is a 1/1024 chance of disturbance even when stealth is 30.
I'm pretty sure it's actually 2/1024
DavidMedley is offline   Reply With Quote
Old January 24, 2020, 14:38   #14
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,596
Donated: $40
Pete Mack is on a distinguished road
randint starts at 1.
Pete Mack is offline   Reply With Quote
Old January 25, 2020, 00:17   #15
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 312
DavidMedley is on a distinguished road
It may have changed
Code:
int player_noise = 1 << (30 - stealth);
int notice = randint0(1024);
...
if ((notice * notice * notice) <= player_noise)
{reduce sleep}
notice can be 0 or 1, so notice^3 can be, too. player_noise can't get less than 1. If they're both 1, sleep is reduced.
DavidMedley 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
how much do you value stealth in the endgame? Sky Vanilla 6 February 3, 2017 09:04
Legendary stealth Pete Mack AAR 8 July 13, 2016 20:08
Stealth Antoine Vanilla 10 June 11, 2013 04:35
Stealth vs Aggravation Tibarius Vanilla 7 July 11, 2011 22:57
Insane stealth Timo Pietilš Vanilla 32 March 31, 2011 22:52


All times are GMT +1. The time now is 14:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.