By Kevsoft on Jun 12, 2021 at 5:09 PM
  1. Kevsoft

    Kevsoft XLiveless Dev
    Staff Member Administrator

    Joined:
    Oct 24, 2017
    Messages:
    301
    Likes Received:
    304
    Trophy Points:
    63
    pic1.png

    "Behind the BANG!" is a new irregular blog series that looks behind the scenes of the mechanics of the game engine. I don't know yet how often I will write such blogs, but I'll see how it goes down.

    Caravans are a great way to get gold quickly, especially when playing in co-op. However, many wonder how the yield is calculated. There have been many speculations, but today I want to reveal the secret.

    Caravan Gold Yield Formula
    =========================
    For those who do not know: AOEO is based on the same engine as AOE3 and AOM. Therefore it is also "purely coincidental" that the following calculations also apply to AOM. In other words, the logic in AOEO is nearly identical to that in AOM. Therefore, we can see what the AOM-wiki has to say about it:

    The Town Center 'gives' gold to the Caravan, which is added to the player's stockpile when the Caravan returns to the Market. The amount of gold generated by a single run of a Caravan is (approximately) directly proportional to the square of euclidean distance between the Market and the Town Center. Therefore, the total gold production of a straight line trade route is directly proportional to its length.

    Although it is possible for players to trade with their own Town Centers, trading with that of an ally will provide 50% more gold.

    In principle, the information is correct, but there are some factors that were not mentioned. The full formula is:

    pic2.png

    I was surprised that there are more factors at play than I thought. Therefore, let's go through all the variables.

    The most important variable here is "dist", which is the euclidean distance from the caravan unit to the marketplace. Heard correctly: from the caravan unit and not from the town center. This means that if the caravan unit theoretically hits the town center from another side, the yield can be higher. But of course this will not happen in practice. This distance value is multiplied by itself so that we have the square of this value. This means that the yield difference is much higher for long distances, or the possible yield increases quadratically with distance.

    The second most important factor here is the so-called "work rate". Basically just a number that is used as a factor for different units. Wherever there is "work", so to speak, be it converting/healing units, mining resources or trading with the town center. So also the caravan unit has a work rate, which can be changed by gear and advisors. By default, caravans in AOEO have a work rate of 0.8 (for Egypt it is 0.72). In AOM, the value is much lower.

    The town center factor is an unusual value, since it corresponds to the carry capacity of the town center. In my opinion, this value was misused to serve as a variable factor for trade, since it does not make sense that a building has a carry capacity. The town center has a factor (carry capacity) of 1.0 for gold and therefore this value can be ignored, but theoretically you could design a new building that has a higher carry capacity, which would lead to a higher income from the caravans.

    The last value is the bonus factor. When trading with an ally, this factor is x1.5. It makes no difference if this is a real player in co-op or an ally AI. At the same distance, a caravan would yield 100 gold at its own TC, while an ally would yield 150 gold. The bonus factor for trading with an enemy town center would even be x2, although this is a relic from back in AOM. I guess that it was planned to be able to trade with enemy town centers, but then it was not really implemented.

    Now the multiplied values are divided by the size of the map. This size corresponds to either the length or the width of the map, whichever is greater. For a size of 400x300, the value would be 400. This means for the full yield that caravans must travel for a longer distance if the map size is larger.

    Gold/Distance Chart
    ==================
    Let's consider an example: I want to get the maximum profit on a 400x400 map with the smallest possible distance (without gear and techs):

    Own TC: (dist2 * 0.8 * 1.0 * 1.0) / 400 = 150 gold → dist = 273.86 tiles (68% of the map size)
    Ally TC: (dist2 * 0.8 * 1.0 * 1.5) / 400 = 150 gold → dist = 223.60 tiles (56% of the map size)​

    If we plot a graph on this:
    pic3.png

    Of course, these are pessimistic values, since they do not include gears/techs/advisors. Roughly speaking, if you cover half the map length and have some techs and gears, that should get you to the full amount of 150 gold. The same formula can be applied to Docks, of course. The only difference is that the Merchant Transports can carry up to 300 gold (while taking 2 population slots, of course).

    Display Trade Preview
    ====================

    Market_Hotkey.png

    Finally, I would like to provide an update on the marketplace preview feature. More than two years ago I implemented a feature that displays the expected yield of caravans via the "Display Trade Preview" hotkey (default: Shift+Z). Unfortunately, the values were not always correct, because it didn't include the effects of gears/techs/advisors. This will change with the next patch.

    Here you can see how the values of the preview now correspond to those of the caravan:

    Preview_Correspondence_V2.png

    There are certainly still cases where there will be deviations of +/-2g, especially at longer distances, but I believe it is negligible.

    What do you think about the blog? Let us know in the comments below!

    All current and future content will stay 100% free and accessible to everyone.

    ========
    Thank you so much for reading, and we will see you all next time!

    Project Celeste Development Team

    ========
    The Romans are here! Watch the Overview Trailer.

    Project Celeste is completely free and always will be. However, we gladly accept donations for our overhead costs, which are larger than we have budgeted. If you want to support us, you can do so HERE.

    Read every Romans related blog HERE.

    Tell your friends! Join our Discord HERE.
    ========
     
    BOSAIF, Servimomia, Bon900 and 18 others like this.
  2. Loading...

    Similar Threads - Behind BANG Caravans
    1. Kevsoft
      Replies:
      8
      Views:
      1,037
    2. Kevsoft
      Replies:
      16
      Views:
      1,857
    3. PF2K
      Replies:
      3
      Views:
      928

Comments

Discussion in 'News' started by Kevsoft, Jun 12, 2021.

    1. frogs.poison

      frogs.poison Berserker

      Joined:
      May 19, 2020
      Messages:
      149
      Likes Received:
      95
      Trophy Points:
      28
      It's good to see the exact formula for caravan trading. I hadn't known about the map size itself affecting trade value.

      With a unit's speed, that's the number of tiles traveled per second, yes?

      And is +trade bonus from gear/tech/advisors treated as a seperate multiplier to the end result? It doesn't seem to be covered in the formula.
       
    2. Kevsoft

      Kevsoft XLiveless Dev
      Staff Member Administrator

      Joined:
      Oct 24, 2017
      Messages:
      301
      Likes Received:
      304
      Trophy Points:
      63
      Not quite sure, but I would expect so.

      Gear/tech/advisor will affect the work rate. So +10% would be 0.88 for the work rate.
       
      martinmine and Andy P XIII like this.
    3. purpleganja

      purpleganja Champion

      Joined:
      Jul 29, 2019
      Messages:
      55
      Likes Received:
      34
      Trophy Points:
      18
      I had noticed that there was variation in gold per seconds in different maps. That MAX_MAP_LEN explains it! I was very close to the formula otherwise.

      It's mentioned in work rate. I guess it just multiplies it.
       
    4. Unknown Maniac

      Unknown Maniac Champion

      Joined:
      Nov 9, 2019
      Messages:
      84
      Likes Received:
      57
      Trophy Points:
      18
      finally some nice formula clearly showing how the trade is calculated, I love to see it.
      Distance was obviously the most important factor, I think it was obvious that it could not be linear
      work rate is pretty much trade stat, it is interesting to see its actual value
      map size was quite noticable especially if you compare maps like Fright Club (small map) vs Mad Medians (big map)
      bonus is a known thing
      TC factor is something new and it seems something interesting could be done with it. Just a thought but could it be that this value was supposed to get affected by the priestess of ra blessing so their caravans get compensated for having 10% weaker work rate?

      Anyway, great blog, I think it is now clear how the calculation works.
       
    5. Taffetatree01

      Taffetatree01 Villager

      Joined:
      May 31, 2021
      Messages:
      2
      Likes Received:
      3
      Trophy Points:
      3
      Nice post.. interesting read...learnt a few things along the way!
       
      Andy P XIII likes this.
    6. RASPUTINPRIME

      RASPUTINPRIME Champion

      Joined:
      May 27, 2019
      Messages:
      45
      Likes Received:
      70
      Trophy Points:
      18
      Very cool and appreciate the explanation. All under the hood.
       
    7. frogs.poison

      frogs.poison Berserker

      Joined:
      May 19, 2020
      Messages:
      149
      Likes Received:
      95
      Trophy Points:
      28
      Allright people, I have done MATHS, and bring to you my findings!

      First finding - The absolute BEST Merchant Gear for trading, for both Caravans and Merchant Transport, is the Merchant Log of the Nile! A very, VERY close second is the craftable Titan-Bound Gaff Stick!
      The previous favorite, the Light Camel Barding, is significantly weaker in terms of overall gold/second provided - At max favorable distance, the difference between Light Camel Barding and Merchant Log of the Nile is greater then 10% in terms of gold output, and that difference only increases as the distance becomes shorter (because of having to make safer caravan routes, because the area doesn't allow for longer caravan routes, ect). On the other hand, the difference between Titan-Bound Gaff Stick and Merchant Log of the Nile is roughly 1%

      Second Finding - Except for Egypt, in terms of using Merchant Transports vs Caravans when you can have both (Think Kourion, in which you have a small body of water the exact distance as a safe caravan route), it's better to use a Caravan line in terms of gold per second per population cost, unless, of course, the merchant transport ships can carry more gold then the Caravan (In which case it's normally a sea map).

      For Egypt, if you can use a merchant transport line, do it - It'll give better gold per pop then caravans due to Egypt caravans being naturally nerfed.

      Third finding, more of a confirmation - Gold Generation via Caravans is, indeed, much higher then Villagers, outside of extremely short trips. In general, if you can get more then 56 gold on a trip, the caravan will produce more gold/second then villager. In co-op, this difference is even more noticable.

      Caravans are also especially powerful in PvP even without gear and with nerfed upgrades, due to the much smaller size of the PvP maps compared to most PvE maps.
       
      Andy P XIII, MsMuffins and ByFstugan like this.
    8. frogs.poison

      frogs.poison Berserker

      Joined:
      May 19, 2020
      Messages:
      149
      Likes Received:
      95
      Trophy Points:
      28
      Kevsoft, making sure - Docks also have a town center factor of 1, yes? It seems that Merchant Transports have a naturally higher work rate, being at 1.5
       
    9. ByFstugan

      ByFstugan Hippikon

      Joined:
      Nov 17, 2017
      Messages:
      164
      Likes Received:
      80
      Trophy Points:
      28
      I've noticed many (even really good players otherwise) use caravans in a far from optimal way, and few ever use the "Display Trade Preview" which I think is unwise. Many just put the markets up at furthest possible distance in safe area, and then get 150g far from the end of the route - hence they walk ALOT where it's just waste of time with no gain.

      This is how I do it. First off I've set my "build market" to "J" as well as my "Display Trade Preview" is set to "J", so if I spam it when building the first push "J" is "build market", and the next "J" automatically is the preview (as well as each "J" after that). So it's here I move the mouse to see where the numbers is right for my civ. With my gears I've noticed that a number of 116g ends up with me getting about 130g (due to gear) for the early rounds, which will be 149-150g with the Age 4 upgrade.

      I think that's the most optimal way to do it, otherwise one could always argue to skip the Age 4 upgrade and find the number for insta 149-150g. I'd say to get 149g when you're done is "best" in a way since then you know you're as close to perfect as can be. Even if 150 is optimal it's very much worse with alot of useless travel-distance/time (and you cannot see if or how much that is when you see 150g).
       
    10. frogs.poison

      frogs.poison Berserker

      Joined:
      May 19, 2020
      Messages:
      149
      Likes Received:
      95
      Trophy Points:
      28
      Yea, fortunately we will be able to see the "exact" number once the new preview changes is up, which I like.

      Now for Dock preview numbers next :D
       
    11. Kevsoft

      Kevsoft XLiveless Dev
      Staff Member Administrator

      Joined:
      Oct 24, 2017
      Messages:
      301
      Likes Received:
      304
      Trophy Points:
      63
      Yes, you're correct. I've missed that.

      I can look into that later, but first I want to see how the new preview plays out.
       
    12. MsMuffins

      MsMuffins Champion

      Joined:
      May 3, 2019
      Messages:
      57
      Likes Received:
      85
      Trophy Points:
      18
      Abit late, but very interesting blog, makes more sense now to see everything on deeper mechanical level, I personally would love to see more as I'm not too good withe pure deep mechanical stuff, leave that to froggy XD, But yes really interesting to see! Thanks Kevsoft!^^



      I actually use merchant log of nile on all civs, just seems to be best option, glad i was right :D

      Merchant ship trading on egypt is very interesting, perhaps poor perikles will be used more.

      Keep it up frog! :)
       
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice