New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New bulk node light update #4967
Conversation
This work is very much appreciated, these lighting bugs are one of the biggest problems in Minetest. |
Done! The WIP label can be removed. |
If many mods add map generation, all of them use the vmanip object and call calc_lighting, I assume this PR breaks my nuke mod, there when firing the rocket launcher, the explosion (nodes removal using vmanip) happens immediately, then, when the projectile reaches the target, sound is played and update_map is executed. So from the players' views the explosion happens later. But for any reason executing update_map later using minetest.after occasionally causes memory access error… |
@HybridDog yes, it turned out there are now problems with map generating (mods that use singlenode mapgen with nolight flag) |
In this case it would be the mods responsibility to delay the light calculation until after the last 'on generated' operation. Each mod can have a bool to disable lighting calculations. |
Now I pushed a patch.
I hope this is now free of bugs. |
I have also made some speed tests: |
This is very important PR for me, will try it out in some time. This patch also includes ghost light fixes? |
@Fixer-007 the first commit in itself is #4682 and the second commit is the new stuff. If #4682 gets merged, the first commit will disappear from there. |
Checked for now:
Please review 👍 👍 👍 |
Needs rebase. |
Rebased! Please review #4682 first, as merging it will remove two commits from there. |
Unfortunately hmmmm isn't around recently, because it affects voxel manipulators and 'upate map' i feel hmmmm should look at this. |
Bump! Unexciting but this is top priority for review as it fixes MTs most serious current bug. |
Ok so i assume the code in map.cpp is something run when core mapgen generates. So essentially my opinion is let's not bother with the code in map.cpp in commit 5, please could you remove it? We could consider it in another PR later, it will only delay this PR. |
In case you want to test i have updated my 'catacomb' mod to place full nodes under the stairs to block the light. I will retest your PR soon, with 'projects' mod too. |
Worldedit allows setting lots of nodes at once. If someone sets a 100x100x100 cube made of mese it takes ~0.05 s with my Worldedit and ~5.78 s with the original one, the current update_map takes lots of time. My version uses my function_delayer mod to distribute necessary map updates over time without causing noticeable server lag. By updating each chunk separately, l can omit unloaded chunks, which may be the majority, by using minetest.get_node_or_nil.
If players set lots of nodes, they're huge. If they set a few nodes, the overhead is negligible.
Yes, often players use the command frequently to change the nodes e.g. just because they noticed that cobble, then stone brick looked more fitting after all. If the map updates are delayed, no redundant ones are executed. Is updating the map after your change still about 100 times faster than writing to map? |
@HybridDog the current state is:
I will see how can I solve this problem, as simply disabling light updates is not enough: all of my lighting methods assume that the lighting on the map is correct (this gives some extra speed) and by placing incorrect light on the map it is not guaranteed that bugs will disappear when you update the light again. |
thanks |
I'm doubt it's worth altering your PR for this single very specialist usage, especially if it makes your PR less effective and slower for all other uses. |
@paramat I have tested the post-mapgen light update on a release build, it takes 0,024 seconds. @HybridDog I will open a new PR for you, I hope that you understand that this PR is complex enough already. |
@HybridDog there are the corrections for you, I hope they will be sufficient: juhdanad@23fdd16 |
thanks, does write_to_map still work about 100 time faster without light fixing? |
@HybridDog I do not know how fast |
Thanks, will test. |
Retested with 'catacomb' and 'projects' mods, all seems good now 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks ok. I really hope this is tested entirely.
👍 tested with large voxelmanips. Any remaining issues can be ironed out later - I think this shouldn't wait much longer. |
Great. Than I finally can add l-system trees? |
ab371cc |
Based on #4682, please do not merge this before!
Edit: #4682 is merged.
This is an early version for testing, the code style is not final yet.
Lua changes are not documented yet.
Edit: now the PR is done.
The new lighting algorithm should fix #3421 (mostly, sometimes a well-lit area is overridden, probably by the mapgen). With this v7 mapgen should be playable with the moretrees mod.
This should also fix #4853 and fix #4852.
Changes:
write_to_map
is called on a voxel manipulatorupdate_map
does nothing