View Distance Tweaks [1.14-1.16] 1.2.2

Dynamic per-world view distances, giving a better balance of gameplay and performance.

  1. froobynooby
    Native Minecraft Version:
    1.15
    Tested Minecraft Versions:
    • 1.14
    • 1.15
    • 1.16
    Source Code:
    https://github.com/froobynooby/ViewDistanceTweaks
    View Distance Tweaks
    Dynamic per-world view distances, giving a better balance of gameplay and performance.


    This plugin will dynamically adjust the view distance of each world in order to meet a condition: You can either set a threshold for the total number of chunks you want to be loaded at any given time, or set thresholds for the server's TPS. You can also set minimum and maximum view distances for each world. In effect, this means higher view distances with lower player counts, and lower view distances with higher player counts.

    Installation
    To install the plugin simply place the downloaded jar file into your server's plugin directory.

    Since different servers have different capabilities / preferences, you will be required to configure the plugin before it is enabled. To configure the plugin, edit the config.yml which is found in the ViewDistanceTweaks folder within your server's plugin directory. When you are happy with the changes you have made you can set the 'enabled' option in the config.yml to true and restart or reload the server.

    Configuration
    There are many things to configure:
    Code (YAML):
    # Configuration for View Distance Tweaks.
    # Plugin page: https://www.spigotmc.org/resources/75164/
    # Github: https://github.com/froobynooby/ViewDistanceTweaks

    # Please don't change this!
    version
    : 2

    # Set this to true to enable the plugin. The plugin is initially disabled so that you can make changes to the config
    # appropriate to your server.
    enabled
    : false

    # How should we determine whether the view distance needs adjusting? Accepts three values:
    #  * proactive : Adjust the view distance so that the player-loaded chunk count is always below a set threshold.
    #  * reactive  : Adjust the view distance in response to changes in the server's TPS.
    #  * mixed     : Be both proactive and reactive; prioritising decreasing the view distance over increasing.
    adjustment-mode
    : mixed

    # These settings are for the proactive adjustment mode.
    proactive-mode-settings
    :
     # Set this to the maximum chunk count your server can handle. The view distance of each world will be adjusted such
      # that the total number of player-loaded chunks is sitting as close to this value as possible.
      #  * If you know your server can handle up to p many players with a view distance of d, a reasonable choice is to set
      #    this to (2d + 1)^2 * p.
      #  * As an example, 5780 is the number of player-loaded chunks for 20 players with a view distance of 8.
      global-chunk-count-target
    : 5780

    # These settings are for the reactive adjustment mode.
    reactive-mode-settings
    :
     # Above what TPS should we consider increasing the view distance?
      increase-tps-threshold
    : 19.9

      # Below what TPS should we consider decreasing the view distance?
      decrease-tps-threshold
    : 18.0

      # These settings concern how we determine the TPS.
      #  * Only touch these settings if you know what you're doing.
      tps-tracker-settings
    :
       # Over how many ticks should we collect tick durations for calculating the TPS?
        #  * Setting this too high will make the TPS very slow to react to changes.
        #  * Setting this too low will make the TPS volatile.
        collection-period
    : 1200

        # By how much (in percent) should we allow the tick durations we use to calculate the TPS vary from the average
        # tick duration.
        #  * This is used for smoothing the TPS; making sure it's not heavily affected by sudden large lag spikes, such as
        #    those caused by garbage collections or world-saves.
        #  * Setting this to 0 will mean your TPS will never change - don't do that.
        trim-outliers-to-within
    : 100.0

      # We keep a history of TPS vs. player-loaded chunk count in order to better predict what the TPS will settle to after
      # increasing the view distance.
      tps-prediction
    :
       # Should we use TPS prediction when we are considering increasing the view distance?
        #  * For example, we may be at 20 TPS with a view distance of 6, meaning we would consider increasing the view
        #    distance to 7. However, if we saw that 10 minutes ago with a view distance of 7 we had 17 TPS, we would hold
        #    off on increasing.
        #  * Disabling this can lead to a back-and-forth game of increasing and decreasing the view distance every few
        #    minutes - not ideal.
        enabled
    : true

        # For how long (in minutes) should we keep a TPS / chunk count history?
        history-length
    : 30

    # Every how many ticks should we check whether the view distance needs to be updated?
    ticks-per-check
    : 600

    # How many checks in a row that say to increase the view distance should be required before the view distance is
    # actually increased?
    #  * This is useful as it guards against the following kind of case: A player leaves and the view distance is increased,
    #    but the player returns three minutes later and the view distance is lowered to its previous value.
    #  * Since increasing the view distance can cause lag-spikes for players with poorer connections, it is recommended to
    #    keep this value relatively high.
    passed-checks-for-increase
    : 10

    # How many checks in a row that say to decrease the view distance should be required before the view distance is
    # actually decreased?
    passed-checks-for-decrease
    : 1

    # Should we send a message to the console when we change the view distance?
    log-view-distance-changes
    : false

    # These settings can be specified per world. If a world is not specified or if a setting is missing, it will use the
    # settings listed under the default section.
    world-settings
    :
      default
    :
       # What should the absolute minimum view distance be in this world?
        minimum-view-distance
    : 6

        # What should the absolute maximum view distance be in this world?
        maximum-view-distance
    : 12

        # Relative to the other worlds, how 'heavy' is a chunk on performance?
        #  * For example: In the End dimension, about half of the chunks you encounter are void and so have very little
        #    impact on performance. For this reason, you may want to set the chunk-weight of the End to 0.5.
        chunk-weight
    : 1

        # These settings concern how we count the number of chunks in this world.
        chunk-counter-settings
    :

          # When two players are near each other, their view distances can overlap. Should we not double count the chunks
          # that are overlapping?
          exclude-overlap
    : true

    #  world_the_end:
    #    minimum-view-distance: 8
    #    maximum-view-distance: 10
    #    chunk-weight: 0.5

    # These are additional settings that apply if you are using Paper as your server software.
    paper-settings
    :
     # These settings concern the no-tick view distance available in Paper 1.15.2+.
      #  * Note: higher no-tick view distances are less heavy on the server as far as TPS goes. For this reason, there is no
      #    option to adjust no-tick view distance based on TPS.
      no-tick-view-distance
    :
       # Should we adjust the no-tick view distance?
        enabled
    : true

        # Set this to the maximum number of chunks you want to be loaded by the no-tick view distance.
        #  * Note: this only counts chunks that are outside of the standard view distance of a player, but within the
        #    no-tick view distance of a player.
        #  * If you know your server can handle up to p many players with a no-tick view distance of n and a standard view
        #    distance of d, a reasonable choice is to set this to ((2n + 1)^2 - (2d + 1)^2) * p.
        #  * As an example, 6720 is the number of chunks loaded by the no-tick view distance for 20 players with a no-tick
        #    view distance of 12, and a standard view distance of 8.
        global-chunk-count-target
    : 6720

      world-settings
    :
        default
    :
         # What should the absolute minimum no-tick view distance be in this world?
          minimum-no-tick-view-distance
    : 8

          # What should the absolute maximum no-tick view distance be in this world?
          maximum-no-tick-view-distance
    : 16
     

    Compatibility
    This plugin will not work with CraftBukkit - you must be using Spigot (or a fork of Spigot). Due to changes in the chunk system, it is not viable to add support to versions under 1.14.

    Commands
    To access the base command, users will need the viewdistancetweaks.command.vdt permission node.

    /vdt reload - Reload the plugin's configuration.
    Permission: viewdistancetweaks.vdt.command.reload

    /vdt status - Display information about the worlds' view distances and more.
    Permission: viewdistancetweaks.vdt.command.status

    /vdt set <view distance> [world] [--duration <minutes>] - Set the view distance of the given world (all worlds is not specified) for the given duration.
    Permission: viewdistancetweaks.vdt.command.set

    /vdt set-no-tick <view distance> [world] [--duration <minutes>] - Set the no-tick view distance of the given world (all worlds is not specified) for the given duration.
    Permission: viewdistancetweaks.vdt.command.set-no-tick



    Metrics
    This plugin uses bStats to collect some (non-identifying) data about the servers running this plugin. You can opt-out by editing the config.yml in the bStats folder located within your server's plugin directory.
    [​IMG]

Recent Reviews

  1. R00t
    R00t
    5/5,
    Version: 1.2.2
    Though view distance wasn't the primary reason, as to why the server's performance was degrading, this still benefitted the server by a decent bit, as to why I wanted to make this post.

    Even if it seems like this resource may not do you much good, use it anyways. It makes it in the long run if you're achieving an exponential amount of users.
  2. dllicious
    dllicious
    5/5,
    Version: 1.2.1
    WOW! I can't believe I didn't know about this plugin before.
    An absolutely necessary addition for any survival world!
  3. Parrothead
    Parrothead
    5/5,
    Version: 1.2.0
    Fantastic plugin with a ton of configuration options. I have already noticed sizeable performance improvements on my server already!
  4. Danrique
    Danrique
    5/5,
    Version: 1.1.2
    Fantastic! Everyone should have this! Its so awesome! This is MUCH better to control lag than many others plugins! It really give you the best experience with the machine you have!
  5. __Vekster007__
    __Vekster007__
    5/5,
    Version: 1.1.2
    A wonderful plugin for its idea and very much in its implementation! I just can't spoil the rating by putting it below 5 stars, but I hope to fix existing errors that can even lead to crashes, and if possible, which is important for all projects after tests-optimization.
  6. HydricAcid
    HydricAcid
    5/5,
    Version: 1.1.2
    great plugin for balancing looks with performance dynamically, works great on my server

    definitely will install on any server(s) I have in the future
  7. wangmeng
    wangmeng
    5/5,
    Version: 1.1.2
    Very good plug-in. I passed the test on 1.15.2. I hope another 1.12.2 server can also be used!
  8. UncleLin
    UncleLin
    5/5,
    Version: 1.1.2
    Great plugins, just as good as your previous plugins!
    ---------------------------
  9. Benwyw
    Benwyw
    5/5,
    Version: 1.1.1
    I can see a significant performance boost after installing this, it provides a dynamic view distance with lots of features, recommended.
  10. Akiraa
    Akiraa
    5/5,
    Version: 1.1.0
    Have discord Support? I need a better config for server, please reply :) I like this plugins but in PaperMc Group Aikars say you need to change API from your plugins because this make Conflic!
    1. froobynooby
      Author's Response
      Hey, thanks for the review!

      I don't have a support discord, but if you need help with configuration I'd be happy to help you out in the discussion thread

      This plugin actually uses Paper's API for setting view distance and no-tick view distance. I think I actually saw the conversation that was being had in Paper's discord, and I'm pretty sure people were confusing this plugin with ExtendedViewDistance