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
Refactored the liquid system, and added an optional feature for liquids to flow to the next slope. #13764
Conversation
A single picture doesn't tell much, but the current system for has always seemed kinda jank to me. |
After multiple failed attempts to decipher the system I've decided to rewrite it. The hard part now is to ensure that the behavior is compatible. It was crazy to see how cobwebs spread all over the place. |
Once you have finished the PR, maybe post a video showing which parts have changed from before. Then it would be easier to see how things work differently. |
If the liquid enables flow_down it will behave like the water explained in this video: https://www.youtube.com/watch?v=9uIRD9sMBU0 |
Hi, is it possible to an option for #13782 in nodedef of liquids when you're at it? Edit: I fixed this by modifying 2 lines in builtin/game/falling.lua, see #13782 |
Have you tried it with my PR? I think when you make water |
I'll try your PR tomorrow then and see if it fixes my problem. |
Okay, I have fix for my issue ready: I tried to make a PR myself but couldn't press the "make a PR" button for some reason... |
It was my interpretation of |
Ok, managed to publish the PR #13789
If it's intentional then there's no need to do so, I will simply adjust the code of our game if needed. |
@sfan5 If I get roadmap approval I will create a comprehensive unit test for the previous liquid system, complete the refactor and ensure that the new liquid system stays compatible. |
This is from Exile v4. Source def: |
I don't have an opinion on this yet but yes, unit tests and backwards compatibility (that is: opt-in behaviour) are important. |
- Created the LiquidSystem class. - Split the behavior into multiple logical methods.
- The liquid range did not work.
Discussed a bit in the dev meeting: https://irc.minetest.net/minetest-dev/2023-09-17#i_6114953 In addition to the compatibility of existing worlds, how well does it scale in performance? Currently it does require less nodes to be updated, but optimally it should perform the same or better as the current (master) water propagation. Hence, benchmarks would be somewhat welcome to not undo years of slow optimizations in this code. EDIT: Based on additional meeting comments: (where I agree to)
The PR should be split into refactor first, feature after for proper performance and compatibility checks. By the looks of it, the feature PR will then be rather small (mainly network and Lua API additions). However, this PR is currently in a suboptimal state for review. |
I have not done a benchmark jet.
That's fine.
Another option would be: Keep the existing liquid system as is. And create the alternative liquid system with the feature alongside (Tests included). |
This liquid system could open up for some new puzzles or world modelling that is currently not possible with the current spread mechanism. Discussed again in a dev meeting: https://irc.minetest.net/minetest-dev/2023-10-01#i_6119109 If the performance of the current liquid flow is the same (or better) and bug-to-bug compatible, then I see no reason against this PR. |
@SmallJoker Do you mind if I isolate the current Liquid system as it is into separate Module, for the purpose of testing? |
@cosin15 If it simplifies the code structure or helps you during the development I have no objections. It will have to be tested for compat anyway. |
@cosin15 any updates on this? |
It looks like OP has disappeared (according to their GH history). Closing |
I'm back. I would suggest keeping the current liquid system as it is, and adding an alternative, well tested liquid system that can be enabled. |
I refactored the liquid system, and added a feature that enables MC like liquids.
The mod-creator can now use the property
liquid_slope_range
in the liquid definition.To do
This PR is a Work in Progress. I plan to spend some time.
How to test
Add the property
liquid_slope_range
to the liquid definition of your favorite game. Don't forget to make a backup of your map before trying this PR.