Map limit problem

Discussion in 'Spigot Discussion' started by BitterCynic, Nov 23, 2016.

  1. The server i play on has an unusual problem that i hope is possible to solve. Ideally i would forward a solution to the server owner if he doesn't find a fix on his own.

    The problem is simple, the maximum map limit of around 32k has been reached and i believe that the only acceptable solution to this problem is going to be by increasing the map limit.
    Afaik the server does have spigot mostly for performance optimizations.

    A couple of questions then.
    Can the map limit be increased?
    Would it be possible to add a no cheat like element that prevents spamming new maps? For example each player can only make 6 maps per hour.
  2. What do you mean? The size that each map can be or the total maps in a server?

    If the former:
    Maps can probably be increased with a plugin or server-side mod, but maps would be a lot less useful at that size as the pixelation limit can hardly be changed, and you wouldn't be able to discern anything really.
    Tl;Dr: just don't.

    If the latter:
    A map limit of that size is already extremely large, and increasing it anymore would cause significant decreases in server performance. Each map is contained within its own file at world/data/map_#.dat When a large amount of these map files appear, say 32k, the amount of storage is taken over by solely maps, and it is very difficult for the server to parse through all those files looking for the map requested.
    Tl;Dr: if you want to break everything
  3. Total maps. Wouldn't it be possible to create a separate cache of frequently viewed maps? Most of the existing ones will never actually be seen ever again...
    And what about the anti map spam to prevent abuse that leads to this kind of problem? Is it feasible to limit item use like that?
  4. I'm playing on the same server, and I'm here to bump an issue. Even though maps have been reset today on a server, I believe it's a question of day or two until the situation repeats.

    Basically, the claim is that a lot of small files in the same folder lead to rapid onset of performance issues, and that's true. Most filesystems are not supposed to support this. The proper solution would be to store map data in sqlite database. But there is also a very simple solution on top of FS: prefix folders. The world/data folder should contain map_## folders, which contain map_##$$$.dat files. There is a lot of known software products that use this approach. For example, git.
  5. I believe the main problem is that the damage value of items is stored as a short, and therefore limited to a maximum number of 32,767. I therefore doubt it can be changed, as the client wouldn't support numbers any greater, even if there was a better way of storing them.

    Also, this is quite an old post :p
    • Agree Agree x 1
  6. This plugin caps the number of maps a player can render per day, effectively ensuring the limit will never be reached:

    Its difficult to purge maps once the limit is reached. You'd have to edit the idcounts.dat and the 32 thousand map.dat files which use Mojangs own NBT... You are far better off ensuring it never becomes an issue. Sorry if this isn't an appropriate to post resource links but it is directly relevant ;) Will happily delete if necessary.
  7. You could iterate through the maps and check if there are doubles and delete them.
  8. Yes it is certainly possible! But unfortunatley maybe not as simple as it sounds. The idcounts.dat file tracks the total number of maps and increments in order...regardless of what maps already exist. So pruning maps means the count in the idcounts.dat file needs to be updated AND the existing 32 thousand map files need to be changed. Due to how the idcounts.dat file works remaining maps need to have their numbers updated in chronological order else they will be overwritten. That might be as simple as renaming the map.dat files, but I'm not sure if you'd also have to edit the NBT data within them. I also don't think changing the NBT data of the map.dat would even impact the maps players have in-game... my guess is that in-game maps just reference the NBT file, so changing the file would just break the map. You'd have to find all the map items in game and change their data as well to point to the correct map.dat file... So you can see how complicated it gets.Ideally the issue would be avoided in the first place!

    It doesn't help that NBT is Mojang's own standard, but it makes for an interesting coding challenge for sure!
    #8 FakeSaint, Jul 12, 2018
    Last edited: Jul 12, 2018
  9. Not hard to read the NBT however, it's not that hard to do, even easier if you use the classes mojang uses

Share This Page