Ships

Ships

123k Downloads

Optimization problems with changing speeds on [Move]

ColonelKai opened this issue ยท 5 comments

commented

I love the way you designed the actual movement so that it doesn't lag the server, my 2.300 block ship didn't decrease the TPS a bit.

But you know what lags the server? Changing the speed on [Move]. I don't understand why, probably can be fixed, idk, i haven't gotten around to read your code, you haven't put a single comment, which, is not a bad thing, its just that it makes it harder to understand what the fuck is going on.

When i change speed, (shift right click or right click) with a big ship such as mine, it temporarily can bring the TPS down to single digits, even below 5.

Its really short term lag, and keeps going on for like, as long as you're changing the speed (which, because TPS is low the signs don't also accurately show the speed you changed into, which causes you to set wrong speeds, so to correct it you can cause even more lag, bruh.) and thus doesn't show up on /tps, and i was only aware that it fell down to 3-4 TPS due to the anticheat flagging everyone and displaying the current TPS.

commented

I know this is like my second bug report in couple days but i love this plugin and wanna help it become spotless, i guess.

commented

Hey. I am yet to try this out on a big ship so cannot confirm the issue, however I will take your word.

The optimization you asking for would be in the ShipsOvertimeUpdateBlockLoader class (yes im aware its a horrible name) which is used to locate the ship by searching all blocks around you for a licence sign. Due to this being the "Overtime" varient it uses the overtime code which is the code that shouldnt lag the server when attempting to find the ship.

This is actually the same class used to find the ship to move it as well, meaning that you should be experiencing some lag when attempting to move? Right? If not then it could be a inefficiency within Core itself.

Could I ask for your config data, in particular the "advanced block finder".

Oh and as for no comments, thats not true, there are some. Just a rare occurrence ;)

In all honesty I didnt want to put comments up until the Sponge API 8 was finalized as things within Core could have changed dramatically, leaving Ships to adapt its code.

As for issues, keep them coming. I rather it be working to a good+ degree then fix bugs down the road

commented

It's not when I'm trying to move it, it's when i right click (or shift right click) on the [move] sign to change the speed.

It does not lag on the smaller ships, only on bigger ships.

Advanced:
  Movement:
    Default: ships:movement_ships_six
    Stack:
      Limit: 10
      Delay: 1
      DelayUnit: MINECRAFT_TICKS
  BlockFinder:
    Default: ships:blockfinder_ships_five
    Track: 4000
    Stack:
      Delay: 1
      DelayUnit: MINECRAFT_TICKS
      Limit: 7
  EntityFinder:
    Stack:
      Limit: 75
Auto:
  EOT:
    Speed: 2
    Delay: 1
    DelayUnit: SECONDS
    Enabled: false
  Falling:
    Speed: 1
    Delay: 1
    DelayUnit: MINUTES
    Enabled: false
Bar:
  Visible: true
Movement:
  Requirements:
    Check:
      Max:
        BlockType: false
Structure:
  Update:
    Auto: true
    Click: false
Update:
  Enabled: true
AlphaOnly: 
  Command:
    UseLegacy: true
Sign:
  Licence:
    Fourth:

ps. ShipsOvertimeUpdateBlockLoader is not a bad class name, though "Ships" part is kinda not required since the plugin is literally called Ships. I think OvertimeUpdateBlockLoader would be a better name.

commented

It was labelled Ships as it returns a ship (Vessel) value.

As for what seems to be the issue, the Ships 5 block finder algorithm does not support overtime and this is likely whats causing the issue. Not sure why there isn't any lag on movement though. Maybe some other code is causing the lag ... but looking at it, its not likely. Maybe the movement part is cached by the processor itself?

Try changing the block finder algorithm to Ships 6 (its slower but doesn't lag)

BlockFinder:
    Default: ships:blockfinder_ships_six

You can speed both the movement and the block finder up if your server can handle it by increasing the "limit" if you find it too slow.

commented

Fixed in beta 11.2