jhaagsma / ee_npc

Earth Empires Non-Player-Country Project!
6 stars 7 forks source link

Bots can fail to report out of food events #18

Closed jobbish-sql closed 3 years ago

jobbish-sql commented 3 years ago

85 looked like it ran out of food near the end of its turns based on snapshot. It lost 2.5% of its troops and didn't produce as many spies as it should have based on IC count:

[2021-03-31 00:03:57] 
----------------------BEGIN for [CASHER] Letor (#85) (R)----------------------
|  Turns:           156(0)   Spies:          52.9k   Destocking:         no  |
|  Turns Played:      1299   Troops:          1.8M   Tax Revenues:  7151970  |
|  Networth:          3.6M   Jets:               0   Expenses:       698824  |
|  Land:             15.3k   Turrets:         1.4M   Net Food:       -13965  |
|  Money:             436M   Tanks:              0   Net Oil:             0  |
|  Food:              1.1M   Readiness:        100   TPT:                 3  |
|  Oil:                  0   PS Brigades:    5 (5)   Indy prod:         151  |
|  Tech Points:       256k                           BPT:                65  |
|                                                                            |
|  Prod Blds:        14724   Mil tech:        100%   OM Value:            0  |
|  Indy Blds:           81   Bus tech:      160.7%   OM Units:            0  |
|  Non-prod Blds:        0   Res tech:      151.7%   OM Bushels:          0  |
|  CS:                 240   Wep tech:        100%   OM Tech:             0  |
|  Unused:             257   Prd tech:          0%                           |
------------------------------------------------------------------------------
[2021-03-31 00:03:58] 
----------------------DELTA for [CASHER] Letor (#85) (R)----------------------
|  Turns:              N/A   Spies:           6307   Destocking:        N/A  |
|  Turns Played:       156   Troops:          -46k   Tax Revenues:  1976922  |
|  Networth:          749k   Jets:               0   Expenses:       103005  |
|  Land:              1201   Turrets:         449k   Net Food:        -2387  |
|  Money:          -408.4M   Tanks:              0   Net Oil:             0  |
|  Food:              386k   Readiness:          0   TPT:                 0  |
|  Oil:                  0   PS Brigades:      N/A   Indy prod:           0  |
|  Tech Points:       200k                           BPT:                 0  |
|                                                                            |
|  Prod Blds:         1407   Mil tech:          0%   OM Value:            0  |
|  Indy Blds:            0   Bus tech:       12.1%   OM Units:            0  |
|  Non-prod Blds:        0   Res tech:       13.2%   OM Bushels:          0  |
|  CS:                   0   Wep tech:          0%   OM Tech:             0  |
|  Unused:            -206   Prd tech:          0%                           |
------------------------------------------------------------------------------
[2021-03-31 00:03:59] 
-----------------------END for [CASHER] Letor (#85) (R)-----------------------
|  Turns:             0(0)   Spies:          59.2k   Destocking:         no  |
|  Turns Played:      1455   Troops:          1.8M   Tax Revenues:  9128892  |
|  Networth:          4.4M   Jets:               0   Expenses:       801829  |
|  Land:             16.5k   Turrets:         1.9M   Net Food:       -16352  |
|  Money:            27.4M   Tanks:              0   Net Oil:             0  |
|  Food:              1.5M   Readiness:        100   TPT:                 3  |
|  Oil:                  0   PS Brigades:    5 (5)   Indy prod:         151  |
|  Tech Points:       457k                           BPT:                65  |
|                                                                            |
|  Prod Blds:        16131   Mil tech:        100%   OM Value:            0  |
|  Indy Blds:           81   Bus tech:      172.8%   OM Units:            0  |
|  Non-prod Blds:        0   Res tech:      164.9%   OM Bushels:          0  |
|  CS:                 240   Wep tech:        100%   OM Tech:             0  |
|  Unused:              51   Prd tech:          0%                           |
------------------------------------------------------------------------------

However, the country log and error log do not have any OOF (out of food) events:

[2021-03-31 00:03:57] 156 turns left [2021-03-31 00:03:57] Explore Rate: 9; Min Rate: 7 [2021-03-31 00:03:57] 155 Turns - Built 35 ent and 30 res (98%) $439M ($+6.5M) 1.1M Bu (-14k) API: 35 [2021-03-31 00:03:57] --- LOW FOOD --- [2021-03-31 00:03:57] --- BUY Public: 1.1M food @ $33 $402M ($-37M) [2021-03-31 00:03:57] DPAT: 205 [2021-03-31 00:03:57] DPAT: 307.5 [2021-03-31 00:03:57] --- BUY Public: 9519 t_res @$4790 (154.1%) $357M ($-45.6M) [2021-03-31 00:03:57] --- BUY Public: 378 t_res @$5426 (154.2%) $354M ($-2.1M) [2021-03-31 00:03:57] --- BUY Public: 32.2k t_res @$5736 (161.1%) $170M ($-185M) [2021-03-31 00:03:57] --- BUY Public: 103 t_res @$5842 (161.1%) $169M ($-602k) [2021-03-31 00:03:57] --- BUY Public: 26.8k t_res @$5968 (165.4%) $9.1M ($-160M) [2021-03-31 00:03:57] 154 Turns - Built 35 ent and 30 res (99%) $12.5M ($+6.5M) 2.2M Bu (-14.2k) API: 15 [2021-03-31 00:03:57] 153 Turns - Built 35 ent and 30 res (99%) $16M ($+6.6M) 2.1M Bu (-14.5k) API: 1 [2021-03-31 00:03:57] Earthquake destroyed 23 Buildings! Update Advisor [2021-03-31 00:03:57] 19 Turns - Explored 1201 Acres (134T)(16503 A) $966M ($+950M) 135k Bu (-2M) +FOOD CM --EQ-- API: 1 [2021-03-31 00:03:57] --- LOW FOOD --- [2021-03-31 00:03:57] --- BUY Public: 1.8M food @ $33 $905M ($-61.4M) [2021-03-31 00:03:57] DPAT: 218 [2021-03-31 00:03:57] DPAT: 327 [2021-03-31 00:03:57] --- BUY Public: 29.2k t_bus @$5814 (163.5%) $735M ($-170M) [2021-03-31 00:03:57] --- BUY Public: 8396 t_bus @$6409 (164.7%) $681M ($-53.8M) [2021-03-31 00:03:57] --- BUY Public: 13k t_bus @$7070 (166.4%) $589M ($-91.6M) [2021-03-31 00:03:58] --- BUY Public: 43.5k t_bus @$7202 (170.8%) $276M ($-313M) [2021-03-31 00:03:58] --- BUY Public: 12.9k t_bus @$7512 (171.8%) $179M ($-97M) [2021-03-31 00:03:58] --- BUY Public: 14.4k t_bus @$7872 (172.8%) $65.6M ($-114M) [2021-03-31 00:03:58] 18 Turns - Built 35 ent and 30 res (92%) $69.1M ($+6.8M) 1.8M Bu (-14.9k) API: 16 [2021-03-31 00:03:58] 17 Turns - Built 35 ent and 30 res (92%) $72.7M ($+7M) 1.8M Bu (-14.9k) API: 1 [2021-03-31 00:03:58] 16 Turns - Built 35 ent and 30 res (93%) $76.5M ($+7.1M) 1.8M Bu (-15k) API: 1 [2021-03-31 00:03:58] 15 Turns - Built 35 ent and 30 res (93%) $80.5M ($+7.3M) 1.7M Bu (-15k) API: 1 [2021-03-31 00:03:58] 14 Turns - Built 35 ent and 30 res (94%) $84.6M ($+7.4M) 1.7M Bu (-15.1k) API: 1 [2021-03-31 00:03:58] 13 Turns - Built 35 ent and 30 res (94%) $88.9M ($+7.6M) 1.7M Bu (-15.1k) API: 1 [2021-03-31 00:03:58] 12 Turns - Built 35 ent and 30 res (94%) $93.3M ($+7.8M) 1.7M Bu (-15.2k) API: 1 [2021-03-31 00:03:58] 11 Turns - Built 35 ent and 30 res (95%) $97.9M ($+7.9M) 1.7M Bu (-15.2k) API: 1 [2021-03-31 00:03:58] DPAT: 219 [2021-03-31 00:03:58] DPAT: 328.5 [2021-03-31 00:03:58] --- BUY Public: 9861 t_res @$5968 (164.9%) $39.1M ($-58.9M) [2021-03-31 00:03:58] 10 Turns - Built 35 ent and 30 res (95%) $43.7M ($+7.9M) 1.7M Bu (-15.3k) API: 3 [2021-03-31 00:03:58] 9 Turns - Built 35 ent and 30 res (96%) $48.4M ($+8M) 1.7M Bu (-15.4k) API: 1 [2021-03-31 00:03:58] 8 Turns - Built 35 ent and 30 res (96%) $53.1M ($+8.1M) 1.6M Bu (-15.4k) API: 1 [2021-03-31 00:03:58] 7 Turns - Built 35 ent and 30 res (96%) $57.9M ($+8.1M) 1.6M Bu (-15.5k) API: 1 [2021-03-31 00:03:58] 6 Turns - Built 35 ent and 30 res (97%) $62.7M ($+8.1M) 1.6M Bu (-15.6k) API: 1 [2021-03-31 00:03:58] 5 Turns - Built 35 ent and 30 res (97%) $67.6M ($+8.2M) 1.6M Bu (-15.6k) API: 1 [2021-03-31 00:03:58] 4 Turns - Built 35 ent and 30 res (98%) $72.5M ($+8.2M) 1.6M Bu (-15.7k) API: 1 [2021-03-31 00:03:58] 3 Turns - Built 35 ent and 30 res (98%) $77.5M ($+8.3M) 1.6M Bu (-15.7k) API: 1 [2021-03-31 00:03:58] DPAT: 220 [2021-03-31 00:03:58] DPAT: 330 [2021-03-31 00:03:58] DPAT: 330 [2021-03-31 00:03:58] --- DPA Target: 330 (Current: 277) [2021-03-31 00:03:58] --- BUY Public: 318k m_tu @ $130 $36M ($-41.5M) [2021-03-31 00:03:58] --- BUY Public: 166k m_tu @ $140 $12.6M ($-23.4M) [2021-03-31 00:03:58] 2 Turns - Built 35 ent and 30 res (98%) $17.4M ($+8.2M) 1.5M Bu (-16.3k) API: 14 [2021-03-31 00:03:58] 1 Turns - Built 35 ent and 30 res (99%) $22.4M ($+8.3M) 1.5M Bu (-16.3k) API: 1 [2021-03-31 00:03:58] 0 Turns - Built 35 ent and 30 res (99%) $27.4M ($+8.3M) 1.5M Bu (-16.4k) API: 1

The most logical place to run out food is at the end of a mass explore. I believe that the country would have tried to explore around 141 turns based on food consumption. It certainly makes sense that food consumption was higher than expected: we just bought a lot of res tech and build some res buildings. The ME itself only went 134 turns, so it may have halted earlier. And if you look at the country's food total after buying 1.8 M bushels, it's still 1.8 M bushels. So I do think that the country ran out of food at the end of the ME, but for some reason it still thought it had 135k bushels. That seems bad.

I believe it is fairly straightforward to check for the OOF and OOM events in the turn object. That would make the reporting work. But why was $c->food so far off in the first place?

jobbish-sql commented 3 years ago

Reporting is fixed by https://github.com/jhaagsma/ee_npc/pull/14

I believe the cause of the food mismatch is the game not including bushels lost to decay in the turn results