Bug - Fixed appearance_rates(loc, true) gets confused

heeheehee

Developer
Staff member
Given that we know that Nosy Nose is probably +1 copy, I think it's safe to say that bonus copies are additive.
~360 visits to 8-bit realm, with bloopers sniffed:
Code:
71.058% +4 copies, ignore the queue
22.785% +5 copies, ignore the queue
5.257% +3 copies, ignore the queue
0.889% +6 copies, ignore the queue

edit: with 550 visits,
Code:
75.476% +4 copies, ignore the queue
23.582% +5 copies, ignore the queue
0.677% +3 copies, ignore the queue
0.265% +6 copies, ignore the queue

Okay, I'm done beating this dead horse.
 
Last edited:

Darzil

Developer
Great!

In fact, that will change my ascensions marginally, sometimes. You don't always need a fairy when olfacting.
 

Darzil

Developer
r14695 supports rejection conditions. In combats.txt Astronomer is now 2r25 (2 in encounter pool with 25% rejection chance), rather than 3 and the rest of the monsters 2. Wild seahorse is now 1r75 (1 in encounter pool with 75% rejection chance).

Do we have any other rejection conditions to worry about? Looks like maybe The Bugbear Pen has a 33% rejection on Annoying Spooky Gravy Fairy. Couldn't find anything on the wiki about it, though.

The main reason I implemented this, as it's currently numerically the same as other approaches, and more complex, is that an area can have tumbleweeds if a total weighting is less than 1. At some point I might add tumbleweeds with weighting zero to zones they can appear in, and dynamically change their weighting based on total weighting.

It also has some experimental code to change a certain type of conditional weighting. This can handle adding or subtracting things from the encounter pool. Currently as a test case this is only Screambats, which have 100% chance to appear (other monsters having 0%) or 0% (other monsters treated normally), in the appropriate zones, and Boss Bat / Bodyguard Bats, who have chances based on number of turns in the area and quest status. I am not certain that Boss Bat actually plays this way with the queue though, so the handling will have to be changed if there is spading of how it works.

Thoughts, is this a good thing to slowly plod on with?
 

xKiv

Active member
I wonder if there are maths wizzes out there who could calculate the equations taking into account rejection chance (maybe that just alters base probability?) and olfaction (I guess that'll have different equations for olfaction of monster you want, in and out of queue, and olfaction of another monster in zone, in and out of queue) ?

Assuming that all rejection does is chance of completely removing the monster from all consideration (on that turn) ...
(1-p) ... monster is considered, probabilities as calculated as normal
p ... probability of this monster is 0, probability of all other monsters is adjusted so that sum is 1, by a factor of f
-----
combined:
1) calculate as if without rejection
2) for each monster M with rejection rate R (where R=0.5 is 50%) and current probability P_M:
2a) f := 1/(1-P_M)
2b) P_m' := P_m * ((1-R) + R*f) for all monsters m except M
2c) P_M := P_M * (1-R)

let's at least verify that sum(P_m) will stay 1 if it was 1 after step 1:

sum(P_m') = sum(P_m)*(1-R) + R*f*(sum(P_m)-P_M)
=1*(1-R)+R*(1/(1-P_M))*(1-P_M)
=1-R+R
=1


====

ETA: or if you meant queue rejection ... that would just put a "75% of P_m"-sized hole for each non-olfacted in-queue monster into the weights, and those holes fractally recurse, so ...

1) R := sum(P_m*0.75 for each non-olfacted in-queue m)
2) P_m' := P_m*0.25 for each non-olfacted in-queue m
3) P_m := P_m*1/(1-R) for all m

Or you could restate 2+3 as:
2) P_m' := P_m*0.25/(1-R) for each non-olfacted in-queue m
P_m' := P_m/(1-R) for all other m
 
Last edited:

Darzil

Developer
Just trying to make sure I understand.

Currently we calculate the weight of the queue, and end up when no olfaction, based on the wiki equations, with :
P_m' := weight of monster * 1 / (4 * Total weight in zone - 3 * Total weight of each monster in queue) for a monster in the queue
and
P_m' := weight of monster * 4 / (4 * Total weight in zone - 3 * Total weight of each monster in queue) for a monster not in the queue

I think with a relevant olfaction in the zone we need to consider 4 cases:
P_m' when monster in queue and olfacted (queue rejection 0 for this monster, 0.75 for all others in queue, 0 for monsters not in queue)
P_m' when monster in queue and another monster in queue is olfacted (0 for olfacted one in queue, 0.75 for others in queue, 0 for monsters not in queue)
P_m' when monster in queue and a monster not in queue is olfacted (queue rejection 0.75 for all in queue, 0 for monsters not in queue, looks like this would just be weight of monster * 1 / (4 * Total weight in zone - 3 * Total weight of each monster in queue) as it is equivalent to the above)
P_m' when monster not in queue and olfacted (queue rejection 0 for this monster, 0.75 for those in queue, 0 for monsters not in queue) (this looks like it'd be weight of monster * 4 / (4 * Total weight in zone - 3 * Total weight of each monster in queue)

I am unfortunately not sure how to turn your equations into this.

For general rejection I just wanted reassurance that I could do what I wanted to, which was to just multiply weight by (1-rejection chance) which I think I can, and which gives the same results as our old equations.

Edit - Ah, I think maybe I see. We can just consider olfacted monsters in queue as not in queue, as they'll never be rejected?

So actually we can just change our equations to only add up weight of non-olfacted monsters in queue ?
 
Last edited:

Darzil

Developer
Hmm, curious thought. If the way the adventure queue works is as the wiki page states (and as I've implemented the estimates in mafia), why doesn't KoL just use the estimated percentages instead of a 75% rejection rate sim, in order to save processor cycles, as it's a solvable equation ?
 

Darzil

Developer
Ok, I'm well down the rabbit hole now!

It strikes me that my Boss Bat code is wrong. I think there are areas where monsters are determined by algorithm and not by queue, and where queue manipulation doesn't work.
So we have various types of area :

1. Standard areas, queue has effect. Some of these (Oil Peak, Dis zones, Coral Corral etc) have monsters that are only available conditionally).

2. Areas where monsters are determined by algorithm (probably Tavern Cellar, probably Boss Bat Lair, not sure about Volcano Island) and do not have queue effects.

3. Some areas have superlikely combats (eg Modern Zombies, Ninja Assassins, Screambat) or non-combats (eg Top Floor of castle, Spooky Forest) which appear according to algorithm (eg init level, turns since last non-combat).

Then we have certain adventure zones (non adventure.php) where wandering monsters can never appear. I'd like to include knowing about these, and avoid ending a wandering monster window when adventuring at one, or when encountering a different wandering monster, even if I never take into account chance of a wanderer (which is number of previous turns spent in non-adventure.php areas + 1 / number of turns left in window).

The basic code I've written will handle type 1 easily, though of course the individual cases will need adding.
Types 2 and 3 will need new code.

Are there any other types of areas to handle ?
 

Darzil

Developer
Added support for superlikely combats, and added Modern Zombie, Ninja Snowman Assassins and make it handle Screambat.
 

xKiv

Active member
Just trying to make sure I understand.

Currently we calculate the weight of the queue, and end up when no olfaction, based on the wiki equations, with :
P_m' := weight of monster * 1 / (4 * Total weight in zone - 3 * Total weight of each monster in queue) for a monster in the queue
and
P_m' := weight of monster * 4 / (4 * Total weight in zone - 3 * Total weight of each monster in queue) for a monster not in the queue

I think that's correct.

For general rejection I just wanted reassurance that I could do what I wanted to, which was to just multiply weight by (1-rejection chance) which I think I can, and which gives the same results as our old equations.

This too (IMAO).

Edit - Ah, I think maybe I see. We can just consider olfacted monsters in queue as not in queue, as they'll never be rejected?

So actually we can just change our equations to only add up weight of non-olfacted monsters in queue ?

That's what it looks like to me, yes.

Hmm, curious thought. If the way the adventure queue works is as the wiki page states (and as I've implemented the estimates in mafia), why doesn't KoL just use the estimated percentages instead of a 75% rejection rate sim, in order to save processor cycles, as it's a solvable equation ?

Because Jick is not a mathematician at all. He would rather iterate/loop, and give you a tumbleweed if he gets 1000 rejections in a row, than sit with a paper and solve recursive equations.
 
Top