{"action":"created","issue":{"url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8759","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8759/labels{/name}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8759/comments","events_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8759/events","html_url":"https://github.com/OpenRA/OpenRA/pull/8759","id":96302326,"number":8759,"title":"Improved AI BaseBuilder","user":{"login":"reaperrr","id":2857877,"avatar_url":"https://avatars.githubusercontent.com/u/2857877?v=3","gravatar_id":"","url":"https://api.github.com/users/reaperrr","html_url":"https://github.com/reaperrr","followers_url":"https://api.github.com/users/reaperrr/followers","following_url":"https://api.github.com/users/reaperrr/following{/other_user}","gists_url":"https://api.github.com/users/reaperrr/gists{/gist_id}","starred_url":"https://api.github.com/users/reaperrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reaperrr/subscriptions","organizations_url":"https://api.github.com/users/reaperrr/orgs","repos_url":"https://api.github.com/users/reaperrr/repos","events_url":"https://api.github.com/users/reaperrr/events{/privacy}","received_events_url":"https://api.github.com/users/reaperrr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OpenRA/OpenRA/labels/PR:%20Changes%20requested","name":"PR: Changes requested","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/OpenRA/OpenRA/milestones/15","html_url":"https://github.com/OpenRA/OpenRA/milestones/Next%20release","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/milestones/15/labels","id":1127295,"number":15,"title":"Next release","description":"","creator":{"login":"obrakmann","id":4331210,"avatar_url":"https://avatars.githubusercontent.com/u/4331210?v=3","gravatar_id":"","url":"https://api.github.com/users/obrakmann","html_url":"https://github.com/obrakmann","followers_url":"https://api.github.com/users/obrakmann/followers","following_url":"https://api.github.com/users/obrakmann/following{/other_user}","gists_url":"https://api.github.com/users/obrakmann/gists{/gist_id}","starred_url":"https://api.github.com/users/obrakmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obrakmann/subscriptions","organizations_url":"https://api.github.com/users/obrakmann/orgs","repos_url":"https://api.github.com/users/obrakmann/repos","events_url":"https://api.github.com/users/obrakmann/events{/privacy}","received_events_url":"https://api.github.com/users/obrakmann/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":26,"state":"open","created_at":"2015-05-24T08:30:48Z","updated_at":"2015-07-22T12:26:31Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-07-21T12:15:57Z","updated_at":"2015-07-23T16:45:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8759","html_url":"https://github.com/OpenRA/OpenRA/pull/8759","diff_url":"https://github.com/OpenRA/OpenRA/pull/8759.diff","patch_url":"https://github.com/OpenRA/OpenRA/pull/8759.patch"},"body":"This improves 3 things:\r\n\r\n**1. The low power check.** \r\nPreviously, it would check whether players' `ExcessPower` was less than `MinimumExcessPower` or whether the sum of all `Power` traits on the structure it wanted to build *exceeded* the players' `ExcessPower`, and if either was true, build a power plant instead.\r\nThe catch: power *draw* is represented by *negative* numbers, so the only structures that would trigger the 2nd check were - power plants.\r\nIn other words, as long as current `ExcessPower` was equal or higher than `MinimumExcessPower`, the whole check would effectively fail, hence why the AI was out of power about half the time before I introduced `MinimumExcessPower` recently.\r\nNow the 2nd check properly evaluates whether current `ExcessPower` + to-build actors' `Power` would be *lower* than `MinimumExcessPower`, and in that case build a power plant instead.\r\nAdditionally, unlike before, it now also performs the \"do I have enough power\" check for the higher-priority overrides (refineries, production buildings, silos).\r\nLast but not least, it now also gives powerplants priority if already on low power (no idea why it was different before).\r\n\r\n\r\n**2. Repeated placement failures.**\r\nPreviously, the AI would constantly and stubbornly retry to build and place a structure even if out of space.\r\nNow, after 3 consecutive failed attempts to place a structure, it is assumed that the AI has run out of build space and further production of structures is paused for a minute (default value of `StructureProductionResumeDelay`).\r\n\r\n\r\n**3. Placement failure of naval structures.**\r\nPreviously, the AI would try to build naval structures even if there was no water within the buildable area. Now it checks for space right when deciding which structure to build, and if no space is found for the naval structure, disables construction of naval structures permanently for the rest of that game.\r\n\r\n\r\n\r\nIn summary, this should considerably reduce lag spikes from repeated building placement failures and finally prevent the AI reliably from driving itself into low power."},"comment":{"url":"https://api.github.com/repos/OpenRA/OpenRA/issues/comments/124164524","html_url":"https://github.com/OpenRA/OpenRA/pull/8759#issuecomment-124164524","issue_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8759","id":124164524,"user":{"login":"reaperrr","id":2857877,"avatar_url":"https://avatars.githubusercontent.com/u/2857877?v=3","gravatar_id":"","url":"https://api.github.com/users/reaperrr","html_url":"https://github.com/reaperrr","followers_url":"https://api.github.com/users/reaperrr/followers","following_url":"https://api.github.com/users/reaperrr/following{/other_user}","gists_url":"https://api.github.com/users/reaperrr/gists{/gist_id}","starred_url":"https://api.github.com/users/reaperrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reaperrr/subscriptions","organizations_url":"https://api.github.com/users/reaperrr/orgs","repos_url":"https://api.github.com/users/reaperrr/repos","events_url":"https://api.github.com/users/reaperrr/events{/privacy}","received_events_url":"https://api.github.com/users/reaperrr/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T16:45:15Z","updated_at":"2015-07-23T16:45:15Z","body":"Updated."}}