Unlimited chunk load rate (#6768)

This commit is contained in:
Hannes Greule 2021-10-16 03:54:46 +02:00 committed by GitHub
parent 5344798579
commit 3f2159e43c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 19 deletions

View file

@ -298,7 +298,7 @@ index 0000000000000000000000000000000000000000..bee2fa2bfbb61209381f24ed6508d3d1
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..a632a796a3e5f2b361a521d70581b83a6839fc73
index 0000000000000000000000000000000000000000..24c6f957aaf1f4064718b05d4e5f5759853c6f00
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +1,185 @@
@ -364,8 +364,8 @@ index 0000000000000000000000000000000000000000..a632a796a3e5f2b361a521d70581b83a
+ commands = new HashMap<String, Command>();
+ commands.put("paper", new PaperCommand("paper"));
+
+ version = getInt("config-version", 22);
+ set("config-version", 22);
+ version = getInt("config-version", 23);
+ set("config-version", 23);
+ readConfig(PaperConfig.class, null);
+ }
+

View file

@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..d0211d4f39f9d6af1d751ac66342b42c
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 86e16e39a9a996669989d990b76f69116bcee300..f1034cfb63ea37c22e67b5d4a18214774f208de2 100644
index e9954fa75412a7077950e3813af4b201c084f68f..f4b1eb512defda8523ddaba054bde744a4aaeb32 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -69,6 +69,7 @@ public class PaperConfig {
@ -84,8 +84,8 @@ index 86e16e39a9a996669989d990b76f69116bcee300..f1034cfb63ea37c22e67b5d4a1821477
commands.put("paper", new PaperCommand("paper"));
+ commands.put("mspt", new MSPTCommand("mspt"));
version = getInt("config-version", 22);
set("config-version", 22);
version = getInt("config-version", 23);
set("config-version", 23);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 026397cbedd2d1cd08ec8a82a3468f35cd8e4765..74051c9b620516dc2f302b1595e74faf91519962 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java

View file

@ -22,7 +22,7 @@ chunk-loading:
target-player-chunk-send-rate: 100.0
global-max-chunk-send-rate: -1
enable-frustum-priority: false
global-max-chunk-load-rate: 300.0
global-max-chunk-load-rate: -1.0
player-max-concurrent-loads: 4.0
global-max-concurrent-loads: 500.0
```
@ -58,7 +58,7 @@ because the client can bug out due to the out of order
chunk sending.
global-max-chunk-load-rate - The maximum chunk load rate
for the whole server.
for the whole server. -1 means no limit
player-max-concurrent-loads and global-max-concurrent-loads
The maximum number of concurrent loads for the server is
@ -80,10 +80,10 @@ index cfe293881f68c8db337c3a48948362bb7b3e3522..7d44abcb4fff9717a1af55879deb7eb9
}));
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index bc4081483a228aa275511d28231d615fe0f36d4e..be132f9d683767002a3e7f5641cb3cc3db74464c 100644
index efe964caada458a34c58a0396cc7e3321c58e404..98288f83d1276a47ad3335153aee5c7ea9a5e451 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -522,4 +522,26 @@ public class PaperConfig {
@@ -522,4 +522,29 @@ public class PaperConfig {
itemValidationBookAuthorLength = getInt("settings.item-validation.book.author", itemValidationBookAuthorLength);
itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength);
}
@ -105,14 +105,17 @@ index bc4081483a228aa275511d28231d615fe0f36d4e..be132f9d683767002a3e7f5641cb3cc3
+ playerTargetChunkSendRate = getDouble("settings.chunk-loading.target-player-chunk-send-rate", 100.0);
+ globalMaxChunkSendRate = getDouble("settings.chunk-loading.global-max-chunk-send-rate", -1.0);
+ playerFrustumPrioritisation = getBoolean("settings.chunk-loading.enable-frustum-priority", false);
+ globalMaxChunkLoadRate = getDouble("settings.chunk-loading.global-max-chunk-load-rate", 300.0);
+ globalMaxChunkLoadRate = getDouble("settings.chunk-loading.global-max-chunk-load-rate", -1.0);
+ if (version < 23 && globalMaxChunkLoadRate == 300.0) {
+ set("settings.chunk-loading.global-max-chunk-load-rate", -1.0);
+ }
+ playerMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.player-max-concurrent-loads", 4.0);
+ globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0);
+ }
}
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
new file mode 100644
index 0000000000000000000000000000000000000000..b3da5ec6701448a4b273c86aff9c64e3d75e5885
index 0000000000000000000000000000000000000000..4eadc15f747528b59349f095171dd5a649a46ed9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
@@ -0,0 +1,989 @@
@ -701,7 +704,7 @@ index 0000000000000000000000000000000000000000..b3da5ec6701448a4b273c86aff9c64e3
+ // priority > 0.0 implies rate limited chunks
+
+ final int currentChunkLoads = this.concurrentChunkLoads;
+ if (currentChunkLoads >= maxLoads || (TICKET_ADDITION_COUNTER_SHORT.getRate() >= PaperConfig.globalMaxChunkLoadRate || TICKET_ADDITION_COUNTER_LONG.getRate() >= PaperConfig.globalMaxChunkLoadRate)) {
+ if (currentChunkLoads >= maxLoads || (PaperConfig.globalMaxChunkLoadRate > 0 && (TICKET_ADDITION_COUNTER_SHORT.getRate() >= PaperConfig.globalMaxChunkLoadRate || TICKET_ADDITION_COUNTER_LONG.getRate() >= PaperConfig.globalMaxChunkLoadRate))) {
+ // don't poll, we didn't load it
+ this.chunkLoadQueue.add(data);
+ break;

View file

@ -24,10 +24,10 @@ and an action can be defined: DROP or KICK
If interval or rate are less-than 0, the limit is ignored
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index be132f9d683767002a3e7f5641cb3cc3db74464c..4d6d07627bd3cbb7041f5c1e19fa03cb0a301268 100644
index 98288f83d1276a47ad3335153aee5c7ea9a5e451..448def89819e8263fda5902be508dcf9789dbf3c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -544,4 +544,102 @@ public class PaperConfig {
@@ -547,4 +547,102 @@ public class PaperConfig {
playerMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.player-max-concurrent-loads", 4.0);
globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0);
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Lag compensate block breaking
Use time instead of ticks if ticks fall behind
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 4d6d07627bd3cbb7041f5c1e19fa03cb0a301268..b0ea9aefb6e652388becb79d4b19433fe3717c87 100644
index 448def89819e8263fda5902be508dcf9789dbf3c..31662010b1c3d3fb9f667afd13e33e0a35005867 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -642,4 +642,10 @@ public class PaperConfig {
@@ -645,4 +645,10 @@ public class PaperConfig {
}
}
}

View file

@ -9,10 +9,10 @@ Configurable under
`send-full-pos-for-hard-colliding-entities`
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index b0ea9aefb6e652388becb79d4b19433fe3717c87..f421e6a2e43e0a673dbb8a9a2b4331387e523e02 100644
index 31662010b1c3d3fb9f667afd13e33e0a35005867..b3f4ac2ce6f515e406d2f31b1d2429729c9e2b60 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -648,4 +648,10 @@ public class PaperConfig {
@@ -651,4 +651,10 @@ public class PaperConfig {
private static void lagCompensateBlockBreaking() {
lagCompensateBlockBreaking = getBoolean("settings.lag-compensate-block-breaking", true);
}