• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

unmerged(3931)

General
May 19, 2001
2.032
0
Visit site
There is a typecast error in computing the probability of empty slot merchant placement success. I did extensive testing on the empty slot merchant placement success and this is what I found:

Empty slot merchant placement success% =
(Constant base 50%) +
(5% * stability) +
(3% * ADM) +
(5% if the CoT is owned by merchant sender) +
{50% * truncate (trade efficiency)}

Minimum empty slot merchant placement success = 35%
Maximum empty slot merchant placement success = 95%

If stability is negative, then stability has a negative effect on the chance of empty slot merchant placement success.

The monarch's current effective administrative rating, ADM, is in the range of 0 to 9.

There is a 5% improvement in empty slot merchant placement success if the CoT where the merchant is placed is owned by the country making the placement.

There is an apparent bug where trade efficiency is truncated to an integer within the computation. This type of error is known as a typecast error. The end result is that, in regards to empty slot merchant placement success, there is no difference between 20% and 99% trade efficiencies. Similarly, there is no difference between 100% and 199% trade efficiencies. There are however great differences between 99% and 100% trade efficiencies and between 199% and 200% trade efficiencies. By reaching 200% trade efficiency, empty slot merchant placement success is the maximum of 95% success rate no matter what the other factors.

a) truncate (20%) = truncate (0.20) = 0
truncate (99%) = truncate (0.99) = 0

b) truncate (100%) = truncate (1.00) = 1
truncate (199%) = truncate (1.99) = 1

c) truncate (200%) = truncate (2.00) = 2
truncate (299%) = truncate (2.99) = 2

The truncated numbers are returned before multiplying by 50%, which is why there is such a big difference between 0.99 trade efficiency and 1.00 trade efficiency.


To reproduce the findings:
1) Edit the db\trade.csv file so that trade tech one produces 99% trade efficiency and change dates for each trade tech to be 1600 or so.
2) Remove random events by editing events.txt and removing the lines:
event = "db\events\RandomEvents.txt"
event = "db\events\RandomReligiousEvents.txt"
3) Load up and run EU2.
4) Start a GC game as Oman since they start with two CoTs for more merchants.
5) Type "<F12>Columbus" and "Montezuma" cheats.
6) Turn on logging of failure or success of merchant placement.
7) Turn on auto-sending of merchants for Oman.
8) Place all of Oman's budget money into infrastructure research.
9) Save the game.
10) Edit the save game so that Oman has all neutral DP sliders (sliders = 5).
11) Find and replace every occurrence of:
"trade = { date = { year = 0 month = january day = 0 } level = "
Replace with:
"trade = { date = { year = 0 month = january day = 0 } level = 0 value = 0 } #"
12) Edit Oman's trade level to be trade level 1.
13) Edit Oman's stability to be -3.
14) Edit Oman's inflation to be 10.000 (1000% or so inflation) so that stability does not increase.
15) Edit Oman's current monarch and a few future monarchs to have ADM = 0.
16) Edit all CoTs to have zero merchants placed.
17) Save the edited file.
18) Load the edited saved game into EU2.
19) Allow the game to run for a fixed period of time, perhaps 20 years of game time.
20) Count and note the number of successful merchant placements in the history.
21) Exit the EU2 game.
22) Edit the db\trade.csv file so that trade tech one produces 100% trade efficiency.
23) Load up and run EU2.
24) Repeat steps 18 to 20.
25) Notice the vast difference a 1% difference in trade efficiency makes in empty slot merchant placement success.


When fixing the typecast error also notice that the constant base 50% in the formula needs adjustment. If the typecast error is fixed and the constant is not reduced, merchants would be much more successful in placement than is currently the case. A constant between 30% and 40% may be more appropriate.

Refer to the following current formula, repeated for convenience:

Empty slot merchant placement success% =
(Constant base 50%) +
(5% * stability) +
(3% * ADM) +
(5% if the CoT is owned by merchant sender) +
{50% * truncate (trade efficiency)}

Hopefully change to something like:

Empty slot merchant placement success% =
(Constant base 35%) +
(5% * stability) +
(3% * ADM) +
(5% if the CoT is owned by merchant sender) +
(50% * trade efficiency)
 
Last edited:
Upvote 0
Bug 378 logged, thank you for the extensive documentation and work!