[REQ]Viewing Distance

Discussion in 'Archived: Plugin Requests' started by imaxorz, Dec 14, 2011.

  1. Offline


    Suggested name: ViewingDistanceChange

    What I want: It would be nice to have a plugin that let's you change the viewing distance (specified in server.properties) file without having to restart your server. Most larger servers have their viewing distance set to a lower number since that significantly reduces lag when a lot of players are connected to the server. However sometimes when you are trying to do certain big builds or are trying to make a video or just take screen shots the short viewing distance ruins the experience as the chunks that aren't too far unload when you get back so far.

    To take a step further it would be great to have the plug in automatically change the viewing distance to a specified number in the config. It can check the amount of players connected every time someone joins/leaves the server and then adjust the viewing distance accordingly.

    Example Config
    #players online = viewing distance
    1-10 = 15
    11-20 = 10
    21-30 = 8
    31-40 = 6
    41-50 = 5
    51-60 = 4
    60-99 = 3

    To be honest I don't even know if this is even possible without restarting the server, but I thought I would post it here anyway :) Maybe it's possible and/or easier if the server is also running Spout as that allows for more modifications?

    Ideas for commands: /viewing distance (3-15), /viewing dist (3-15)

    Ideas for permissions: viewsing.distance.change

    Willing to pay donate up to: $20

    When I'd like it by: No rush, nothing that's absolutely needed, but I feel like it would be welcomed by a lot of server admins.

    Similar plugin requests: http://dev.bukkit.org/server-mods/dynamic-view-distance/ [Never got finished]

    Devs who might be interested in this: No idea.
  2. Offline


    Mind if I ask: why did you cross out "pay" and replace it with "donate"?
  3. Offline


    I don't exactly have money to pay anyone to code anything, but I would give them at least something just because they helped.
  4. Offline

    Deleted user

    This is impossible to do.
    The viewing distance is strictly CLIENT-SIDE. Plugins only control things SERVER-SIDE.
    Sorry to break it to you.
  5. Offline


    Look in server.properties file. You can adjust the viewing distance, which is how many chunks the server loads around each player regardless on what the client side viewing distance is set to.

    If you have it set at 15, it will load 15 chunks in each direction around a player, even if they have their viewing distance set to "tiny." All that means is the fog is closer to the player, but those 15 chunks are still loaded all around them.

    Sorry to break it to you.
  6. Offline


    I think that value is considered read-only (getServer().getViewDistance()). But you could get the chunks around a player and forcibly load them. Probably with player.getWorld().loadChunk() for an individual one. Just would take a little bit of math to do an area.
  7. Offline


    @ShootToMaim You are wrong.
    @imaxorz You are right.
    @skore87 Loading a chunk like that won't allow the player to see it. Get on a busy server with a small view distance. Even though chunks are loaded by the server hundreds of blocks in all directions, you'll only be able to see as far as the server has set your view-distance.

    Anyway, that said, this is a pretty good idea for a plugin. I'm not sure if it's possible without modifying CraftBukkit itself, but I'll take a stab at it.

    ((CraftServer)this.getServer()).getHandle().server.worlds.get(0).manager.f = distance;
    That almost works, but alas, the f variable is private, so it's only possible to do it via a change to the CraftBukkit code itself, and that would be too much of a pain to maintain for such a small feature.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 22, 2016
    imaxorz likes this.
  8. Offline


    Finally someone understands exactly what I mean. Thank you.

    Maybe this can even be suggested to the Bukkit team? I think it is beneficial enough that they might actually be interested in it?
  9. Offline


    I am also interested in this feature. This way a plugin can be made that changes the viewdistance in accordance to cpu / network load. Maybe its an idea to add some mechanism to obtain these values too. (server upstream / downstream rate) and cpu load as imput for the viewdistance policy
  10. I think it's a good idea. When CraftBukkit isn't fast then the Bukkit team should add it so the servers become faster.
  11. Offline


    I know that the thread is old but I also need that plugin. :)
  12. Offline


  13. Offline


Share This Page