Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Obsolete > v4

 
 
Thread Tools Display Modes
Old September 14, 2012, 15:19   #1
kaypy
Swordsman
 
Join Date: May 2009
Posts: 294
kaypy is on a distinguished road
Bug in item probabilities [angband-v4-v4-1107-g15f2bcb]

In object.h/line~379, the artifact allocation probability is a byte.

A large number of artifacts have probabilities over 255, which are then stuffed into that byte in parse_a_a @ init2.c/779

This is going to be causing wackiness with the allocations.

Quote:
Originally Posted by object.h
byte level; /** Difficulty level for activation */
byte rarity; /** Unused */
byte alloc_prob[ART_ALLOC_MAX]; /** Chance of being generated */
byte alloc_min[ART_ALLOC_MAX]; /** Minimum depth (can appear earlier) */
byte alloc_max[ART_ALLOC_MAX]; /** Maximum depth (will NEVER appear deeper) */

Quote:
Originally Posted by init2.c
if (!a->alloc_prob[i]) {
a->alloc_prob[i] = parser_getint(p, "common");
a->alloc_min[i] = amin;
a->alloc_max[i] = amax;
break;


If the artifact.alloc_prob got tweaked, we would then still have issues with alloc_entry.prob3 @ types.h/l156

Quote:
Originally Posted by types.h
byte level; /* Base dungeon level */
byte prob1; /* Probability, pass 1 */
byte prob2; /* Probability, pass 2 */
byte prob3; /* Probability, pass 3 */

Quote:
Originally Posted by obj-make.c
/* Looks good - add this artifact to the table */
table[entry].index = a_ptr->aidx;
table[entry++].prob3 = a_ptr->alloc_prob[j];
total += a_ptr->alloc_prob[j];
kaypy is offline  
Old September 14, 2012, 16:48   #2
kaypy
Swordsman
 
Join Date: May 2009
Posts: 294
kaypy is on a distinguished road
OK, bad form replying to myself, but I've been doing some digging and want to keep it separate from the bug report itself.

It looks like there is nothing in the allocation tables that forces you to have the the allocations non-overlapping.

So you could represent an allocation of say

A:1000:40 to 100

as

A:250:40 to 100
A:250:40 to 100
A:250:40 to 100
A:250:40 to 100

or maybe make things a bit more interesting 8-)

A:250:35 to 100
A:250:40 to 100
A:250:45 to 100
A:250:50 to 100

It would also be possible to tweak parse_a_a to automatically break the input into as many byte size chunks as needed.

edit: whoops, limited to 3 entries at the moment

Last edited by kaypy; September 14, 2012 at 17:10.
kaypy is offline  
Old September 14, 2012, 17:25   #3
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,503
Derakon is on a distinguished road
It sounds like the effects of stuffing things into bytes is that items that we tried to make very common (allocation probability well over 255) would have effectively random (prob % 255) probabilities instead. Is that accurate? Though the books' current allocations of 1000 give them an effective allocation probability of 235, which isn't much less than the actual maximum.

Still, we really ought to stop using bytes everywhere.
Derakon is offline  
Old September 14, 2012, 17:53   #4
debo
Veteran
 
debo's Avatar
 
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,344
debo is on a distinguished road
Quote:
Originally Posted by Derakon View Post
It sounds like the effects of stuffing things into bytes is that items that we tried to make very common (allocation probability well over 255) would have effectively random (prob % 255) probabilities instead. Is that accurate? Though the books' current allocations of 1000 give them an effective allocation probability of 235, which isn't much less than the actual maximum.

Still, we really ought to stop using bytes everywhere.
Byte your tongue
debo is offline  
Old September 14, 2012, 18:37   #5
kaypy
Swordsman
 
Join Date: May 2009
Posts: 294
kaypy is on a distinguished road
Quote:
Originally Posted by Derakon View Post
It sounds like the effects of stuffing things into bytes is that items that we tried to make very common (allocation probability well over 255) would have effectively random (prob % 255) probabilities instead. Is that accurate?
Pretty much. And I don't even want to think about what is happening in randarts...

Quote:
Though the books' current allocations of 1000 give them an effective allocation probability of 235, which isn't much less than the actual maximum.
But still makes them 4 times as hard to find as expected- about the same as a commonish artifact, rather than an expected find.
kaypy is offline  
Old September 14, 2012, 19:34   #6
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by kaypy View Post
Pretty much. And I don't even want to think about what is happening in randarts...


But still makes them 4 times as hard to find as expected- about the same as a commonish artifact, rather than an expected find.
Ouch. Ouch. This has been hidden for nearly a year, ever since v4 was released. Hard to believe I missed it - except that its effects are quite subtle and it doesn't trigger any obvious errors (compiler warnings, tests etc.). Interesting.

Thanks very much for the report.
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline  
Old September 14, 2012, 20:03   #7
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,001
fizzix is on a distinguished road
Quote:
Originally Posted by Magnate View Post
Ouch. Ouch. This has been hidden for nearly a year, ever since v4 was released. Hard to believe I missed it - except that its effects are quite subtle and it doesn't trigger any obvious errors (compiler warnings, tests etc.). Interesting.

Thanks very much for the report.
Honestly, I should have spotted it when I was playing around with the allocation frequencies and running stats on the spellbooks!

I just thought we were hitting a hard limiting factor.
fizzix is offline  
Old September 15, 2012, 05:35   #8
kaypy
Swordsman
 
Join Date: May 2009
Posts: 294
kaypy is on a distinguished road
Heres a quick-fix artifact.txt

I've refrained from doing anything too wacky- just split the A lines into bytes, trying for numbers that retain some semblance of readability.
The spellbooks are at the 3x255 limit.

artifact.zip
kaypy is offline  
 


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
BUG: Using non-existent item by number causes crash Max Stats Vanilla 10 February 28, 2011 01:37
Scroll of restore item - possible ID by use bug Taha Development 3 February 16, 2011 22:26
r1612 bug : auto ID average weapons on pickup with same item in inventory bebo Vanilla 4 August 5, 2009 18:09
r1415 bug - Item generation Sirridan Vanilla 3 June 1, 2009 09:23
unique exceptional drops + possible item bug 3.1.1 bebo Vanilla 6 February 10, 2009 20:11


All times are GMT +1. The time now is 12:18.


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