-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[no sq] LBM-related bug fixes #15919
Conversation
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.
Works. Tested using the reproduction steps in #15902 which uses a mineclonia branch
Would you be willing to add the I made a workaround for Mineclonia which uses ABMs to detect if a mapblock is likely to be outdated and updates it in bulk if that is the case. It would however be good if we could remove that workaround in the future when people are running fixed Luanti versions. Without such a flag we will not be able to stay compatible with old worlds without keeping the ABM in there forever (which has a constant performance impact even if it is small). |
It's kind of a kludge so I was hoping to avoid it. |
My reasons for not using
The ABM gets around these issues by checking if a node it is triggered on is likely a mapblock for which the LBM has not run correctly (neighbouring nodes all have the same rotation), and updates the whole mapblock if that is the case. It does not need to be triggered for every node and can have a higher I also expect other games to encounter similar problems. VoxeLibre for example plans to lower the bedrock layer to increase world depth. When we did this in Mineclonia we ended up using ABMs with So I do think it is worth adding a flag for this, even though it is not pretty and understand being hesitant about it. It does not feel good if games/mods are required to implement workarounds that introduce an ever present performance overhead that cannot ever be removed. |
I am not sure if this would be preferable, but an alternative would be to add a setting which makes all LBMs run on mapblocks without a timestamp. Games that want this behavior (and are aware of possible consequences) can enable it in their Maybe it would be possible to hide such a setting from the settings menu (as it does not have much relevance there). |
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.
Looks good overall.
I assumed you had a way to detect if a particular grass node has already been rotated.
Bulk LBMs alleviate the per-node overhead to a large degree. |
(broken in 811adf5)
behavior change: newly generated blocks are no longer momentarily activated. this shouldn't matter for anyone and did not consistently apply to all blocks anyway addresses issue from luanti-org#15902 for new maps(!)
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.
Tested according to the test script. Works. The mapblocks are updated reliably as they get activated by approaching them.
I also tested the opposite case when the LBM was in theory already run on a mapblock (where its modification date is newer than the LBM introduction).
Instructions:
- Created a new world, generated some mapblocks
- Changed
mg_name
inmap_meta.txt
tosinglenode
- Enabled the LBM mod and joined to convert a few mapblocks
- World exit
- Changed
env_meta.txt
- from
lbm_introduction_times = lab:reliability_test~31;
- to
lbm_introduction_times = lab:reliability_test~6;
(move to past)
- from
- World rejoin
- The other mapblocks don't get updated.
Works as-is.
Not really. I can only check if it has probably not been rotated by comparing the |
How does your ABM solution avoid rotating grass multiple times then? |
It does it the same way – it checks if at least 4 neighbours have the same rotation. My thinking was that the ABM is executed pretty rarely and only need to trigger on one node in a mapblock to update the whole thing. My co-maintainer cora found it questionable for something that is purely visual though, so we will not be using that workaround. One could use bulk LBMs to do a similar check since you get all positions. Basically check if the first 5 positions or so have the same rotation. That may be better than what I proposed with ABMs. It is still a pretty hacky solution though and not ideal. |
I have also realized that even if we may use a If a player rides a boat over a deep ocean they will probably activate several thousand water nodes per second. So I think adding Would you be opposed to me making a PR for |
Have you tested if an ABM is really faster than a bulk LBM? I think your intuition for what is going to be slow/fast is wrong in this case.
Sure, feel free to contribute a PR. My main concern is that I didn't want to spend time writing the code myself. |
I think you are right. My ABM workaround was also made before I realized bulk LBMs could be used instead of individual ones.
I will look into it then. Also thanks for looking into this issue so quickly. |
see commit messages for more details
closes #15902
To do
This PR is Ready for Review.
How to test
singlenode