Felicis / Water-Physics-Overhaul

MIT License
34 stars 4 forks source link

waterlogging problems (blocks disappearing; water duplication/destruction; water interaction bugs) #2

Open Felicis opened 1 year ago

Felicis commented 1 year ago
Felicis commented 1 year ago

first waterlogging progress using Statement mod: Lectern behaves normally and accepts water at any level (even submerged). Now that needs to be applied to all blocks that make sense...

image

Felicis commented 1 year ago

status update: I have some bad news: the current system where the water level (0-8) and the fluid type (empty, water, lava, ...) is encoded in the blockstate as properties does not scale at all sob

For all the non-modders out there the problem is because minecraft pre-generates every block with every combination of its properties and keeps them in memory, which means it can just replace the block in the world when it is changed instead of having to create it again. For example this means that there are 10 redstone torch variants in the game at every time (4 on wall + 1 on floor * 2 on/off). For WPO we are adding 9 water levels to many blocks (~40), which means we have 9x the block variants in the game. My game froze and ran out of memory while trying. And even if it were to work in vanilla (on a faster computer with more memory), it's never going to work with more than a couple mods, never mind large modpacks.

Until now I have found 3 solutions to this problem and each one is more complicated than the other, so if you have tips, ideas or suggestions on how to tackle this, they are very welcome heart :

  1. Store in BlockEntities: the forge wiki says that if your data is too complex for a block state property, you should store it in a block entity. Now I do not know the performance impact of having block entities for every single fluid block, but already having to create and manage the block entities for all waterloggable blocks seems daunting (let along tweak the blocks which already have block entities).
  2. Reduce property combinations: right now every combination is created, even if it makes no sense (e.g. waterlogged=false, fluid_level=3). If there were a way to tweak the property combination generation, this might already ease the load, although I cannot say whether it will scale to modpacks with many modded blocks or fluids. Also feels like an ugly and brittle hack. However this is the only combination which directly works with modded blocks.
  3. Rewrite FluidStates to be stored like BlockStates in the server and synced across the network. Fluidlogged-API does this to add Fluidlogging/Waterlogging to 1.12. It looks very complicated and will take some time to set up, but I feel like this is the most elegant way to store the fluid type and level for each waterlogged or fluid block. It might also be easier to keep the custom fluid physics separate and just inject FluidStates where needed, but how hairy it is to wire this into the minecraft code has to be seen.

So... that's the status update I guess smiling_face_with_tear

djmrFunnyMan commented 1 year ago

Not sure if you need to know this but glow lichen is also affected 2023-06-08_23 44 24 2023-06-08_23 44 44

Felicis commented 1 year ago

Not sure if you need to know this but glow lichen is also affected

yeah that's expected. pretty much every non-full block has an odd interaction with fluids right now. Also I'm fixing 1.16 first (since it has less blocks and upgrading is easier than downgrading), which is why the lichen is not on my list. But do remind me if it's still bugged when I've upgraded it to the version with the lichens :wink:

Felicis commented 1 year ago

Small status update: I realized there is a collision between my new changes and SDKS-Core, therefore I have decided to kick it out. For me this means more work to get WPO done. For you it means longer to wait until I'm done :smiling_face_with_tear:

Technical comment: Decoupling WPO from SDKS-core seems easier than rewriting SDKS-core, also I did not like the mixins required to insert the worker threads into the server code.

Side notes: I've found the culprit to the PalettedContainer bug in SDKS-core, so this should fix itself. I've also found the bug in the code that made water destroy pistons sometimes :)

djmrFunnyMan commented 1 year ago

Small status update: I realized there is a collision between my new changes and SDKS-Core, therefore I have decided to kick it out. For me this means more work to get WPO done. For you it means longer to wait until I'm done šŸ„²

This alongside the waterlogging fix, seem to add up to quite extensive changes. Should we expect this to greatly alter how the water behaves compared to the current version?

Felicis commented 1 year ago

Actually I'm trying really hard to keep the original behavior, since I like it a lot. For now the only real change is that water updates are done on the main thread and not on WPO worker threads anymore and I hope the performance impact will be negligible, but we'll see :)

Felicis commented 1 year ago

alright, here is the first (very) alpha version for who wants to play around with the new fluidlogging #28 :sweat_drops:

xJiggo commented 11 months ago

Hello im just here to see how the progress with the mod is šŸ‘

Felicis commented 11 months ago

Now that you ask, the fluidlogging part is mostly working by now... I'll have a look if the issue is closed. I'm working on updating fluids right now (e.g. start flowing/equalizing after breaking a block). Have a look at the nightly (alpha) releases and the discussions

xJiggo commented 11 months ago

Nice job cant wait for next update šŸ‘ Also here's what the ocean looks like now :) 2023-08-16_23 52 08 2023-08-16_23 51 43 The water has gone down by like 10-15 blocks lol Dont mind the clouds thats just the weather2 mod :)

xJiggo commented 11 months ago

I have an idea for water replenishing: Where theres bodies of water, ponds, rivers ect, when raining it should have a chance to place a block of water (Configurable) On land have a lower chance to place a block of water (Configurable) so we could maybe have a simulation of water runoff

Felicis commented 11 months ago

fluid ticking should work now, you can check it out in this nightly #32

xJiggo commented 8 months ago

Back again for another update, how you doin? Also if you need help with anything like testing ask me i'll do it

Felicis commented 7 months ago

Hi y'all, sorry for the update pause, life was in the way :) I'll try to get a new update out soon, stay tuned! And thanks for the offer xJiggo, I'll let you know šŸ‘

xJiggo commented 7 months ago

Your welcome and looking forward to next update

xJiggo commented 4 months ago

Hello there back for another checky check I also want to try helping you code this mod if you want, but I only know python coding, I love this mod and want to help you out as much as possible. I should catch how java works after some time but only if you don't mind ā¤šŸ‘Œ

Felicis commented 4 months ago

Hey xJiggo, That sounds like a great idea! I'm sure you'll pick it up in no time. In any case we can chat if you get stuck with Java or just to talk about the code in general. Also having a team is actually a good motivation for me to keep coding regularly... I've been lazier lately because I'm doing Work-aways and I've been traveling a lot, so hoping for a good shot of motivation! šŸ˜Š We can chat on discord if you want. I'm called hauntedcactusman there.

xJiggo commented 4 months ago

Sounds like fun, looking forward to working with you Felicis. I'm the typical shy guy and prefer texting at first but hope that isn't a problem for you. I've added you on discord. My name is the same just without the x and some fancy font.