Dylan K. Taylor
89cce4c749
performance: only calculate light for chunks inside ticking areas
...
this produces a major performance improvement for large render distances, and reduces the impact of lighting calculation to zero on servers which have random blockupdates turned off.
2020-09-26 13:13:12 +01:00
Dylan K. Taylor
03de2bcc67
Chunk: simplify heightmap calculation
2020-09-08 23:03:52 +01:00
Dylan K. Taylor
0fd3d91038
LightArray: hide constants ZERO and FIFTEEN from the API
...
this makes it easier to implement this in C++ with the same API. Since the C++ version doesn't use strings, these constants aren't needed anyway.
2020-09-08 15:13:58 +01:00
Dylan K. Taylor
01f8116cdd
Fix some of the implicit immutability issues of EmptySubChunk
...
it's useful to have an immutable stub around for the sake of feeding back dummy read values, but for write values it has to barf instead of being quiet.
There's still some issues with LightArray which I don't currently have a solution for, but I'm thinking about separating light storage from chunks anyway.
2020-09-07 14:43:26 +01:00
Dylan K. Taylor
5fbc842f7a
LightArray: do not accept NULL in the constructor
...
it makes more sense to pass LightArray::ZERO or just use LightArray::fill(0) if a zeroed light array is desired.
2020-09-06 16:18:47 +01:00
Dylan K. Taylor
6b6f77f8af
Chunk: improved heightmap calculation performance
...
recalculateHeightMapColumn is stateless, so it can't make any assumptions about which subchunks to check for blocks. However, in most the average case (6 allocated subchunks), this causes 2500+ useless SubChunk->getHighestBlockAt() calls (10 per column). Since we're calculating in bulk, we can figure out which subchunks are empty one time and ignore them for all 256 columns.
In the average case, this produced a 50-60% performance improvement for heightmap calculation (~1.1 ms -> 0.5 ms).
In extreme cases where the height is extremely varied, this produces no observable performance benefit, but for most cases with flattish terrain, it's an improvement.
It can likely be further improved, but further performance improvements are outside the scope of this commit and will likely result in more complexity increases.
2020-09-05 00:16:07 +01:00
Dylan K. Taylor
e1816bd415
SubChunkInterface: clarify documentation of isEmptyFast()
2020-09-04 22:10:42 +01:00
Dylan K. Taylor
a68b0b1f93
LightArray: make collectGarbage() more preload-friendly
...
opcache preloading doesn't store non-class constants, but it does store class constants. Class constants that reference non-class constants are pre-resolved into values before storing in opcache SHM, so class constants are OK to use, but non-class constants will come back as undefined.
2020-09-04 17:23:23 +01:00
Dylan K. Taylor
b81cc671e9
Major performance improvement to basic sky light calculation
...
this was degraded whenever it was I decided to make chunks always be allocated. This commit uses a fast path for light filling in subchunks which are completely clear of the heightmap, which returns the performance back to its old fast levels.
2020-09-04 15:51:33 +01:00
Dylan K. Taylor
279abb871d
Remove all usages of CompoundTag->hasTag()
...
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
Dylan K. Taylor
a5d77d5106
LevelDB: remove unused function
2020-07-08 23:24:54 +01:00
Dylan K. Taylor
0188323d74
fixed a bunch of NBT-related phpstan level 8 errors
2020-07-05 21:01:13 +01:00
Dylan K. Taylor
a2677eba02
Merge commit 'f3063e797fab56ff8d0213c8e5a3904085a6eb79'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/level/format/io/ChunkUtils.php
2020-06-17 20:43:30 +01:00
Dylan K. Taylor
d2130265f8
Merge commit '8dcc88712c6b8a4d4a0c6be2f6b908ae85378209'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/level/format/io/ChunkUtils.php
# tests/phpstan/configs/l7-baseline.neon
2020-06-17 20:42:28 +01:00
Dylan K. Taylor
506f98efc4
Eliminate usages of BaseNbtSerializer->readCompressed() and BaseNbtSerializer->writeCompressed()
2020-06-17 14:31:56 +01:00
Dylan K. Taylor
c618932d25
Eliminate usages of BinaryStream->setBuffer() and BinaryStream->reset()
2020-06-17 13:49:43 +01:00
Dylan K. Taylor
7d73630fb7
Merge branch 'stable'
...
# Conflicts:
# resources/vanilla
# src/world/format/io/region/RegionGarbageMap.php
# src/world/format/io/region/RegionLoader.php
# tests/phpstan/configs/l7-baseline.neon
# tests/phpunit/world/format/io/region/RegionLocationTableEntryTest.php
2020-06-15 20:10:15 +01:00
Dylan K. Taylor
0d186fe42c
Merge commit '725506510'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/level/format/io/leveldb/LevelDB.php
2020-06-13 11:55:10 +01:00
Dylan K. Taylor
c93038f574
Inject WorldProviderManager to WorldManager's constructor, no longer singleton
2020-05-24 19:22:04 +01:00
Dylan K. Taylor
437e4d75ab
WorldProviderManager: use $this-> instead of self::
2020-05-24 19:16:57 +01:00
Dylan K. Taylor
b05fab3e3c
FormatConverter: do not hardcode progress update interval
2020-05-24 14:30:59 +01:00
Dylan K. Taylor
c95951479c
FormatConverter: beware paths with \ on linux
2020-05-24 14:28:07 +01:00
Dylan K. Taylor
c9af5ce7a9
Convert GeneratorManager to singleton
2020-05-23 10:13:03 +01:00
Dylan K. Taylor
640428c415
Convert WorldProviderManager to singleton
2020-05-23 10:02:09 +01:00
Dylan K. Taylor
b3454b3488
BiomeArray: check lower bounds in ::idx() as well as upper bounds
2020-05-16 18:42:47 +01:00
Dylan K. Taylor
ae6a7b7cc9
imports cleanup
2020-05-16 18:42:08 +01:00
Dylan K. Taylor
88715c7055
extracted a HeightArray type from Chunk
2020-05-16 18:41:27 +01:00
Dylan K. Taylor
a31240f60b
FastChunkSerializer: added constants for internal flags
2020-05-16 18:06:00 +01:00
Dylan K. Taylor
82d361d75f
extract a BiomeArray unit from Chunk
...
this now also properly validates data read from disk.
2020-05-16 17:36:22 +01:00
Dylan K. Taylor
45f9c61d0f
forward-port of 2f47597d75b514944a2f3f5d293f2fb72dd7fb56 as best it fits
2020-05-13 13:28:35 +01:00
Dylan K. Taylor
ac5cf2443e
convert TileFactory to singleton
2020-04-26 01:11:30 +01:00
Dylan K. Taylor
7d9df6af6f
Convert EntityFactory to singleton
2020-04-24 22:43:02 +01:00
Dylan K. Taylor
3a42c21cc1
wrap up block_id_map in a class
2020-04-24 21:28:27 +01:00
Dylan K. Taylor
accc0da0cb
Chunk no longer depends on BlockFactory
...
really this light population crap shouldn't be in the chunk to begin with, but that's a bit more complicated.
2020-04-23 21:31:28 +01:00
Dylan K. Taylor
163c3855eb
Merge branch 'next-minor'
...
# Conflicts:
# resources/vanilla
# src/plugin/PluginBase.php
# src/plugin/PluginDescription.php
# src/pocketmine/Player.php
# src/pocketmine/network/rcon/RCON.php
# src/pocketmine/network/rcon/RCONInstance.php
# src/pocketmine/scheduler/AsyncTask.php
# src/pocketmine/tile/Spawnable.php
# src/scheduler/AsyncPool.php
# src/utils/Config.php
# src/utils/Timezone.php
# src/utils/UUID.php
# src/utils/Utils.php
# src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
Dylan K. Taylor
ca909ebc1d
Merge branch 'next-minor'
2020-03-10 13:05:37 +00:00
Dylan K. Taylor
995309424e
updated pocketmine/nbt dependency
...
this is going to need work on exception handling, but right now it's so inconsistent that it doesn't matter anyway.
2020-03-04 17:53:37 +00:00
Dylan K. Taylor
a633e415ef
FastChunkSerializer: use machine endianness for pack() (thanks @Frago9876543210)
...
this is faster due to not having to reverse bytes. Since we don't use this format for persistence, it's OK to use machine byte order for this.
2020-02-25 15:08:53 +00:00
Dylan K. Taylor
9b6fa8c25b
Merge branch 'stable'
2020-02-11 19:12:39 +00:00
Dylan K. Taylor
d360439c92
FastChunkSerializer: expose a method to disable lighting serialization
...
this is useful for copies which don't care about lighting, such as chunk sending.
2020-02-09 17:48:30 +00:00
Dylan K. Taylor
2375e9519d
RegionWorldProvider: fix CS
2020-02-08 09:34:22 +00:00
Dylan K. Taylor
aac7da6c96
eliminate remaining empty() usages
2020-02-07 21:51:50 +00:00
Dylan K. Taylor
fb1126797a
Merge branch 'stable'
2020-02-07 18:13:55 +00:00
Dylan K. Taylor
e3833ba4f0
Merge branch 'stable'
2020-02-01 21:03:21 +00:00
Dylan K. Taylor
ff63f6d055
fill in more iterable types (master)
2020-02-01 20:19:57 +00:00
Dylan K. Taylor
89c6da13ac
phpstan: use more class-string
2020-01-31 22:05:33 +00:00
Dylan K. Taylor
f65bf76fd8
Merge commit '799183e13e61e89cc6820ad3132a4147454017c6'
...
# Conflicts:
# resources/vanilla
# src/Server.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/level/format/io/LevelProviderManager.php
# src/pocketmine/tile/Tile.php
# src/world/generator/GeneratorManager.php
2020-01-31 21:26:40 +00:00
Dylan K. Taylor
cb16f5c142
Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
...
# Conflicts:
# resources/vanilla
# src/Server.php
# src/lang/Language.php
# src/network/mcpe/protocol/AddItemActorPacket.php
# src/network/mcpe/protocol/AddPlayerPacket.php
# src/network/mcpe/protocol/SetActorDataPacket.php
# src/network/mcpe/serializer/NetworkBinaryStream.php
# src/permission/Permission.php
# src/pocketmine/block/Leaves.php
# src/pocketmine/entity/DataPropertyManager.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/item/Banner.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/io/LevelProvider.php
# src/pocketmine/level/format/io/LevelProviderManager.php
# src/pocketmine/network/mcpe/protocol/AddActorPacket.php
# src/pocketmine/network/mcpe/protocol/LoginPacket.php
# src/pocketmine/tile/Banner.php
# src/scheduler/BulkCurlTask.php
# src/updater/AutoUpdater.php
# src/utils/Config.php
# src/utils/Utils.php
# src/world/generator/Flat.php
# src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
Dylan K. Taylor
465d8cda79
Merge commit 'a5764b3ae98a70fe8f20f9b403a4ab84b51b11d8'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/level/format/io/LevelProvider.php
# src/world/generator/Generator.php
# src/world/generator/GeneratorRegisterTask.php
2020-01-31 19:32:38 +00:00
Dylan K. Taylor
9492325eef
Merge branch 'stable'
2020-01-29 20:01:30 +00:00