.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   Does My Site Search Mage Know Something I Don't? (http://forum.shrapnelgames.com/showthread.php?t=38449)

PyroStock April 18th, 2008 07:42 PM

Does My Site Search Mage Know Something I Don\'t?
 
I conquer province#90 and province#10 (furthest south & lowest # province I own). #10 has 2 magic sites found by the previous owner (an AI). When I attempt to site search with any mage they don't automatically target #10 and will either target another or ignore it as if it's already been searched.
Is this a bug or ?

Endoperez April 18th, 2008 07:52 PM

Re: Does My Site Search Mage Know Something I Don\'t?
 
There was athread about this recently. The mages don't want to search provinces with two or more sites.

VedalkenBear April 18th, 2008 08:34 PM

Re: Does My Site Search Mage Know Something I Don\'t?
 
And, well, they sort of _do_ know something you don't. The distribution of sites in a province can be adequately modeled with the binomial distribution, with the following numbers for probabilities in the case of Middle Era default:

0 - 0.1296
1 - 0.3456
2 - 0.3456
3 - 0.1536
4 - 0.0256

The chances that a province will have greater than 2 sites is only 0.1792, and so the computer is programmed to avoid those sites in favor of those provinces that have fewer sites.

It would be nice to see this implementation enhanced to work for specific terrain types, or to simply give the player the choice of threshold.

Loren April 19th, 2008 02:53 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Quote:

VedalkenBear said:
And, well, they sort of _do_ know something you don't. The distribution of sites in a province can be adequately modeled with the binomial distribution, with the following numbers for probabilities in the case of Middle Era default:

0 - 0.1296
1 - 0.3456
2 - 0.3456
3 - 0.1536
4 - 0.0256

The chances that a province will have greater than 2 sites is only 0.1792, and so the computer is programmed to avoid those sites in favor of those provinces that have fewer sites.

It would be nice to see this implementation enhanced to work for specific terrain types, or to simply give the player the choice of threshold.

What I would like to see is that all site-searching spells auto-target the province with the highest odds of finding a site, but that they target all provinces where a site could be found even if they have already been searched by a low-level mage. The info on the mage should say what the odds are for the current cast.

VedalkenBear April 19th, 2008 04:08 PM

Re: Does My Site Search Mage Know Something I Don\'
 
I can see if I can come up with an algorithm. Don't ask me to code it, though.

Edi April 19th, 2008 04:17 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Pyrostock, this is the thread you are looking for. It has links to an earlier thread where some more mechanics are discussed too.

Loren April 20th, 2008 02:38 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Quote:

VedalkenBear said:
I can see if I can come up with an algorithm. Don't ask me to code it, though.

Who needs an algorithm for this?? I wouldn't bother to write one! Making it fast is asking for bugs and one shouldn't calculate what one can look up anyway.

Search level 4 or sites found 4 = skip.

We have 0-3 sites found, a few terrain types, the previous search level (0-3) and the path. Simply store all the precalculated values. I don't think it's more than 10k of data.

The only troublesome cases are the multiple-search spells. My impression is that simply summing the probabilities for all paths they cover would produce an appropriate ranking even though the probability number itself is obviously way wrong.

VedalkenBear April 20th, 2008 04:34 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Loren: Finding which province is the current best site to search with a given search spell is _not_ that simple, given all the criteria involved.

More linear programming, whee! http://forum.shrapnelgames.com/images/smilies/wink.gif

vfb April 20th, 2008 08:00 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Well, here's a really simple algorithm that would be better than the current one IMO.

Maintain a CurrentSearch list of sites being searched in current month.

<font class="small">Code:</font><hr /><pre>
* Loop through owned sites to find next province to search:
- Capitol? Discard.
- 4 sites known? Discard.
- In CurrentSearch? Discard.
- Rank =
100 * (4 - (current search path level searched in province)
+ 10 * (4 - (# of known sites))
+ (total of other paths already searched in province)
- Rank &lt; CurrentRank? Discard.
- CurrentRank = Rank, add to CurrentSearch list
</pre><hr />

Needs some modification to handle Tiamat, but so does the current search.

Loren April 20th, 2008 10:16 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Quote:

VedalkenBear said:
Loren: Finding which province is the current best site to search with a given search spell is _not_ that simple, given all the criteria involved.

More linear programming, whee! http://forum.shrapnelgames.com/images/smilies/wink.gif

I don't understand why it can't be precalculated for the single-path spells. If the programming gets too hairy don't bother, just monte-carlo it. Make a billion provinces and search them (standalone code, not in the game), see what happens. With modern CPU's that wouldn't take that long.

Loren April 20th, 2008 10:23 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Quote:

vfb said:
Well, here's a really simple algorithm that would be better than the current one IMO.

Maintain a CurrentSearch list of sites being searched in current month.

<font class="small">Code:</font><hr /><pre>
* Loop through owned sites to find next province to search:
- Capitol? Discard.
- 4 sites known? Discard.
- In CurrentSearch? Discard.
- Rank =
100 * (4 - (current search path level searched in province)
+ 10 * (4 - (# of known sites))
+ (total of other paths already searched in province)
- Rank &lt; CurrentRank? Discard.
- CurrentRank = Rank, add to CurrentSearch list
</pre><hr />

Needs some modification to handle Tiamat, but so does the current search.

I don't see the reason for the number of other paths searched term. I think the number of sites found is the important term.

I do agree that your algorithm is considerably superior to the current one and it's certainly easy to do.

As for the multi-site spells I think they can be reasonably approximated by treating it as the sum of the ratings of casting all the components. Since the ranking is a unitless value it doesn't matter that Tiamat scores 4x as high as the single-path spells.

VedalkenBear April 20th, 2008 11:09 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Certainly you can simulate it. I prefer a more theoretical approach.

If all of your provinces are unsearched, and you can cast Haruspex, where do you cast it? Probably on a Forest province, since it has a higher (I believe 0.25 higher) probability of containing a nature site. Which one doesn't matter.

This also ignores the different utility of different sites. E.g., searching underwater provinces with Haruspex, while not as guaranteed to find a site, has a not insignificant chance of discovering a fortress (Kelp Fortress). As such, would you preferentially search underwater sites with Haruspex, or not?

There are many variables, but since this is an allocation problem, it should be susceptible to LP in some form.

vfb April 21st, 2008 03:28 AM

Re: Does My Site Search Mage Know Something I Don\'
 
Quote:

Loren said:
Quote:

vfb said:
Well, here's a really simple algorithm that would be better than the current one IMO.

Maintain a CurrentSearch list of sites being searched in current month.

<font class="small">Code:</font><hr /><pre>
* Loop through owned sites to find next province to search:
- Capitol? Discard.
- 4 sites known? Discard.
- In CurrentSearch? Discard.
- Rank =
100 * (4 - (current search path level searched in province)
+ 10 * (4 - (# of known sites))
+ (total of other paths already searched in province)
- Rank &lt; CurrentRank? Discard.
- CurrentRank = Rank, add to CurrentSearch list
</pre><hr />

Needs some modification to handle Tiamat, but so does the current search.

I don't see the reason for the number of other paths searched term. I think the number of sites found is the important term.

...

When all provinces to be searched have the same number of found sites, and have been searched at the same level in the path being searched, then you want to search the provinces that have been 'cleared' of other paths first. The provinces that have not been 'cleared' are more likely to contain sites of those other paths.

The algorithm sorts first by unsearched provinces by the path being searched. Only if two or more provinces are equal in that respect does it consider the number of known sites. And only if that count is equal does it consider the searched paths total.

It's possible it should weight (a province with zero found sites that has been searched at W1) higher than (a province with three found sites that has not been W searched.)

It doesn't do that, but I wanted to come up with something quick and practical to implement. I'm not interested in theory so much.

Loren April 21st, 2008 02:09 PM

Re: Does My Site Search Mage Know Something I Don\'
 
Quote:

vfb said:
Quote:

Loren said:
Quote:

vfb said:
Well, here's a really simple algorithm that would be better than the current one IMO.

Maintain a CurrentSearch list of sites being searched in current month.

<font class="small">Code:</font><hr /><pre>
* Loop through owned sites to find next province to search:
- Capitol? Discard.
- 4 sites known? Discard.
- In CurrentSearch? Discard.
- Rank =
100 * (4 - (current search path level searched in province)
+ 10 * (4 - (# of known sites))
+ (total of other paths already searched in province)
- Rank &lt; CurrentRank? Discard.
- CurrentRank = Rank, add to CurrentSearch list
</pre><hr />

Needs some modification to handle Tiamat, but so does the current search.

I don't see the reason for the number of other paths searched term. I think the number of sites found is the important term.

...

When all provinces to be searched have the same number of found sites, and have been searched at the same level in the path being searched, then you want to search the provinces that have been 'cleared' of other paths first. The provinces that have not been 'cleared' are more likely to contain sites of those other paths.

The algorithm sorts first by unsearched provinces by the path being searched. Only if two or more provinces are equal in that respect does it consider the number of known sites. And only if that count is equal does it consider the searched paths total.

It's possible it should weight (a province with zero found sites that has been searched at W1) higher than (a province with three found sites that has not been W searched.)

It doesn't do that, but I wanted to come up with something quick and practical to implement. I'm not interested in theory so much.

Oh, I see what you're up to. Agreed.


All times are GMT -4. The time now is 03:15 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.