bencbartlett / Overmind

AI for Screeps, a multiplayer programming strategy game
MIT License
554 stars 159 forks source link

fix roadPlanner coverage% #133

Closed zGeneral closed 5 years ago

zGeneral commented 5 years ago

Pull request summary

existing roadCoverage calculations takes into account all roadCoverages[] rooms which are being populated by directives. those rooms can be very far and many of them are not remote/SK rooms. by doing so, the road convergence % will mostly result in < 75%, which is the threshold for 2:1 transporter body. the fix will consider rooms in roadLookup instead (which include rm/sk/self-colony rooms only.

use the below in console to check existing roadCoverage: _.forEach(Memory.colonies,room =>{ console.log(room.roadPlanner.roadCoverage); })

Description:

the below shows the impact on coverage before and after Room# BEFORE AFTER
1 0.65 0.96
2 0.29 0.96
3 0.19 0.96
4 0.38 0.96
5 0.41 0.96
6 0.46 0.93
7 0.50 0.96
8 0.40 0.96
9 0.33 0.96
10 0.52 0.96
11 0.51 0.96
12 0.50 0.96
13 0.65 0.96
14 0.50 0.96
15 0.54 0.96
16 0.92 0.96
17 0.82 0.96
18 0.45 0.96
19 0.48 0.96
20 0.60 0.88
21 0.98 0.96
22 0.96 0.96
23 0.41 0.96
24 0.66 0.96
25 0.92 0.96
26 0.00 0.96

Added:

Changed:

Removed:

Fixed:

Testing checklist:

bencbartlett commented 5 years ago

I haven't bene able to reproduce the problem of incorrect road coverages. If you're getting incorrect road coverage calculations it seems as though something is incorrectly modifying this.colony.destinations. We should try to identify what is actually causing the issue for you rather than slapping a band-aid on the problem. Can you create an issue with some more detailed data on what this.colony.destinations is to try to identify the offending process?

zGeneral commented 5 years ago

looking closely at the code, this.colony.destinations is being populated by the constructors of: extract/harvest/upgradeSite. I believe the issue happens when a harvest site is being claimed there is no cleanup mechanism to remove it from destinations. the newly claimed room will remain in destinations as if it is still a harvest site. roads will not be built towards the claimed room. this will affect the roadCoverage percentage