Build queue fast forward + con queue commands + geo toggling

Build queue fast forward + con queue commands + geo toggling

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
jivvz
Posts: 38
Joined: 04 May 2009, 00:03

Build queue fast forward + con queue commands + geo toggling

Post 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.
Last edited by jivvz on 21 Feb 2017, 21:53, edited 2 times in total.
jivvz
Posts: 38
Joined: 04 May 2009, 00:03

Re: Build queue fast forward widget vid

Post by jivvz »

Last edited by jivvz on 10 Jan 2018, 19:34, edited 1 time in total.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Build queue fast forward widget vid

Post by jamerlan »

Looks good!
jivvz
Posts: 38
Joined: 04 May 2009, 00:03

Re: Build queue fast forward widget vid

Post 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.
jivvz
Posts: 38
Joined: 04 May 2009, 00:03

Re: Build queue fast forward widget vid

Post 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)
jivvz
Posts: 38
Joined: 04 May 2009, 00:03

Re: Build queue fast forward widget vid

Post 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.
Post Reply

Return to “Lua Scripts”