Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

BARABAS (universal base and ship script)

Discussion in 'Programming Released Codes' started by Burillo, Feb 22, 2015.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Burillo Junior Engineer

    Messages:
    648
    um, not sure what you mean here.

    first of all, where did i say i made the config mandatory? if you're referring to the latest changelog, then it's not that config is now mandatory - it's that if you want to change default settings, config is now mandatory (whereas before you had an option to edit the code as well - you still do, but it's "not officially supported" any more). you still don't need a config if you don't want any special configuration.

    second of all, the "initial configuration" is always generated automatically, so no one is forcing user to do anything here :)

    EDIT: sorry, misread your post :) no, i don't think mandatory config is necessary. at least not at this point.
     
    Last edited by a moderator: Mar 26, 2015
  2. Smokey McDoob Trainee Engineer

    Messages:
    38
    No, you definitely didn't get what I was trying to say. I was talking about making changes to the way it is now.

    How much smaller would your code be, if you DID make the config mandatory? You could get rid of a huge chunk if you didn't need to define the settings, and then have an option to output those settings.

    Just a pure efficiency POV. I don't know if it works the same with PBs, or even actual programs today, but back in my training, extraneous code was always a bad thing. Then again, I was training on CPUs whose clock speeds were measured in tens of MHz, not in GHz. Every bit of efficiency was necessary at the time.
     
  3. Burillo Junior Engineer

    Messages:
    648
    yep, i misread it, apologies.

    the script would be no more efficient than it is now. it's not like all the config support code would suddenly disappear if i made the config mandatory. because i would still have to parse strings and write them out just as i do now. in fact, nothing in my script would change. not a single line. perhaps, an exception on config block not found added :)

    i would also argue that config parsing isn't the heaviest part of my code, by far. refineries rebalancing - now that is a lagfest when you have a big base and a lot of ore...
     
  4. Smokey McDoob Trainee Engineer

    Messages:
    38
    I respectfully disagree. If you had no need to a) define the initial config (because it's already in the text panel) and b) send that config to a text panel (again, it's already there), I would think that would remove at least something. Once again, though, this is only a thought experiment for me. I'm certainly not insisting you make these changes.

    That makes sense to me, but does that mean you should not try to streamline the code wherever possible? I'm also working on a couple suggestions on the refinery balancing subject, after having seen the script in action. I'm not yet finished formulating my thoughts on that, though...
     
    Last edited by a moderator: Mar 26, 2015
  5. Burillo Junior Engineer

    Messages:
    648
    i respectfully disagree. programming block doesn't see text panel's text as code. i have to parse it. there's no way around it. while i don't need to "define initial config" if said config is mandatory, i still have to define the variables that will hold current state (that i later read from config). i.e. at some point i'd still have to
    Code:
    bool sort_storage;
    ...
    Boolean.TryParse(config_line, out sort_storage);
    
    for every state variable, and then regenerate the config, just as i do now. i'm saying that not because i "don't want to try and streamline my code" - it's just you're having a bit of a misconception about how programming in SE works and what happens behind the scenes in my code. removing the config will do what you describe, but that's not an option.

    i do try and do that whenever possible, but honestly, readability and maintainability take priority here. it's not easy to make changes to a 3400+ LOC file.
     
    Last edited by a moderator: Mar 26, 2015
  6. Smokey McDoob Trainee Engineer

    Messages:
    38
    And here's where my lack of maintenance on my coding skill shows itself :p I know nothing of how SE does it, and I've never used any of the C variants. I was basically going by logical assumption.
    I can understand how frustrating it would be to have to rewrite a project of that size, and I didn't really expect any changes from this idea anyway. I know that having other people throw ideas at me sometimes helps my own creative process, and that's kind of what I'm trying to do with you :)

    About the refinery balancing: is 1k ore the right amount per movement operation? I tend to dock my miner with well over 100k of an ore (if you're gonna go to some far away asteroid to mine, you might as well fill up while you're there). It seems to me that having 5k or even 10k ore per movement, and less movements, might help with the lagfest you mentioned. I haven't seen any lag, but I'm not using a monster array of refineries, nor am I using vanilla refineries: http://steamcommunity.com/sharedfiles/filedetails/?id=351103963 These bad boys do the work (and consume the energy) of FIVE normal refineries!
     
  7. Burillo Junior Engineer

    Messages:
    648
    no, that's fine :) i'm not going to do anything i don't like anyway, as this script is first and foremost for myself. if someone suggests something i like - great. if someone doesn't like my vision of how this script should work - they're welcome to take it and modify it to their needs.

    well, without delving into technical details, 5k chunk size won't change much :) the lagfest is simply due to the sheer number of ore items in the inventory. the ore isn't rebalanced past the first chunk anyway (i.e. if you have 5k ore, you'll have 1k and 4k, not 1k and 4 more 1k chunks).
     
  8. Smokey McDoob Trainee Engineer

    Messages:
    38
    Well, perhaps it's because I have more than one ore waiting to be refined, but I see more than one 1k chunk in each refinery. And I'm pretty sure I've seen more than one 1k chunk per ore in the past.
     
  9. Burillo Junior Engineer

    Messages:
    648
    well, yes, 1k per ore. so, say, if you have 10k iron, 5k uranium and 3k nickel, you'll have 1k iron, 1k uranium, 1k nicket, 9k iron, 4k uranium, 2k nickel in your refinery.

    ---

    apparently it works - i've successfully made my miner believe it's connected to base while it's actually connected to a storage ship :)
     
    Last edited by a moderator: Mar 26, 2015
  10. Smokey McDoob Trainee Engineer

    Messages:
    38
    That closely resembles what I remember.
    Excellent! Can't wait to give it a try! For the sake of not misidentifying the PB, though, I hope you kept the 'CPU' in the name... I.E. 'BARABAS Ship CPU' or 'BARABAS CPU Base' or similar...
     
  11. Burillo Junior Engineer

    Messages:
    648
    no, just "BARABAS Ship" or "BARABAS Base". however, it's not final yet, so it can be changed. why would that be a concern though? it's not like you go around randomly renaming blocks...

    ---

    i've uploaded 1.3pre4 with the new remote base/ship detection code.
     
    Last edited by a moderator: Mar 26, 2015
  12. MagicHp Trainee Engineer

    Messages:
    10
    Thanks a lot for your work, BARABAS is really amazing ^^

    I would like to keep a "CPU" in the name too, just as smokey suggested. No real use, to be honest I just think it is kinda cool ;)
     
  13. Burillo Junior Engineer

    Messages:
    648
    glad it works for you :)

    no strong objections here, so i guess i'll add it in the next pre-release update.

    -----

    pre5 uploaded, with this change applied, and a number of other changes
     
    Last edited by a moderator: Mar 27, 2015
  14. Burillo Junior Engineer

    Messages:
    648
    Version 1.3 released, with numerous new features and lots of improvements:
    • Added support for ice and oxygen tracking
    • Added brown alert, indicating oxygen leak
    • Added pink alert, indicating non-functional blocks
    • Added detection of remote grid types according to their BARABAS mode (removing one of the limitations) - yes, mobile bases now work properly! yay!
    • Added support for scrap metal
    • Grids are now recognized as local when loading the world even when connected to other entities at load time (removing another limitation)
    • Replaced "throw out stone" flag with "keep stone", with more flexibility
    • More precise material shortage tracking
    • More precise storage load tracking for drills and grinders
    • Display estimated ingot amounts when ore is present
    • Improvements to ore balancing
    • Improvements to state machine
    • Text block now displays all alerts, not just highest level
    • More fluid and flexible text updates
    • Editing source code to configure BARABAS is no longer considered "supported"
     
    Last edited: Apr 3, 2015
    • Like Like x 2
  15. Tontow Apprentice Engineer

    Messages:
    259
    What do all the alerts mean?
    Some are obvious, but I have one alert "Connected" that I don't understand.

    Is there any way to get more detailed information on an alert? IE: When it says assembler clogged, it would be nice to know which ones are clogged.

    And how do I get it to use multiple LCD panels / text boxes to display info?
     
  16. Burillo Junior Engineer

    Messages:
    648
    The first post in this topic outlines what all the alerts mean. "Connected" means something is connected. i.e. you have a base, and a ship, and they are connected via a connector.

    and how do you suppose i do that? i can give you names, fine, but how do you get the physical location of a clogged assembler?

    same way you do with single panel - just add them to a "BARABAS Notify" group. they will, however, all display the same information - there is no multi-screen support. there may be, in the future, but so far i haven't figured out how to do that without resorting to rigid requirements.
     
  17. AutoMcD Senior Engineer

    Messages:
    2,369
  18. Tontow Apprentice Engineer

    Messages:
    259
    Ok, but my base has no ships connected to it via a connector. I do have a pair of sorters that connect to my storage. That is why this confused me.



    Names would be good. So you can at least locate and unclog it.
    As far as location, if you must have location, Turn on the Show On HUD. Maybe add and remove "(Clogged)" to the end of the assembler's name so you know why it is showing up on the HUD. (Location should be something that can be disabled in the config.)


    This may be worth a look then. http://steamcommunity.com//sharedfiles/filedetails/?id=403921671
     
  19. Burillo Junior Engineer

    Messages:
    648
    ah. didn't think of that scenario. i'll fix this in the next version, thanks for this.

    this is actually a nice idea, didn't think of that before. will definitely add that! not sure about renaming though...

    from the requirements:
    this sounds doable. however, i don't have a lot of character space left. if you like this script - why not use that instead? nobody forces you to use BARABAS's text output - you can use that script instead. they shouldn't interfere with each other...
     
  20. Tontow Apprentice Engineer

    Messages:
    259
    Is there an option to make the script respect the Sorter's white and black list? I needed silver refined and for a while it was doing great, but then it started to refine not silver. When I changed the sorters to gather up everything except silver ore, the script gave me the finger and dragged everything out of storage anyway.....
     
  21. Burillo Junior Engineer

    Messages:
    648
    this should be taken up with Keen. if a programming block does not respect sorter's settings, there's nothing i can do about that.
     
  22. Smokey McDoob Trainee Engineer

    Messages:
    38
    Couldn't help but laugh after reading that...

    I do believe that scripts don't necessarily respect sorters. They basically move X to container Y through anything, as long as they are connected... I had a script pull things BACKWARDS through a sorter, even!
     
  23. MagicHp Trainee Engineer

    Messages:
    10
    Disregard this post, a bad idea altogether ^^
     
    Last edited: Apr 20, 2015
  24. AutoMcD Senior Engineer

    Messages:
    2,369
    There is a function that this script does:
    http://forums.keenswh.com/threads/ships-main-computer.7358347/

    Which I think yours could easily incorporate. I'd prefer the base I'm working on does not run too many scripts.
    I'd like the o2 generator to shut off when the o2 tanks are more than 30% full. This will save room in them for depressurization of airlocks.
    The o2 farm would keep going, that air is free. if they manage to top off the tanks then so be it.
     
  25. Smokey McDoob Trainee Engineer

    Messages:
    38
    So, seems one of the updates broke your script, bud.

    Since the latest update put inventory mass into effect, I figured I'd better build a tug, especially since your script already supports the idea. And so, I built one, but the script refused to compile! I checked with my miner, and same thing. Here's the error code:

    Line 612:
    'Sandbox.ModAPI.Ingame.IMyGridTerminalSystem' does not contain a definition for 'BlockGroups' and no extension method 'BlockGroups' accepting a first argument of type 'Sandbox.ModAPI.Ingame.IMyGridTerminalSystem' could be found ,are you missing a using directive or an assembly reference?
    Line 636:
    (same)


    Here's a screencap: http://steamcommunity.com/sharedfiles/filedetails/?id=494838830

    I don't know nearly enough to attempt to fix it, so I figured I'd let you know. Sure hope you can fix it!

    EDIT: Screencap shows version 1.3pre2, but this bug occurs in all versions from 1.2 to 1.3-release
     
    Last edited: Aug 6, 2015
  26. Wicorel Senior Engineer

    Messages:
    1,243
  27. Smokey McDoob Trainee Engineer

    Messages:
    38
    Well, thanks for that shameless, and less-than-relevant, plug. Care to at least elaborate on the changes you made?
     
  28. Wicorel Senior Engineer

    Messages:
    1,243
    Shameless? You can just use the version of the script from the miner.. but, as I said, I don't plan on publishing the script separately on the workshop.

    I changed it to not use the deprecated APIs. There are other discussions about how to to that, if you're interested.
     
  29. Smokey McDoob Trainee Engineer

    Messages:
    38
    If it's all the same to you, I think I'll give Burillo a couple of days to respond first. If he doesn't, then I might subscribe to your ship for long enough to get the updated script.
     
  30. Burillo Junior Engineer

    Messages:
    648
    sorry, haven't been in the game for a while... it might take long for me to update the script, so you can go ahead and subscribe to that one instead until i get more time to work on BARABAS and update it to the latest and greatest. amazing that the script worked without modifications as long as it did :)
     
    Last edited: Aug 7, 2015
Thread Status:
This last post in this thread was made more than 31 days old.