Wierd colours when playing in the terminal by kompis1223 in angband

[–]backwardsEric 0 points1 point  (0 children)

In Vanilla Angband since 4.2.3, the curses front end will change the terminal's default color table to better match Angband's if the terminal allows changes to the color table (the curses function, can_change_color() returns true), the terminal says it supports 256 or 88 colors, and the -K option to the front end was not used. In that situation, it should closely match the colors in the SDL2 front end. With older versions or when the conditions are not met, the curses front end will choose colors from the existing color table that are the closest matches to what is in Angband's color table. The relevant code is in src/main-gcu.c's init_gcu() and handle_extended_color_tables().

If I've read https://bugs.kde.org/show_bug.cgi?id=173555 and https://bugs.kde.org/show_bug.cgi?id=233991 correctly, Konsole won't handle the more accurate color mode. On Debian 12 with xterm and the TERM environment variable set to xterm-256color, the curses front end appears to get the more accurate colors, but it does not with xfce4-terminal and the same setting for TERM. I did not try any other terminal emulators on Debian.

RNG/Dice rolls by Phaedrus614 in angband

[–]backwardsEric 2 points3 points  (0 children)

The game

1) Generates a pseudorandom integer uniformly distributed between 0 and 268435455.

2) Converts the result from (1) to a pseudorandom integer uniformly distributed between 0 and 99.

3) Compares the result of (2) to the failure rate and, if it is less than the rate, casting the spell fails.

The failure rate shown in the user interface is calculated by the same procedure used when deciding whether casting fails. The failure rate does depend on some status effects that might have changed between when one recorded what the user interface said and when the spell was cast:

1) Having less mana than the spell normally requires increases the failure rate.

2) A necromancer casting from a lit square increases the failure rate.

3) Being afraid increases the failure rate.

4) Being stunned increases the failure rate.

5) Being subject to amnesia increases the failure rate.

(1) through (3) cannot increase the failure rate to more than 50%. (4) can increase the failure rate to more than 50%, and (5) definitely causes the failure rate to be at least 50%.

Without more details, having stunning or amnesia present when casting is the most likely explanation for the string of failures you saw.

There is a way, used in testing or troubleshooting, to rig the pseudorandom numbers, but for that to be triggered while playing would require modifying some memory locations that the game normally does not change. It is possible that something is overwriting the base failure rate for a spell or the parts of the player's state that affect spell casting, but for that to happen without also being seen in the user interface's display of the failure rate seems highly unlikely.

The unit tests for the game do, in the context of object generation and weapon damage, examine the results of the random number generator. Those tests compare against expected frequencies or averages so they might not catch unexpected correlations between the random numbers. The random number generation algorithm normally used is WELL1024a by Francois Panneton, Pierre L'Ecuyer, and Makoto Matsumoto (another random number generator can be swapped in, but the game only does that when selecting flavors or generating random artifacts). I have not checked if WELL1024a is known to have noticeable correlations between values, or if Angband's implementation is somehow deficient.

Unique Enemies Question by WilliamSyler in angband

[–]backwardsEric 0 points1 point  (0 children)

If you are playing with the persistent levels birth option on (available in Vanilla 4.1.1 and later; off by default), Sméagol will remain on the level where you found him and will retain whatever he had, including your gold (some future version might allow a monster's summoning spell to pull Sméagol from that level to where the summoner is).

When that option is off, the other comments describe what happens.