Game engine with decent liquid physics?

Jul 18, 2021
71
44
Was thinking of making yet another metroidvania but in 2.5d , but I noticed a lot of 2d and 3d games that involves fluids or blood doesn't stick around the character or leaves any wet marks on the skin etc. Is this a common limitation to most game engines? or this possible with engines like Unity or Godot?

Basically my wishlist are:
- liquids must stick to character model for a set amount of time
- if the character falls on mud, water etc. the skin where the water touched must appear wet for a certain amount of time
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,235
14,996
[...] fluids or blood doesn't stick around the character or leaves any wet marks on the skin etc. Is this a common limitation to most game engines?
It's a common limitation to (almost) all physics engines.
A physic engines is dumb. It know near to everything regarding its physic field, and near to nothing regarding everything else. Therefore, it don't know what "a character" is, nor what "skin" mean. It's you, as developer, who have to tell it and ensure that the fluid will stick around, while the skin will have wet marks because of this.

Note: I added the "almost", because there's surely physic engines who are less dumb. But you'll not found them for game engines like Godot or Unity. They either have been developed for an internal engine, or for a top level rendering engine.
 

shark_inna_hat

Active Member
Game Developer
Dec 25, 2018
695
2,660
There are 2 aspects here.

1. Fluid Dynamics (physic - probably not what you want).
Fluid Dynamics is a bitch. Computing how a body of water actually behaves in real-time is (mostly) beyond current hardware.
There are tricks around it - you can simulate just the surface or some sort of approximation of the volume using something like sparse voxel octrees. If you're into this sort of thing, check out good old GPU Gems (but you might want to look for something more up to date):



2. Wet surface (graphic - probably what you do want).
If you just want to make stuff look wet - that's actually pretty easy. You just need a wet version of whatever material you are using and a mask to blend between the dry and wet look. It gets a bit messy if you need to accurately tell what part of a mesh is wet, because collisions are usually made between spheres, capsules, axis-aligned-boxes or some sort of convex hull and you need to get points in texture/uv space.
Depending on what level of realism you are going for, a wet look may be anything from bumping specular highlights and making the diffuse color darker to turning your simple metal/dielectric PBR material into a clearcoat/sss multilayered monstrosity.
It's not like this hasn't been done before, I'm sure there was a mod for Oblivion more then 10 years ago that made PC/NPC look wet if they fall into water or stand in the rain. It's just a matter of how much time and effort you want to invest in this (and how much slower your game will become). I'd be surprised if Unity and UE didn't have addons that can do all of this for you.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,968
7,291
I know it is possible with Unity:




I do not know about leaving traces of fluid on the character, but that'd be easy to fake by applying a decal.
In 3D, just use specular for wetness.


-edit-
From the screenshots, fluxy 2.5 seems to have adhesion. So yeah, for 23 euro with Unity, you can do that.
 
Jul 18, 2021
71
44
Thanks a lot everyone for the inputs. I've been fiddling with Godot all day and I don't find much tutorials for for liquid adhesion, there is one that is kind of like splatoon though but blasted on walls instead. Maybe I'll give Unity a try with an extension once I find it has all my requirements
 

Tompte

Member
Dec 22, 2017
215
155
It sounds like you're asking for something that is actually quite a niche feature and I doubt you'll find any out-of-the-box solutions. There may be solutions available on each respective engine's asset store, but in my experience it's often very hard to find something on there that works exactly how you want it to without complications. (Oh, someone posted some links already. But yeah, it's rarely as easy as buying the thing and having it work immediately.)

Most if not all engines should have all the components necessary to make your own system - but I understand that's not what you're asking for.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,968
7,291
it's rarely as easy as buying the thing and having it work immediately.)
It actually is, at least in Unity.
All the assets I have ever bought come with documentation and demos, in most of them I can simply copy/paste things from the Demo and have it work just fine.

The only exception are really old assets (not updated) that still "work", but you will be meet with many warnings because of obsolete code.
However, in some cases you will need to be able to edt, adapt and add them to whatever you need, and its difficulty varies on the task.
 
  • Like
Reactions: Tompte

Tompte

Member
Dec 22, 2017
215
155
It actually is, at least in Unity.
All the assets I have ever bought come with documentation and demos, in most of them I can simply copy/paste things from the Demo and have it work just fine.

The only exception are really old assets (not updated) that still "work", but you will be meet with many warnings because of obsolete code.
However, in some cases you will need to be able to edt, adapt and add them to whatever you need, and its difficulty varies on the task.
That's good to hear.

I'm always a bit suspicious about using the asset store. Like earlier this year I needed animated gif support for my game and the package that seemed to fit my requirements the most was over a hundred dollars, and it still wasn't very clear if it would actually fit my use case. I ended up writing my own gif support and it only took me like a day (using what's already available in the C# standard libraries). Felt like I dodged a bullet.

I guess my point was more towards what you say there at the end. If you go that route, expect some manual fiddlin'.
 
Last edited:
  • Like
Reactions: Winterfire

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,968
7,291
That's good to hear.

I'm always a bit suspicious about using the asset store. Like earlier this year I needed animated gif support for my game and the package that seemed to fit my requirements the most was over a hundred dollars, and it still wasn't very clear if it would actually fit my use case. I ended up writing my own gif support and it only took me like a day (using what's already available in the C# standard libraries). Felt like I dodged a bullet.

I guess my point was more towards what you say there at the end. If you go that route, expect some manual fiddlin'.
There are actually some free solutions online if you google, sounds like a scam, especially since I can't even think why anyone would ever want to use gif
 

Tompte

Member
Dec 22, 2017
215
155
There are actually some free solutions online if you google, sounds like a scam, especially since I can't even think why anyone would ever want to use gif
I'm all set, thanks. My use case is quite niche. Was mostly just because I could. But I still wanted it to work and work well.
 
  • Like
Reactions: Winterfire

Luderos

Member
Game Developer
Jul 20, 2020
198
309
It actually is, at least in Unity.
Well, just as a caveat for anyone sprinting to the asset store... For any physics sims, there's a BIG difference between "works" and "works in realtime at an acceptable framerate in your specific use case".

As an example, some things work nicely when interacting with a static cube but go very differently when trying to interact with an animated character mesh.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,968
7,291
Well, just as a caveat for anyone sprinting to the asset store... For any physics sims, there's a BIG difference between "works" and "works in realtime at an acceptable framerate in your specific use case".

As an example, some things work nicely when interacting with a static cube but go very differently when trying to interact with an animated character mesh.
Well yeah, but that should be common sense if you are a gaym dev.
There are many expensive things, and you should always aim for a good looking result while being as efficient as possible.

In the case of a human, do you really need that level of accuracy or would it work as well with just a capsule?
In fact, why does your character even have a complex collision to begin with?

It works, but you need to know when and how to use it.
 
  • Like
Reactions: Luderos
Jul 18, 2021
71
44
that is actually another main concern - performance, so yes I'm aware of these issues it's why im not going for ultra realistic (if I could solve the darn thing)
 
Last edited:

JoGio

Member
Jun 19, 2018
124
136
Is this a common limitation to most game engines? or this possible with engines like Unity or Godot?
It's not uncommon to see in most games these days, though how accurate the effect is will depend on the game's technical/engine limitations. The first time I noticed the effect was in 7th console gen games like Dragon Age: Origins, where characters are covered in blood splatters after a fight.

A more recent and very convincing example is Red Dead Redemption 2, where a character walking on water or falling in mud will have noticeable effects applied to skin and clothing.

You can see the main character interacting with mud here:

Modern engines like Unreal and Unity allow for dynamic materials to be applied to characters. If you look up tutorials on the subject you may find what you're looking for. Some examples:

Dynamic paint on a character. It's damage here, but it could just as well be used for water, mud, or other fluids:

And here's a very dynamic water system in unreal:

Combining the two would make for a very convincing effect. Performance will probably be an issue so it might be prudent to limit the size of the playing area as well as the number of characters on screen. This shouldn't be too much of a problem in a metroidvania which typically has smaller rooms loaded one at a time rather than a big open playspace.
 
Last edited:
Jul 18, 2021
71
44
^ thanks for that. But man.. I was almost avoiding unreal due to it's focus on 1st person and 3rd person modes, but I heard 2d platformers can still be done though with a bit more work. And it looks like Niagara fluid is free too

On a side note I was actually curious how I never saw an adult game using these effects, most of them are 2d since it can just be drawn in .. hence this little pandemic quest
 

JoGio

Member
Jun 19, 2018
124
136
I was almost avoiding unreal due to it's focus on 1st person and 3rd person modes, but I heard 2d platformers can still be done though with a bit more work.
This was probably true for Unreal 3 since it was built for shooter type games, although it was used by WB for their non-shooter games (Mortal Kombat 9, Batman Arkham games) with great success.

Unreal 4 and 5 can be used for pretty much any genre including 2D side-scrollers. That being said, it excels at 3D visuals but lags behind unity when it comes to 2D sprite support. You can do anything Unity can do in Unreal but Unity has much better plugins out of the box for 2D games. If you're using 3D character models in a 2D camera perspective then I doubt Unity has any distinct advantages over Unreal.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,968
7,291
I wouldn't use Unreal for 2D stuff... If you do not have any experience with Unity, I'd just go for Godot instead.
 
Jul 18, 2021
71
44
I was thinking more like 3d model + 2d camera perspective platformer, I don't know if i'll ever use 2d sprites at all .. maybe as an asset for background parallax effect. As for liquid it seems that Unreal has it for free, Unity can cost 30-60$ for fluxy.. as for godot i'll have to reinvent the wheel as i could only find basic particle physics
 
  • Like
Reactions: JoGio