How many docked entities is too many?

    Joined
    Jan 27, 2016
    Messages
    169
    Reaction score
    195
    I've been having a lot of stability issues with Starmade since the Trade system update. I suspect my biggest problem is lack of RAM, I'm running SM on 2GB out of the 8GB my computers has. Oddly enough letting SM have 4 GB makes things worse, I think windows objects to giving half the RAM to one application.

    I plan on upgrading my computer to 16 or 32 GB of RAM in September, but that will require saving a bit of money.

    Another thought I had is that maybe my current build has too many docked entities?

    It's a roughly 325m long 50k Mass ship with 7 main turrets, 11 secondary turrets, and 40 AMS turrets, one elevator and a pair of small shuttles. So 119 docked entities total, and that is probably going to go up to 121 once I put in a pair of docked reactors.

    Am I pushing SM too far until I get my system upgraded? And would this be a ship that is safe to bring onto a multiplayer server?
     

    Sachys

    Hermit.
    Joined
    Nov 30, 2015
    Messages
    646
    Reaction score
    315
    40 AMS turrets
    I'd reduce the amount of those at least. If you have them well placed and well made, you probably wont need even half of that - especially as they're a bit prone to borking of recent (or so I've noticed).

    Edit: and yes, generally more turrets = more laggyness, so reduce the amount, increase individual power maybe
     

    Dr. Whammy

    Executive Constructologist of the United Star Axis
    Joined
    Jul 22, 2014
    Messages
    1,789
    Reaction score
    1,723
    • Thinking Positive
    • Likeable Gold
    • Legacy Citizen 9
    I've been having a lot of stability issues with Starmade since the Trade system update. I suspect my biggest problem is lack of RAM, I'm running SM on 2GB out of the 8GB my computers has. Oddly enough letting SM have 4 GB makes things worse, I think windows objects to giving half the RAM to one application.

    I plan on upgrading my computer to 16 or 32 GB of RAM in September, but that will require saving a bit of money.

    Another thought I had is that maybe my current build has too many docked entities?

    It's a roughly 325m long 50k Mass ship with 7 main turrets, 11 secondary turrets, and 40 AMS turrets, one elevator and a pair of small shuttles. So 119 docked entities total, and that is probably going to go up to 121 once I put in a pair of docked reactors.

    Am I pushing SM too far until I get my system upgraded? And would this be a ship that is safe to bring onto a multiplayer server?
    I can't say for certain. ...but I can tell you that the amount of lag generated from mounting a 100 round logic-driven torpedo launcher on a frigate along with 19 point defense guns and 2 missile turrets (a total of 145 cores) will make everyone on the server either beg for mercy or put a contract hit out on you. ;)
    100x test 2.gif
     
    Joined
    Jan 28, 2015
    Messages
    492
    Reaction score
    149
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 3
    Am I pushing SM too far until I get my system upgraded? And would this be a ship that is safe to bring onto a multiplayer server?
    I would say 121 entities is to much but it's a borderline case. What i did was i contacted the server admin. Had him spawn the blueprint add a bobby ai and let it fight a few pirates waves. These days he can use fleet commands. If the server doesn't protest then he can despawn it. And you can start filling the blueprint knowing that once you have all the stuff and spawn the ship there won't be any issues. I on my part had to remove some docked ships and escape pods before my ship was server stable. Beter you know before hand.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    Does it change anything to activate "stop moving on rails" for all these torpedoes?

    I've made a 64-round torpedo launcher before the rail update with 8x8 cores and 2 warheads per core using the old docking system.
    It would be the size of 16x16 and launch them in 2 or 4 steps (checker-board pattern and checker-board squared).

    I hope that the same can be archived with rails. Maybe I can test that as it does not require orientated blocks (which are currently blind-placement for me).
     
    Joined
    Jul 6, 2013
    Messages
    451
    Reaction score
    108
    • Purchased!
    • Community Content - Bronze 2
    • Legacy Citizen 5
    There is no real fixed number. Basically until the world/server your playing on has issues. Anything docked if possible I would recommended to have a one block air gap around it to reduce lag due to collision calculations.

    There are 3 typical limitations people run into for lag and it all comes down mostly to their or the servers hardware.

    Memory the easiest to adjust.
    There are various levels of info you can show in starmade. The some info shows memory usage on your computer. I have a complicated 430k mass ship with well over 100 entities and its hitting 2.5GB of memory or less on single player though it does sometimes hit higher. If you have it set to 4GB for singleplayer your unlikely to run out. For really large constructions 8GB should cover anything your likely to run into in single player. Only when you get out of memory warnings do you have memory issues. Note they have mentioned some memory leaks have been fixed so there are some which will slowly consume more memory over time.

    Graphics card.
    I'm not a programmer I only have a basic understanding of this and can be very wrong. Each face of a block that isn't covered is generally rendered then only the ones you can see are shown. Note that docked entites don't count for covering a face of a block each entity is treated separately. Its possible to have so many blocks showing that your video card has issues. You can tone down the graphics settings making it easier on your card. Updating the drivers helps a bit sometimes. Or get a better card.

    CPU
    Most likely cause of lag for a ship with so many entities docked is the collision calculations. You can reduce this with have less docked entities. Smaller docked entities. Having an air gap as much as possible around them. The collision calculation uses up CPU so this is limited by the CPU or your computer or the server. There is a setting for the number of threads that starmade uses. Recommended is to set it one less than the number of cores you have. If you have many cores and that setting is a lot less then a lot of your CPU cores are sitting idle while the few being used are being overloaded. But don't set the number of threads to high or it will probably slow you down again.

    Also over time the updates have been reducing lag from various causes. My current ship build was unplayable a few months back and I stopped playing for a bit. Between some bug fixing and optimization done on the game its actually now a breeze to run and I have been playing again.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    I'm not a programmer I only have a basic understanding of this and can be very wrong. Each face of a block that isn't covered is generally rendered then only the ones you can see are shown. Note that docked entites don't count for covering a face of a block each entity is treated separately. Its possible to have so many blocks showing that your video card has issues.
    Block faces are sorted in 6 groups (front, left, right, back, top and bottom) for each entity that can have a unique rotational setting.
    Only 3 of these groups are shown. Only those faces which are not covered. If entities are stopped (not moving on rails), they might count (but I dunno if this is implemented) - that's how I would do it and that's an easy way, unless it is incompatible with some kind of other optimisation.

    Most likely cause of lag for a ship with so many entities docked is the collision calculations. You can reduce this with have less docked entities. Smaller docked entities. Having an air gap as much as possible around them. The collision calculation uses up CPU so this is limited by the CPU or your computer or the server.
    Are collision checks really done via CPU and for every object? Stopping a rail may improve performance.
    I would implement it with ranges (clear, obstruction, clear, obstruction, clear, …) to reduce it to a 2-dimensional check mostly and exclude any object that has not moved relative to the dock.

    Actually, checking it on the GPU might be straight-forward as it's a transition of block-edges and borders into a rotated grid and the GPU also handles image rotations.

    My current ship build was unplayable a few months back and I stopped playing for a bit. Between some bug fixing and optimization done on the game its actually now a breeze to run and I have been playing again.
    Really? I remember to play the game with 22 FPS average and now I get 8-12 FPS even locally (single-player).

    Even if I could play, block rotation and the flashlight either does not work at all (simple lightening) or the flashlight hides the entity you are aligned to and nearby entities in range of the flashlight (unchecked simple lightening).
    Block-rotation works for full-blocks only, partial blocks have no indicator how they are or get rotated until you place them (which is an annoying trial+error and leads to various accidental deletions of blocks because of the 8-12 FPS and because it takes 0.5 to 1 second to update shown blocks - even if just one is updated)

    Improvement?
    I think block update rate got reduced 8x in speed when chunks changed 16^3 to 32^3 (only a guess though).
    And I have no idea where the low FPS come from when I played around a lot with settings and even looked into older config files for hints what I can re-do.
    Before I will play again, some big lagfixing must still happen.
     

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    It sounds like one should generally shoot for less than 100 entities as a rule of thumb.
     
    Joined
    Jan 19, 2015
    Messages
    364
    Reaction score
    87
    3 turrets each side(6 sided shape) is enough, try to cut down on logic doors and ramps aswell.
    Most players on my server would fit in the 20-30 mark
     
    Joined
    Dec 14, 2014
    Messages
    745
    Reaction score
    158
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 2
    I've been having a lot of stability issues with Starmade since the Trade system update. I suspect my biggest problem is lack of RAM, I'm running SM on 2GB out of the 8GB my computers has. Oddly enough letting SM have 4 GB makes things worse, I think windows objects to giving half the RAM to one application.

    I plan on upgrading my computer to 16 or 32 GB of RAM in September, but that will require saving a bit of money.

    Another thought I had is that maybe my current build has too many docked entities?

    It's a roughly 325m long 50k Mass ship with 7 main turrets, 11 secondary turrets, and 40 AMS turrets, one elevator and a pair of small shuttles. So 119 docked entities total, and that is probably going to go up to 121 once I put in a pair of docked reactors.

    Am I pushing SM too far until I get my system upgraded? And would this be a ship that is safe to bring onto a multiplayer server?
    Docked entities themselves aren't so much the issue.
    Two primary docked system which really increase the work load are those with AI and those with logic and beam systems.
     
    Joined
    Jan 27, 2016
    Messages
    169
    Reaction score
    195
    Fair enough, part of building the ship I'm building was to see what I can get away with. I'll consolidate the AMS system from 40 down to 20ish and see what happens. I kind of wanted to switch over to a twin barrel design anyways, I'm not sure if it's true or not, but it seems like multi barrel AMS turrets work better then the cute little single barrel Portal-esque guys I have covering my ship right now.
     

    Dr. Whammy

    Executive Constructologist of the United Star Axis
    Joined
    Jul 22, 2014
    Messages
    1,789
    Reaction score
    1,723
    • Thinking Positive
    • Likeable Gold
    • Legacy Citizen 9
    Does it change anything to activate "stop moving on rails" for all these torpedoes?

    I've made a 64-round torpedo launcher before the rail update with 8x8 cores and 2 warheads per core using the old docking system.
    It would be the size of 16x16 and launch them in 2 or 4 steps (checker-board pattern and checker-board squared).

    I hope that the same can be archived with rails. Maybe I can test that as it does not require orientated blocks (which are currently blind-placement for me).
    My launcher has a rail speed controller set to zero as a 'safety' mechanism. Even on 'safe mode', it still shot everyone's ping to into the quintuple digits. I had to jettison the launcher and destroy it with cannon fire to get rid of the lag.

    I don't know if it's the number of docked entities or something else. It may actually be the number of entities within each other's bounding boxes. The same thing happened when trying to dock a frigate without the launcher (43 cores) to my bases. This happened with planetary bases as well as my mobile station assemblies. As soon as the frigate entered the base's bounding box (which is difficult to properly interpret) we had a massive lag spike until the ship docked. Undocking had a similar effect until I was about 500-1000 meters away.

    Shine needs to do something with these insane collision checks as they make the game nearly unplayable for people who build carriers, transports, torpedoes or anything with a strong AMS defense.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    Perhaps make collision checks chunk-corner -dependent to avoid collisions of small objects with each other.
    Every rotating entity (such as ships and entities on rotator-rails) would need such a grid for sub-entities,
    • but there can be the exception of one sub-entity-level could be forwarded to the own grid if the own rotation and sub-entity-length + docking offset doesn't allow a radius >=32m (like with anti-missile guns).

    Entities register to the 8 corners of the junk they are in.
    O–––0–––O When they switch chunks, they unregister at 4 corners and register at 4 corners 2 corner-points away.

    |X .|. X| Only entities sharing a corner can collide.
    O–––0–––O This works reliable for all entities <=32 blocks in size (such as torpedoes and some anti-missile turrets).

    This should do at max 8 collision checks with each other
    • which can be avoided if lower IDs collide with higher IDs
    • and higher IDs keep a record on the last lower ID which checked against them to avoid duplication

    But there would not be any checks on non-adjacent objects with 1 chunk between them.
     
    Last edited: