collinstommy / aoe-library

aoe-library.vercel.app
MIT License
6 stars 1 forks source link

Uptime for Malay too optimistic or just right? #16

Open Arkanosis opened 1 year ago

Arkanosis commented 1 year ago

Hi Tom,

I was wondering why your tool and mine were giving different uptimes for the 29 pop no-loom FC with Malay (14:08 vs 14:10) and found out two combined reasons:

With that said, I can't figure out which uptime is right… or if both are correct in a different way. Fandom says it takes 78 seconds to reach feudal, so that could be in between at 14:09.

I'm reading pretty much everywhere that the Malay bonus is 66%. Is the 66.66666667% you use a more accurate value you've found in the game files or something? Also is the choice of floor() based on what the game itself uses in the statistics, or just personal preference?

I know I could try to achieve these uptimes myself to check, but since I'm basically almost always off the perfect uptime by at least 2 or 3 seconds, I wouldn't be able to conclude anything if I managed to get a 14:10+ uptime.

Thanks!

collinstommy commented 1 year ago

Hey Jérémie,

Good catch. Going with the data from Fandom makes sense until we can confirm how the game does calculations. I can post on reddit or maybe some other forum?

I got 1.6666667 from a reddit thread. I don't actually know for sure what the calculation is, or how to get it.

This PR should fix the Malay issue and give us 14:09. It seems logical that the rounding should be done by age rather than by the total calculations. I'm assuming that is how the game would do it.

I don't recall where I got floor() from. It seems like round() would make more sense though.

So I guess there are some open questions:

  1. Does Malay use 1.66 as the divisor
  2. Does the game use round, floor or ceil to resolve to a whole second number

Looking at my calculations and your UI, I also forgot to account for the difference in loom time for Persians across the ages. I need to rework loomTime.

When we figure out how this is all calculated it might be worthwhile to expose the resolved values as an API or a JSON file somewhere. What do you think?

collinstommy commented 1 year ago

Posted this on reddit https://www.reddit.com/r/aoe2/comments/12vafhg/how_to_calculate_uptimes_and_rounding_any_aoe/

Arkanosis commented 1 year ago

Hi Tom,

Thanks for the reply and the post on Reddit. Hopefully someone will have the definitive answer to that :)

I completely agree that a computer-friendly source for such values would be great. Actually I need something like that for a toy project where I'd like to experiment with ML optimization of build orders, but it's just too much work and too error prone to guess and write values by hand. I'm pretty sure extracting the exact values from the game itself has already been implemented several times by Siege Engineers, SFTtech and other genie-us out there (eg. aoe2techtree.net is so accurate it even reflects the mistakes in the game tooltips).

Aaaand… I got the Persian loom wrong too! Thanks for bringing this to my attention :D:

Oh, BTW, that made me look at your code for loomTime and if you've not that in mind already, I believe the Portuguese bonus is 25 %, not 30 %.

Thanks again!