Page 1 of 1

Build queue fast forward + con queue commands + geo toggling

Posted: 16 Apr 2016, 16:32
by jivvz
youtube demo: https://www.youtube.com/watch?v=n3I00TGov5A

Code: Select all

function isTimeToMoveOn(secondsLeft, builderID, totalBuildSpeed)
  local plannerBuildSpeed = builders[builderID].originalBuildSpeed
  local plannerBuildShare = plannerBuildSpeed / totalBuildSpeed
  if ((plannerBuildShare < 0.75 and secondsLeft < 1.2) or (plannerBuildShare < 0.5 and secondsLeft < 3.4) or (plannerBuildShare < 0.15 and secondsLeft < 10) or (plannerBuildShare < 0.05 and secondsLeft < 20)) then
    return true
  else
    return false
  end
end
What do you think? :D
I think I'm gonna add some more stuff to it. Like building prioritization based on economy.

Re: Build queue fast forward widget vid

Posted: 18 Apr 2016, 19:37
by jivvz

Re: Build queue fast forward widget vid

Posted: 18 Apr 2016, 20:23
by jamerlan
Looks good!

Re: Build queue fast forward widget vid

Posted: 19 Apr 2016, 19:00
by jivvz
thanks! as of now it never starts up more than 2 buildings, but in the future it could calculate unused buildpower at next queued building spot, and thereby maximize used/minimize unused buildpower.

Another important fix to this plugin (and game(s)?) is to move cons away from the next build spot.

Theres a bug when you make several units have the same build queue. No one stays to finish.

Re: Build queue fast forward widget vid

Posted: 18 May 2016, 21:12
by jivvz
new version pushed with:

* easy finish within build range neighbour capability (works very well with move-ahead scheme)
* and some very buggy MM<->energy switcher

PS. the bug mentioned in the previous post is fixed. (theoretically by feature #1 in this post, but practically through very ugly code)

Re: Build queue fast forward widget vid

Posted: 21 Feb 2017, 21:44
by jivvz
New version pushed to github together with another handy widget with two commands that can be used to chop off commands from start and end of queue.
That widget also toggles geos on and off (feature targeted at PD/PA).

There are still some painful bugs, for example when stalling m and building two same e buildings, the cons toggles back and forth between them. it puts real pressure on processing in late game. for example many spam factories. with many nanos. i should explicitly remove factories from neighbour candidates. #todo

renamed repo to https://github.com/aronj/spring_widgets

just take a look at this sexy sort code tho :D

Code: Select all

  if assistType == 'energy' then
    table.sort(candidates, function(a,b)
      local aWillStall = buildingWillStall(a[1])
      local bWillStall = buildingWillStall(b[1])
      if aWillStall and bWillStall then
        return a[3]['energyMake'] / a[3]['buildTime'] / a[3]['power'] > b[3]['energyMake'] / b[3]['buildTime'] / b[3]['power']
      elseif aWillStall and not bWillStall and a[3]['energyMake'] > 0 then
        return false
      elseif not aWillStall and bWillStall and b[3]['energyMake'] > 0 then
        return true
      else
        return a[3]['energyMake'] / a[3]['power'] > b[3]['energyMake'] / b[3]['power']
      end
    end)
  elseif assistType == 'mm' then
    table.sort(candidates, function(a,b) return getMetalMakingEfficiency(a[2]) < getMetalMakingEfficiency(b[2]) end)
  elseif assistType == 'metal' then
    return false
  end
  return candidates[1][1]
The idea is to find the best candidate within specific resource type.


edit: I think the spammy force assist fidgety switch target bug might be finally resolved.