General Info
The Stealth skill boosts your character's stealth -- that is, her ability to move without waking monsters. In ToME 2.2 and earlier, your stealth is primarily determined by your race and class, and the skill can add to that (along with equipment). In ToME 2.3, your race and class only affect your starting skill level in Stealth, and the final calculation of your character's stealth is based only on the Stealth skill and her equipment.
Tactical settings also affect stealth -- both "Tactics" and "Explore". Running decreases stealth by a lot, as does going into a Berserk rage.
I'm using Stealth with a capital S to refer to the skill, and stealth with a lower-case s to refer to the final calculated value that actually matters within the game. The latter (stealth) is what determines the probability of monsters awakening, and also what label you see on the character sheet (Bad, Poor, etc.).
Strategy Recommendations
A sufficiently high stealth makes the Nirnaeth quest extremely simple, because all the monsters in that quest start out asleep. A character with perfect stealth can complete the quest by killing a single Olog and then walking around everything else.
Code-Related Information
In ToME 2.3, your stealth is calculated by starting with 0, adding the bonuses or penalties for your tactical settings, adding 1 (why not start with 1? who knows...), and then adding get_skill_scale(SKILL_STEALTH, 25). That basically means you get a point of stealth for every 2 points of Stealth.
Once this is computed (and equipment bonuses are added in), anything below zero is raised to 0, and anything over 30 is lowered to 30. A stealth score of 30 is the highest possible.
When monsters are processed (each game turn), your "noise" is computed as noise = (1L << (30 - p_ptr->skill_stl)). So, a stealth of 30 means you have a noise of 1; a stealth of 29 gives a noise of 2; 28 gives 4; and so on up to stealth 0 which gives a noise of 230 (a bit over a billion).
Every time a monster is processed, if it is asleep, and if you do not aggravate, the monster rolls a random number from 0 to 1023. This number is cubed, and if it's less than or equal to your noise, the monster is "disturbed", and becomes a bit less sleepy.
The following table shows the correlation between your stealth and the descriptive label in the character sheet:
stealth |
description |
0-1 |
Bad |
2 |
Poor |
3-4 |
Fair |
5 |
Good |
6 |
Very Good |
7-8 |
Excellent |
9-13 |
Superb |
14-17 |
Heroic |
18+ |
Legendary[n] |
The n in the Legendary description is computed by subtracting 17, multiplying by 5, then dividing by 2 (truncating). A character with the highest possible stealth (30) would therefore have a description of Legendary[32].
And this table shows the effects of tactical settings:
Explore |
Effect |
-- |
Tactic |
Effect |
slug-like |
+4 |
-- |
coward |
+3 |
very slow |
+4 |
-- |
meek |
+3 |
slow |
+3 |
-- |
wary |
+2 |
leisurely |
+2 |
-- |
careful |
+1 |
normal |
0 |
-- |
normal |
0 |
brisk |
-1 |
-- |
confident |
-1 |
fast |
-4 |
-- |
aggressive |
-2 |
very fast |
-7 |
-- |
furious |
-3 |
running |
-10 |
-- |
berserker |
-5 |
Chatter
FeathinSilyar So the difference between monsters, described in monster descriptions of how well they notice the player and at what distance, are applied as number of times they have to be disturbed to wake up, and have to be within the distance to begin to be disturbed?
GreyCat: That particular part of the code is pretty subtle, so I might not have a full understanding of it. There's a field within each monster's data structure called "cdis", which is the monster's current distance from the player. When monsters are being processed each game turn, the monster's cdis has to be less/equal to the monster race's "aaf" field (which stands for "area affect" [sic]... yikes!). If the monster is too far away, based on that type of monster's "aaf", that particular monster is not eligible for processing, which means (among other things) it can't be woken up.
There's another field within each monster's data called "csleep", which is how deeply the monster is asleep. Each time a monster is disturbed by the player's noise (failure of a stealth roll, basically), csleep is decremented by a little bit (the lower cdis is, the more it's decremented). When csleep hits 0, the monster wakes up.
So it's not strictly "the number of times they have to be disturbed" -- but rather, a cumulative level of disturbance that has to be reached, and the closer you are, the more you disturb them. I think it's a pretty good model for a simple dungeon-crawl game. It doesn't model human sleep behavior very well at all, of course... but we don't expect that in a hack-and-slash game.
ToME Wiki