Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old September 9, 2018, 11:54   #1
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,318
wobbly is on a distinguished road
how does stealth work?

Just checking some stuff.

A monster wakes on it's own turn? Perception is effectively multiplied by monster speed & divided by player speed.
Chance is stealth dependent?
Amount of sleepiness lost is distance dependent?
wobbly is offline   Reply With Quote
Old September 9, 2018, 12:26   #2
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,318
wobbly is on a distinguished road
Ok monsters wake in book keeping time not their turn. So player speed matters, monster speed doesn't?
wobbly is offline   Reply With Quote
Old September 9, 2018, 15:45   #3
t4nk
Swordsman
 
Join Date: May 2016
Posts: 330
t4nk is on a distinguished road
Quote:
Originally Posted by wobbly View Post
Just checking some stuff.
The calculations are:

edit: (LOL, disregard that. I just remembered that my Angband repo is on 4.0.5! I recall Nick changed stealth when he changed pathfinding)
edit2: (It seems he changed it back? well, then the description below is correct)

Player's noise is 1 << (30 - stealth). In other words, noise is 2 in the power of (30 - stealth).

Then, the game does this:
Code:
int notice = randint(1024);

if (notice * notice * notice <= noise)
{
    int wake_up_amount = 1;

    if (distance_to_player < 50)
         wake_up_amount = 100 / distance_to_player;

    wake_up_monster_a_little(wake_up_amount);
}
The noise stuff is in player-calcs.c: calc_bonuses() and other stuff in mon-move.c: process_monster_timed().

edit: in 4.1.3 it's in monster_reduce_sleep()

Quote:
A monster wakes on it's own turn? Perception is effectively multiplied by monster speed & divided by player speed. Chance is stealth dependent?
Amount of sleepiness lost is distance dependent?
Yes to all of that.

Last edited by t4nk; September 9, 2018 at 16:04.
t4nk is offline   Reply With Quote
Old September 9, 2018, 15:47   #4
t4nk
Swordsman
 
Join Date: May 2016
Posts: 330
t4nk is on a distinguished road
Quote:
Originally Posted by wobbly View Post
Ok monsters wake in book keeping time not their turn. So player speed matters, monster speed doesn't?
I think it does. process_monster():
Code:
    
    /* Not enough energy to move yet */
    if (mon->energy < minimum_energy) continue;

    ...

    /* Give this monster some energy */
    mon->energy += turn_energy(mspeed);

     /* End the turn of monsters without enough energy to move */
     if (!moving)
         continue;

    /* Use up "some" energy */
    mon->energy -= z_info->move_energy;

    /* Check if the monster is active */
    if (monster_check_active(c, mon)) {
        /* Process timed effects - skip turn if necessary */
         if (process_monster_timed(c, mon))
t4nk is offline   Reply With Quote
Old January 15, 2020, 12:16   #5
DavidMedley
Knight
 
Join Date: Oct 2019
Posts: 681
DavidMedley is on a distinguished road
How does distance affect stealth?

Incorrect conclusions deleted, corrected and reposted below.

Last edited by DavidMedley; January 24, 2020 at 03:48.
DavidMedley is offline   Reply With Quote
Old January 15, 2020, 15:02   #6
DavidMedley
Knight
 
Join Date: Oct 2019
Posts: 681
DavidMedley is on a distinguished road
Monster Awareness Ratings

I'm going to relate what my research has tentatively discovered. Confirmation or correction greatly appreciated. I'm sure I'm missing something, based on experiments.

Question: What do the monster "awareness" ratings mean in game terms?

Answer:
The descriptions given in monster recall correspond to values between 0 and 255. The table below shows what a monster race's "sleepiness" is based on that description.
Code:
Min	Max	Description
0	0	is ever vigilant for
1	1	is vigilant for
2	3	is very observant of
4	5	is observant of
6	10	is fairly observant of
11	25	takes a while to see
26	45	takes quite a while to see
46	75	tends to overlook
76	95	pays little attention to
96	200	pays very little attention to
201	255	prefers to ignore
When an individual monster is created in the dungeon (not summoned) it starts with a personalized sleepiness equal to RS*2+1d(RS*10) where RS is racial sleepiness. The level 1 "wild dog" has racial sleepiness 10, so each one will start with 20+1d100 individual sleepiness.

Each time a monster would normally get a turn, you have a chance to disturb its sleep. You must be within its detection range. If you do disturb it, its sleepiness goes down by 1 (or more if you're closer than 50 feet). If the monster reaches 0 sleepiness it wakes up. The chance for you to disturb a monster is 100% at stealth 0 or less, and decreases by almost exactly 50% for every 3 points of stealth, up to 28 where the minimum of about 0.20% is reached.

--------
But by that description, monsters would sleep about 10x too much!! So I must be missing something. Here's the code that I'm pretty sure converts the racial sleep into individual sleep (I need better terms there, as well).

Code:
	/* Enforce sleeping if needed */
	if (sleep && race->sleep) {
		int val = race->sleep;
		mon->m_timed[MON_TMD_SLEEP] = ((val * 2) + randint1(val * 10));
	}
DavidMedley is offline   Reply With Quote
Old January 24, 2020, 01:48   #7
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,738
Donated: $40
Pete Mack is on a distinguished road
David--look at the code above. the amount of wakeup is also scaled, by 100/distance. This means that you have to be nearby to wake it up fast, and adjacent you will wake him up in 1/10 nominal time.

Last edited by Pete Mack; January 24, 2020 at 02:08.
Pete Mack is offline   Reply With Quote
Old January 24, 2020, 03:31   #8
DavidMedley
Knight
 
Join Date: Oct 2019
Posts: 681
DavidMedley is on a distinguished road
OK. So when I read
Code:
int wake_up_amount = 1;

    if (distance_to_player < 50)
         wake_up_amount = 100 / distance_to_player;

    wake_up_monster_a_little(wake_up_amount);
I assumed that distance must be in feet. But if it's in squares then that's the order of magnitude I was missing. Thanks!!!
DavidMedley is offline   Reply With Quote
Old January 24, 2020, 04:23   #9
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,738
Donated: $40
Pete Mack is on a distinguished road
I do notice that perfect stealth is not actually possible, as there is a 1/1024 chance of disturbance even when stealth is 30.
Pete Mack is offline   Reply With Quote
Old January 24, 2020, 05:04   #10
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,023
Derakon is on a distinguished road
Quote:
Originally Posted by DavidMedley View Post
OK. So when I read
Code:
int wake_up_amount = 1;

    if (distance_to_player < 50)
         wake_up_amount = 100 / distance_to_player;

    wake_up_monster_a_little(wake_up_amount);
I assumed that distance must be in feet. But if it's in squares then that's the order of magnitude I was missing. Thanks!!!
I'm pretty sure that all of the units in-game are purely aesthetic, and you should divide by the greatest common denominator to get the numbers the code uses. For example, all item weights in the code are in decipounds, a bonkers unit if ever there was one.
Derakon 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 08:04
Legendary stealth Pete Mack AAR 8 July 13, 2016 19:08
Stealth Antoine Vanilla 10 June 11, 2013 03:35
Stealth vs Aggravation Tibarius Vanilla 7 July 11, 2011 21:57
Insane stealth Timo Pietilš Vanilla 32 March 31, 2011 21:52


All times are GMT +1. The time now is 06:44.


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