dtdannen / dcss-ai-wrapper

An API for Dungeon Crawl Stone Soup for Artificial Intelligence research.
MIT License
41 stars 13 forks source link

Possibility of using DCSS Score values for Reward System #35

Open beeWAtoN opened 2 years ago

beeWAtoN commented 2 years ago

image

As written in https://github.com/crawl/crawl/blob/master/crawl-ref/source/hiscores.cc

Some common rewards such as gold, exp, runes, and winning cases. In winning case, has extra points awarded for things like inventory value.

Some considerations based on this:

beeWAtoN commented 2 years ago

Regarding how they calculated inventory values in the past, I went back into history log to 2010: https://github.com/crawl/crawl/blob/ca203269a06913c6dd4116cf6f292e2516590171/crawl-ref/source/hiscores.cc Line 1178 has information on how it is calculated.

// inventory value is only calculated for winners const bool calc_item_values = (death_type == KILLED_BY_WINNING); // Calculate value of pack and runes when character leaves dungeon for (int d = 0; d < ENDOFPACK; d++) {

    if (you.inv[d].defined())
   {
        if (calc_item_values)
           points += item_value( you.inv[d], true );
            ...

Basically, it iterates through the inventory finding non-rune items. It runs item_value on each item to get its value. Trying to search for what gives item_value, item-prop.cc gives

// Disregard shop stuff above your reach. if (is_shop_item(item))

    return (int)item_value(item) <= you.gold;

In other words, the value of the item can be seen as part of the price of the item in shops. Looking for it in https://github.com/crawl/crawl/blob/master/crawl-ref/source/shopping.cc gives the function item_value. Starting at line 186: it changes modifiers based on properties, weapon-types, etc etc etc. Feel free to look at this as needed.