[REL] Auto Factory

Discussion in 'Released Mods' started by trialq, January 25, 2014.

  1. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    https://github.com/trialq/tAutoFactory

    This mod automatically builds units with idle factories. It does this when:
    • Eco is being wasted
    • The user has nothing selected (to avoid ui glitches)

    Default eco thresholds: Metal 80%, energy 80%

    Live game UI
    af_1.png
    af_2.png

    Settings UI
    af_settings_v1.8.2.png

    This mod will likely break whenever a new patch is released (if it adds/changes units, where they're built etc). I will try to keep it updated asap.
    Last edited: September 14, 2014
  2. zaphodx

    zaphodx Post Master General

    Messages:
    2,350
    Likes Received:
    2,409
    WOW. AWESOME. THANKS.

    Add to PAMM?

    I would kinda want it to build any time you have spare metal available (within reason), not just grossly floating and wasting eco.
    igncom1 likes this.
  3. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    It's pending on PAMM. I might update it at some point to give the user some options in the settings menu they can alter, it could include metal and energy percentage thresholds.

    For now you can edit the mod yourself if you like to do what you want. Change this:
    Code:
      if ((model.currentMetal() === model.maxMetal()) && (model.currentEnergy() === model.maxEnergy())) {
    to this (untested):
    Code:
      var one = 1.0,
      metal_perc = (model.currentMetal() * one) / model.maxMetal(),//between 0 and 1
      energy_perc = (model.currentEnergy() * one) / model.maxEnergy();//between 0 and 1
    
      if (metal_perc>0.9 && energy_perc>0.9) {
    edit: Tried it, seemed to work.
    Last edited: January 27, 2014
  4. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Won't you lose your selection while you are using this ?
  5. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Yes you would. That's why it seems he only triggers it when you have nothing selected.
    Preserving the selection isnt that hard btw. You can easily save the current selection in some group (with any integer as index) and recall it after you have done your stuff.
    However last time I tried this wasn't fast enough and it resulted in the player being able to give commands to the wrong units.
  6. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    I did try this, but ran into problems (like when the user is about to place a building, the user would have to reselect the building from the menu again). Don't know how to fix it and there could be similar problems to swapping selections, so for now this is safer.
  7. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    The main issue is that the player can end up to give commands to the factories instead of whatever he though he has selected.
    In theory it should be possible to build the UI in a way that blocks and caches player input while you are switching around, but that would be a lot of restructuring in the UI. Not worth it. We should be given an API to directly give commands to units in the future.
  8. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    Well now. This is one heck of a plugin. I simply must try it out.
  9. fierceseaman

    fierceseaman New Member

    Messages:
    13
    Likes Received:
    0
    Ok, I've done a quick search to try to figure out how to install this mod but can't crack the nut. Could anyone help me out? Thanks.
  10. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    It's up on the PA Mod Manager. https://forums.uberent.com/threads/rel-pa-mod-manager-v3-0-4.50726/

    PAMM already has a very big set of mods, and you can install each one with just one click.
  11. gunshin

    gunshin Well-Known Member

    Messages:
    790
    Likes Received:
    417
    Does this mod stop factories from producing to keep the balance as close to 0 as possible?
  12. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Wuutt? This mod is awesum!

    Seriously though, this is one of many mods I would consider possibly and heavily overpowered in multiplayer. At the very least in a newbie setting. This could easily cut your attention needing to be paid in half and still produce you results.

    Also looks very flexible to modify, like which units you want it to produce. For instance, I would want it to produce gil-es. Obviously.

    Also, how does it perform in team games? Does it cause any messups? Also, how does it work if EVERYONE in a team uses it. Triplicate commands?
    Last edited: January 27, 2014
  13. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    No, I envisaged it as a simple mod to insure against lapses in concentration. Another mod I have started does aim to manage parts of the economy automatically, however it's been postponed until further notice as I'm not happy with it. What might be good for the economy (like pausing factories in early game to concentrate on eco) might not be good for the player (like getting steamrolled because you set the factory to build dox but it didn't want to). Basically it needs human intervention, the mod doesn't know what the user wants.

    It could indeed help newbies. If you actually rely on it for production and don't just use it as a safety net, I recommend editing it with the above code zaphod wanted. This gives the mod a bit of eco buffer to realise the user is wasting eco (the mod polls the eco every half second, slight inefficiencies can be observed if you only build something when eco is full). It'll be in the next update, but I want to save the update until there's more functionality.

    Yup, thanks to the way the api is, units are specified by the path to their blueprint. You might as well edit this version to your hearts content, as a potential future version where the user selects which unit type to build from which factory type (from the settings menu) is a long way off (if it gets here).

    Don't know, I can only guess that it helps, particularly if someone on your team is new.

    One minor issue I've observed is that factories set to conserve mode may be given build orders (that don't build as it's in conserve mode). Another issue, factories that are being built can also be given build orders.

    It's unlikely to triplicate commands, but I don't know so here's some hand-waving. The mod updates at 2FPS, the server 10FPS. To duplicate a command the eco surplus would have to be observed on the same tick. Given how often an auto-build command should be triggered (unless you rely on it for production, in which case queuing 2 units shouldn't be a big deal) this shouldn't be a problem, but if it is, just enable the mod for one person. The UI has a button to enable/disable the mod during play.
    thetrophysystem likes this.
  14. gunshin

    gunshin Well-Known Member

    Messages:
    790
    Likes Received:
    417
    That was my exact thoughts. Keep it out of this mod. GJ aswell, i think many players will use it so that they dont get idle factories.
  15. fierceseaman

    fierceseaman New Member

    Messages:
    13
    Likes Received:
    0
    It looks like the link to PAMM is broken. Anyone able to point me in the right direction to install this mod?
  16. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
  17. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Just install PAMM at that link and then download the mod through there.
  18. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    The mod has been updated to v1.1. Changes:
    • More sensible defaults, more efficient
    • Settings in the settings manager. Eco thresholds can be altered, as well as what each factory type auto-builds
    • Orbital factories can now auto-build

    Now the only factories that aren't included are nuke launchers and anti-nuke launchers. This is only because I couldn't find nukes or anti-nukes (I assume they're handled differently to normal units? If someone knows how to handle them, let me know), and this update is a big enough step as it is.
  19. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    There is a comment about a "nuke hack" in the live_game.js
    Maybe it has something to do with your issue?
  20. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    Thanks, I may be able to get them working from this. Looks like nukes and anti-nukes are in the nuke launcher and anti-nuke launcher directories, instead of one level up like normal.

Share This Page