Just wondering what it would take to do something like this in the Game Engine? Although the example itself is done in the Anim-Player, it is real-time; which makes me wonder if the same could be applied within bge?
Other videos, such as this one have only confirmed my idea. There’s a link that’s been going around that’s supposed to contain the code for it, but when I click on it takes me to some… carpet-advertising service?
Anyways, I’d like to implement this effect in a game I have in mind, and would appreciate any help.
you could try shape keys on a fluid sim and then play the shape keys in the game. The fluid wouldn’t interact with a changing environment but it would look realistic. Another option you could try to displace vertices with python or GLSL but that could be very difficult and slow.
name ONE game with real time fluid simulations. fluid simulations are too expensive for real time.
there are aproximations like in cod, there are prebaked animations, and there are voxel/tesselation/displacement imitations that look like water, but are not realistic, they are all tricks to make you believe or make your brain recognize that you are watching fluids very similar to how movies used to do it with practical effects and camera tricks.
you have to think of what you are trying to do and find a way to portray it. keep in mind that if some part will never be seen, you don’t need to model it, and if something is not supposed to happen in game, you don’t need to code it.
for example, if you need shallow water, you don’t need swimming coding, you would add water splashes when something hits it. if you need a waterfall, you would model a waterfall with an animated texture. if you need a wall to break, you would model the water coming out of the wall and then raise the water of the floor. then there are some cases in which you want to show liquid in a glass up close, in which case you only need to tilt the model with the animation.
sometimes you need to stop thinking of how the computer would do it and imagine how YOU want it to look.
i’m pretty sure it does not use real time fluid simulations. the game is a voxel game like minecraft, water only has to go down and spread, and keep its mass. you don’t need real time fluid simulations for that.
the wobbly effect is just that, an effect. there is no physic simulation being done.
the game is also 2d, even if it had RTFS, it is not as complex and expensive as if it was 3d.
Not true, can go up, can evaporate into steam, the chars even cry/vomit etc, also it has no fixed mass, every drop can be from 1g to 10 KG. The physics or calculations or whatever they use works really well.
It seems to me that they use realtime not 100% sure but looks like it.
Indeed it’s a 2d game, so either way it’s a bit easier to build.
it also calculates the pressure per tile with fluids/gasses etc.
if you need specific example about something tell me a can make a video about it.
it is a voxel game. look up minecraft water.
there is a program that looks at every block and decides where to move the water/fluids next (like in a shader). the way you describe it to go up, it turns into a different type of thing, steam, which is a gas, and has its own behaviour (go up, spread).
i know there are no physics simulations in that game because i remember them having problems with thermodynamics of heat and cold. a single fan could freeze the entire place. which means there is no movement of stuff around, just an exchange of flags and values between blocks as in most voxel games.
gases are also known to follow a simple behaviour in that game, carbon dioxide goes down, oxygen goes up.
it works exactly like minecraft, except they solved the conservation of mass. in minecraft you can create infinite water (i think they changed this in recent versions). one way they could made this is by increasing the number of dimensions, creating parallel voxels to test the different fluids in relation to the solid blocks.
they could be using different “models” for different amounts of water, or they could be using tesselation to generate a mesh around a particle system inside a block or group of blocks. they could also be using a special type of mesh (think soft body) with it’s own unique physics to simulate water, or something like blender’s metaballs. it is still not fluid simulation, no collision detection is made taking into account all the variables, it is not realistic, and i’m sure it’s much simpler than the blender fluid simulations.
i’m no expert in fluid physics, but i think that can be done using an aproximate average pressure of each block. it’s just very simple math.
I’ve actually tried voxel-based fluids before. essentially you had a grid of water ‘stacks’, each with its own ‘height’ property, which set the height of the stack. if the stack next to it had a lower ‘height’ property, it would subtract one from its own and give to the stack in need.
The method worked, but it was sort of dull. there were no waves or anything; it was basically just a mechanism that flattened everything out. I’ve been wanting something that could splash and ripple around a bit, but couldn’t find a way to give my water stacks a more physical aspect.
Soft bodies sort of fulfill the wobbly effect, but they can’t exactly spread or split apart into droplets…
try using animated models/images instead of flat models. give it the wobbly effect, then use a different animation for when it splashes.
also, use models with a “pile” look for when there are many stacks, like a wave. instead of just using a higher one. or the pile could be an intermediate, like 0 to 10 it would be a pile, then raise a little when over 10, 10 to 20 would be the pile again but higher, and so on until 100 which would be full.
you also need to “join” the parts using a bitmask. it would look for example to the last and next blocks and turn into a “connector”/“middle” model when there is water in both sides. or in a rounded one if there’s air to the side. then expand the code to take into account vertical rows like waterfalls or drains.
it is all visual really.
know that the more complexity you put, the more complex the code becomes. using only left and right you have 2 bits (4 tiles). using also vertical ones you get to 4 bits (16 tiles), which is still manageable. using corners increases it to 8 bits(256 tiles), which is hard but still achievable. using this system for 3d would increase the bits to 10 (1024 tiles) or more (26 bits!!!) so it is not recommended.
It’s not blender, but my heart is pretty much set at this point.
Apparently it’s based on the series of ill-explained pages of http://matthias-mueller-fischer.ch/publications/tallCells.pdf. It features the main equation ∂u/∂t = −(u · ∇)u + (f/ρ) − ((∇p)/ρ), which I’m presently trying to make sense of. In the meantime, if someone could possibly inform me what ‘∂’ and ‘∇’ mean to describe, I’d greatly appreciate it…
Anyways, I think it would do the Blender community a world of good if this feature could be integrated. I’m thinking about posting something in the Team Projects division of the forum; maybe I’d get a bit more help with the math?
Would there be a way to get the soft body to split apart (or have multiple ones merge together) under pressure? Perchance use soft body spheres instead of a single plane; and have them interact like droplets. That way you could conserve volume and fill containers as well.
What on Earth have we at Game Engine Support and Discussion been settling for!? This thing does everything regular Blender sims can do, but in real-time! Features like this in bge could change history.
Unfortunately though, The Blender devs decided not to make an addon for it - or anything related to it at all. I really don’t understand why or how it never made it through - there have been countless requests to BlenderNation for something like this, which have been hanging around the web for 5-7-whatever years ago. This would have done the bge community so much good… I’m thoroughly confused.