20 Commits

Author SHA1 Message Date
Dylan T
4111d92b98
Stop hardcoding chunk dimensions everywhere (#4443) 2021-09-10 16:13:25 +01:00
Dylan K. Taylor
22c3736d63
LightUpdate: micro optimisations opcache isn't smart enough for
this removes 6 unnecessary opcodes from computeSpreadLight() and 3 from computeRemoveLight(). Tested with opcache.opt_debug_level=0x20000.
2021-07-30 23:30:28 +01:00
Dylan K. Taylor
f1583f44df
LightArray: Avoid allocating 7 useless arrays for every node processed
instead, use a const array of the offsets and add them to the coordinates, which avoids the allocations.
In synthetic benchmarks, this method takes 40-50% less CPU time by eliding ZEND_INIT_ARRAY and ZEND_ADD_ARRAY opcodes. In practice, the benefit will likely be much smaller (perhaps even irrelevant).
2021-06-17 22:21:58 +01:00
Dylan K. Taylor
ddda2d1e64 Remove $create parameter from ChunkManager::getChunk()
this restores SimpleChunkManager's behaviour to PM3, removing the need for GeneratorChunkManager (although I'm dubious whether SubChunkExplorer makes any sense in there any more now that we have morton in the mix).
2020-10-31 21:54:51 +00:00
Dylan K. Taylor
1859dac789 Implemented self-contained (pass 1) chunk relighting
this doesn't handle propagating light across chunk borders yet, since that's much more complex to implement.
2020-10-27 18:29:32 +00:00
Dylan K. Taylor
0ecd68e4a7 LightUpdate: remove premature optimisation which breaks when mass-update lighting is used
when setBlockSkyLightArray/setBlockLightArray was used, currentLightArray would retain a reference to the old light array, which would cause false readings if SubChunkExplorer didn't move away from that subchunk and back.
This causes a small degradation of performance, but I think it can be implemented differently anyway.
This also fixes #3816.
2020-10-27 18:01:31 +00:00
Dylan K. Taylor
31c2c3abb5 SubChunkExplorer::moveTo() now returns a status
this can be used by SubChunkExplorer subclasses to implement specialized logic.
2020-10-26 16:25:21 +00:00
Dylan K. Taylor
c9d2edcb4d Rename SubChunkIteratorManager -> SubChunkExplorer 2020-09-20 12:47:44 +01:00
Dylan K. Taylor
4879df626d Reduced LightUpdate dependency on ChunkManager to indirect
this opens the gateway for alternative SubChunkIteratorManager implementations which don't use ChunkManager at all.
2020-09-20 12:41:53 +01:00
Dylan K. Taylor
c20ac82fe6 LightUpdate: Move propagation-specific state to a separate unit
this solves multiple architectural issues:
- improves reusability by avoiding having old state info stick around to fuck stuff up
- prevents access to propagation state from outside of propagation

this also reduces the latent memory usage of light-updates after they have been used.

TODO: we could probably change LightPropagationContext to LightPropagator and move all the propagation-specific code into it if we can solve the subchunk-iterator and effective light problems.
2020-09-09 01:06:09 +01:00
Dylan K. Taylor
bde24d9279 LightUpdate: remove unused field 2020-09-08 23:14:10 +01:00
Dylan K. Taylor
205617f29e Untether LightUpdate and children from BlockFactory 2020-09-08 18:14:35 +01:00
Dylan K. Taylor
94d8f59484 LightUpdate::execute() now returns the number of visits made to blocks in total
this is useful for performance profiling.
2020-09-05 22:25:42 +01:00
Dylan K. Taylor
15299735e9 Do not create chunks during light propagation/removal
this used to be necessary to trigger subchunk creation so that light arrays would be available for use. With 02ff8d671b93ec5911576643e9b03f2049f31c81, this is no longer necessary.
2020-09-05 22:22:19 +01:00
Dylan K. Taylor
f55a7f8b53 Merge commit 'd8d994351'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-14 19:47:21 +01:00
Dylan K. Taylor
8d49bc93e0 Merge commit 'f5a49b6d55940584a6a4e9cdbc456c581182b5fd'
# Conflicts:
#	resources/vanilla
2020-05-18 10:35:23 +01:00
Dylan K. Taylor
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
Dylan K. Taylor
a3b73d95a7 LightUpdate: allow providing effective light levels for propagation, fix #2999 2019-10-23 21:01:19 +01:00
Dylan K. Taylor
ebbb99b96b Merge branch 'next-minor' 2019-10-22 19:05:11 +01:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00