1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

SE Server Maintenance Utility

Discussion in 'Groups & Dedicated Servers' started by towerofpower256, Jul 14, 2014.

Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.
  1. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    "Damn, there's so much space junk that my server is running turtle-slow. Ah well, time to delete the world and start again."

    Don't be "that admin" anymore!

    SE Server Maintenance
    Utility


    Download:
    https://sourceforge.net/projects/semaintenanceutility/files/

    At heart, this is a simple Python script that performs the following:

    Object Cleanup
    Has 3 modes; powered, block and both.

    Powered removes anything that doesn't have either;
    - a fueled reactor (enabled or disabled)
    - a charged battery (enabled or disabled)
    - a solar panel

    Block removes anything that doesn't have at least one of the block types you can set up in the "config.ini". A common use for this is when it's a "put a beacon on whatever you want to keep" server. Set "type_cleanup_blocks" to "MyObjectBuilder_Beacon" in the config.ini and you're good to go.

    Factory Disabling
    Turns out that lots and lots of factory (refineries and assemblers) are confined to a single CPU core and can get overwhelming. To combat that, you can either 'soft' or 'hard' turn off all factories. Soft disables empty refineries and idle assemblers whereas Hard just disables them regardless of their state.

    Killing Inertia
    Ever had thousands of little objects using up all of your bandwidth? This can kill all of the movement & rotation of every CubeGrid in the server. May interfere with NPC ships.

    Free-Floating Item Cleanup
    As the name says, this removes any free-floating items like bits of ore or components. Doesn't do corpses just yet, that's more complicated as it's tied into the player tables and needs some more research.

    Junk Code Cleanup
    At the moment, there's A LOT of useless nodes in Space Engineer save files. Notably, ColorHSVMask on anything with a GUI (cockpits, timers, sensors, etc) and ConveyorMaps which are calculated in game anyway. Unfortunately, the junk returns after SE re-saves however it's useful if you've just cleaned up and everyone is reconnecting to the server.

    Asteroid Respawning
    In infinite worlds, the game respawns asteroids by itself. This function will remove asteroids that no one and nothing is near, and allow the game to respawn them.
     
    Last edited by a moderator: Feb 4, 2015
  2. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    Great work! One simple addition I would suggest adding to your script would be the removal of dead players, even still I'm sure the script will be helpful to many.
     
  3. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    I did think about removing free floating objects and the like but I thought that the server would automatically take care of that. Still, if it's an issue, can't hurt to add it. I'll attack it tonight.
     
  4. n30nex

    n30nex Trainee Engineer

    Messages:
    58
    If your parsing for beacons to flag them to save from the garbage collection, could you also add a check for beacons with a certain name to be repaired and the reactor of the ship its attached be refilled to a pre-set U amount. This would automate nav beacon fixes over restarts for a lot of us hosters.
     
  5. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    I'd be hesitant to do it by beacon name because "name your ship X for free uranium dudes!" abuse. However, you've got a good point and I can do it by entity ID. Finding the entity ID is pretty easy too and VERY VERY unique. I'll add that this evening as well.
     
  6. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    When you say dead players, do you mean corpses floating free in space?
     
  7. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    For example, in Sandbox.SBC:

    Code:
      <AllPlayers>    <PlayerItem>
          <PlayerId>144355436915342973</PlayerId>
          <IsDead>true</IsDead>
          <Name>Player_76561197968765703</Name>
          <SteamId>76561197968765703</SteamId>
          <Model>Default_Astronaut</Model>
        </PlayerItem>
        <PlayerItem>
          <PlayerId>144332597451084999</PlayerId>
          <IsDead>true</IsDead>
          <Name>Player_76561197968765703</Name>
          <SteamId>76561197968765703</SteamId>
          <Model>Default_Astronaut</Model>
        </PlayerItem>
      </AllPlayers>
    
    This can begin to cause the same problem as having an overflow of factions; deleting a player that owns a medical room would undoubtedly mess with respawns, possibly first do a check for that.

    I also agree with not doing something like that by name, but by EntityID of the reactors themselves, that could be pretty awesome indeed.
     
  8. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Ah ok, so there's a player list and it records each and every player that's ever joined?

    If that's the case, removing all players that have the "dead" tag might be a bit much but I'll wrap my head around it. Do players get classed as "dead" if they leave the server?

    As for the med bays & ownership, that should be OK. If a players gets pruned, make all their stuff owned by nobody and up for grabs.

    The entity of the reactors might be a bit fine-grain and tedious, I was thinking of the entire object itself. Just recurse through it's blocks and fill up reactors. Also, turn everything on in case someone turned them back off.

    I'm also thinking of maybe a function to backup the objects so that if they get destroyed or minged, running this will restore them. But I'll tackle these other changes tonight.
     
  9. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Tell you what though, what about removing players that don't own anything? Could that be a good description of a dead player to be pruned?
     
  10. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    Sounds perfect, if they don't own anything, there is no ownership to worry about.
     
  11. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    That should be real easy, might even do it tonight.
     
  12. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    Looking forward to it =)
     
  13. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Version 1.1 released, I'm going to bed...

    Let me know what you think. I'll diddle around with admin objects (e.g. coordinate beacons) tomorrow, already got some ideas going on.
     
  14. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Well how about that, it's only been ~24hrs and the utility is now being used by StreamlineServers for their Space Engineer servers.

    [​IMG]
     
  15. Malactus

    Malactus Trainee Engineer

    Messages:
    8
    Hey, just wondering could you create a github repo so others programmers may also contribute further/create forks? This way you still get attributed for the work while others can extend upon it. I have a couple of things I could extend this utility with, and I think it would be unnecessary to make -another- script for it when something else does the job just as well.
     
  16. StreamlineServers

    StreamlineServers Trainee Engineer

    Messages:
    14
    We are glad to see systems like these are being developed. Keep up the good work mate.
    The latest update will be applied on our end shortly.
     
  17. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    With the "Junk" mode, and cleaning up objects that do not have reactors, does this take into account objects that are connected via rotors? In the past, any thing connected to rotors acted like separate objects entirely, this may or may not still be the case; if so, deleting objects because they simply don't have reactors may unintentionally remove these parts.

    Also, removing players from a faction simply because they don't own anything could raise some issues, I for one spawn on my faction's medical room, use faction ships, etc; I do not have any objects that specifically belong to me, but very much wish to remain with my faction.
     
  18. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    I had been thinking about it, I'll look into it if work quiets down. First I'd have to figure out how to work one :S

    Both good points. I'll probably have to start testing for IsDead as well as ownership. Tonight job.

    Haven't really diddled with Rotors before, I'd imagine that there's a Bond or Join attribute that connects it to another EntityID, might have to build a tree before the big removal loop so no bits get left behind. Another tonight job.
     
  19. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    Two other options you could think about adding would be the killing of object inertia and the disabling of refineries and assemblers. Also, as expected, the current --prune-players option breaks a lot of needed ownership.
     
  20. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    An option to kill inertia I could see being useful. Should be easy too, I think it's just XYZ elements on the CubeGrid entity.

    Do refineries and assemblers that get left on create performance issues? I've never been on a world that lasted more than a single reboot, not sure of the drawbacks there.
     
  21. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    To-do list
    - Make a GitHub / GoogleCode / SourceForge (one of those)
    - Function to kill inertia of all objects
    - Change PrunePlayers to detect no ownership AND <IsDead> tag
    - Research saves and rotors, get that working
    - Add options to soft & hard disable assemblers and refineries
    - Recheck faction pruning, might be broken
     
  22. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    According to the following post by 'czbear' they do:

    https://forums.keenswh.com/post/dedicated-server-performance-limitations-6981592
     
  23. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Well there you go, I did not know that. Good find.

    How about "--disable-idle-factories" which will turn off;
    - Empty refineries
    - Assemblers without orders

    If it gets really bad, I can add "--force-disable-factories" and shut them down regardless.

    Would that do the trick?
     
  24. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    I would assume that it would be the active refineries that are causing the issue rather than the idle ones, but I could be wrong on that.

    EDIT: I noticed that the current --prune-factions is deleting more than just the empty factions and can cause some interesting problems with defenses, the initial release did not have this issue.
     
  25. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Can't have that, I'll fix that first.

    Might need to fix the definition for a "dead" faction and start treating them as faction groups & taking alliances into account.
     
  26. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Sweet jesus! I can see what you mean about cleaning out the player table! Just took a save from the SpaceEngineers.com.au public server, it takes up about 80% of the save!
     
  27. towerofpower256

    towerofpower256 Apprentice Engineer

    Messages:
    120
    Version 1.1.1 released, redid the Player and Faction pruning. Took ownership out of the question for factions, will only remove empty ones now. Also, player pruning removes entries from many more places now, being much cleaner.

    Tried GitHub, much more complicated than I thought. Can't upload EXE's. I'll try some other solutions like GoogleCode but if all else fails, might go SourceForge and supply the source myself.

    If I get the time, I'll make it also remove players that don't own anything and don't belong to any factions (e.g. just joined and then left).
     
  28. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    Sounds fantastic! Will give you feedback asap
     
  29. Malactus

    Malactus Trainee Engineer

    Messages:
    8
    Git is mostly just source-code, the exe would be hosted elsewhere and linked in readme markup (normally packaged in zip files in git). I've found your repo and created a fork, with filled up the markup :). I will probably take a peek on limiting amount of active production entities per faction during maintenance reboot during this week.

    Was thinking on parameter similar to --restrictActiveProductionEntitiesPerFaction # , to disable all but a # assemblers and refineries per faction and make all non-faction factories disabled after maintenance bootup. This way active factions keep some of their automation (no preference selection yet, but I might make it alphabetical), while inactive ones eventually do not have any active factories. Also makes sure that people who forget them on do not accidentally run out of fuel, if it is ran as a 24 h or 48 h maintenance cycle.
     
  30. Borg8401

    Borg8401 Trainee Engineer

    Messages:
    55
    Just ran through 1.1.1 with the following options:

    --cleanup-objects beacon
    --cleanup-items
    --prune-players
    --prune-factions

    From what I can tell, everything worked flawlessly. If I run across any issues I'll be sure to let ya know.
     
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.