Simple idea for buoyancy in water

Is this simple enough to implement/code?


  • Total voters
    4

The Grand Teki

Well-Known Member
Feb 17, 2017
1,335
1,237
520
UESO hq.
Give each corporation a "block density". The tech's average density is used to determine whether it'll sink or float. My idea for values:
  • GSO and Experimental: half the density of water;
  • GeoCorp: 3/4ths the density;
  • Venture: 1/3rd the density;
  • Hawkeye: 1,25 times the density.
Special blocks which have a different density:
  • GC armor plates: same density;
  • Base equipment not including mobile things and conveyors; 1,25 times the density;
  • Buoyancy blocks if they're added: 1/5th the density;
  • Ballast blocks of they're added (1x1x1 and 2x2x2): 2,5 times the density;
  • All inflated (not like krushers, jaws or tracks) wheels have half their original density;
  • Minor blocks like lights, radars, decoration blocks (except colored blocks): 1/3rd their original density;
  • Batteries, shields, healing bubbles I NEED HEALING, fuel tanks and rocket boosters; 1,5 times their original density;
  • Every other flying blocks: 2/3rds their original density;
  • Brackets: half their original density;
  • Naval hull blocks if they're added: half the density;
  • Resource blocks: 3/4ths the density;
  • Please suggest more!
Thoughts?
 
Last edited:
  • Like
Reactions: Legionite and Exund

Nightblade Greyswandir

Nothing is good enough!
Feb 3, 2017
2,750
3,026
575
45
Terraland
ngttadventures.blogspot.se
To keep it at least to some point real, steel boats does not float because steel is less dense than water, so non of materials for land vehicles should be less dense than water. If you want floating with physics it should be done in different way. Best would be if we have new corporation that have only floating blocks.

If water is 1000 kg/m3, check this list for metal densities.
 
  • Like
Reactions: The Grand Teki

The Grand Teki

Well-Known Member
Feb 17, 2017
1,335
1,237
520
UESO hq.
To keep it at least to some point real, steel boats does not float because steel is less dense than water, so non of materials for land vehicles should be less dense than water. If you want floating with physics it should be done in different way. Best would be if we have new corporation that have only floating blocks.

If water is 1000 kg/m3, check this list for metal densities.
This was a simple solution, not the complete one, but I totally understand your points because I know why you said that and it was a real reason. (sorry I butchered english)
 

Nightblade Greyswandir

Nothing is good enough!
Feb 3, 2017
2,750
3,026
575
45
Terraland
ngttadventures.blogspot.se
This was a simple solution, not the complete one, but I totally understand your points because I know why you said that and it was a real reason. (sorry I butchered english)
There is a thread where one of members have lot of models he made in Blender, he used his own naval block models. That show how good would be to have naval blocks.
English is not my native, and I do not think you butchered it more that I usually do.
 
  • Like
Reactions: The Grand Teki

The Grand Teki

Well-Known Member
Feb 17, 2017
1,335
1,237
520
UESO hq.
There is a thread where one of members have lot of models he made in Blender, he used his own naval block models. That show how good would be to have naval blocks.
English is not my native, and I do not think you butchered it more that I usually do.
The blocks you're referring to is TSN block models by @Mottflyer. I'm not native either, so it doesn't matter as long as we still understand each other ;)
 

Sozin

Dog Emperor
Jul 9, 2016
658
1,318
505
Accurate physics-based bouyancy requires surface integration. I am not sure Unity is able to do so in a fast enough manner to be a feasible part of the physics loop without dragging fps down to shit

Edit: Density is nice and all, but it only simplifies things when we're talking about objects of uniform density ... completely submerged. Anything else, and it's rather difficult to calculate.
I suppose they could make a rough approximation of a surface integral by just integrating with respect to the outer "shell" of blocks, but the disuniform density still means the equation gets pretty complicated pretty fast
 

Sozin

Dog Emperor
Jul 9, 2016
658
1,318
505
Give each corporation a "block density". The tech's average density is used to determine whether it'll sink or float. My idea for values:
  • GSO and Experimental: half the density of water;
  • GeoCorp: 3/4ths the density;
  • Venture: 1/3rd the density;
  • Hawkeye: 1,25 times the density.
Special blocks which have a different density:
  • GC armor plates: same density;
  • Base equipment not including mobile things and conveyors; 1,25 times the density;
  • Buoyancy blocks if they're added: 1/5th the density;
  • Ballast blocks of they're added (1x1x1 and 2x2x2): 2,5 times the density;
  • All inflated (not like krushers, jaws or tracks) wheels have half their original density;
  • Minor blocks like lights, radars, decoration blocks (except colored blocks): 1/3rd their original density;
  • Batteries, shields, healing bubbles I NEED HEALING, fuel tanks and rocket boosters; 1,5 times their original density;
  • Every other flying blocks: 2/3rds their original density;
  • Brackets: half their original density;
  • Naval hull blocks if they're added: half the density;
  • Resource blocks: 3/4ths the density;
  • Please suggest more!
Thoughts?
Density = Mass / Volume.
Every block already has a predefined volume, and a predefined mass (otherwise Newtonian physics can't happen). Ergo, every block already has a density
Assuming techs are static entities, it's very easy to determine where something floats.

Let's go with the example of a battleship.
The hull is made of steel. Steel, most usable metals actually, are much much more dense than water. Why does it float? Effective density is lower, because the volume it displaces includes air, which is much less dense than water.
Unless we're going with the idea that most blocks in game are hollow (the depressing amount of hits it takes to kill something supports this, actually), or filled with mystery aerogel-like stuff, then any ships would need to be wide-based, and hollow, just like real ships.
As long as it just sits there, everything's fine and the physics engine doesn't crap out on us.

Now. Let's start moving it. The propellers are mainly underneath the battleship. Which means if no other forces were acting on it, the bow would tilt up. But, gravity and bouyancy are also acting on it, if we ignore wind (which terratech mostly does), and collisions with other ships. So. Bow tilts up slightly. Now battleship is at a slight angle. Physics engine needs to recalculate bouyancy, only this time it takes even more resources to calculate simply because it's not perfectly level anymore. Doing all of these calculations in addition to what's going on in base Terratech would murder the engine.

So. Let's ignore tilt completely, even if thrust is insane. OK. We get boats that should be capsizing themselves, but instead zip around at 100+ mph. Very unrealistic, but ok sure.
Now what happens if you blow a hole in the side. Water starts entering. Oh dear. Now, archimedes principle is not enough to calculate stuff realistically. Now, you need to take into account angle, unless you want ships to sink completely vertically, and how water rushing in will pronounce the angle even more as it rushes down into the gap. Of how the water inside the ship now also exerts pressure and is added to the effective mass of the ship, but also skews the ship's center of mass. Of how the water inside will react if a giant explosion topside rocks the ship, sloshing back and forth. Yeah.

Please do keep in mind that no easy optimizations exist to this problem. If they did, the devs would have plucked them off of google already.

So please do google bouyancy optimizations. But keep in mind that said optimizations are mostly geared towards static systems, where all variables are known. And not the dynamic system that is Terratech, where techs may spontaneously lose parts of themselves, and collide with other techs.
 

Nightblade Greyswandir

Nothing is good enough!
Feb 3, 2017
2,750
3,026
575
45
Terraland
ngttadventures.blogspot.se
Maybe if some miracle happened and Terratech join with that other blocks based naval game, that I forgot what is it's name, and if it is possible to merge codes (that is where miracle comes in), we can have functional land/air/sea game. I am not sure that Terratech as it is now can support water as functional element without HUGE changes in code... maybe Terratech 2 (not version 2.0 but real second game).
 

Sozin

Dog Emperor
Jul 9, 2016
658
1,318
505
Maybe if some miracle happened and Terratech join with that other blocks based naval game, that I forgot what is it's name, and if it is possible to merge codes (that is where miracle comes in), we can have functional land/air/sea game. I am not sure that Terratech as it is now can support water as functional element without HUGE changes in code... maybe Terratech 2 (not version 2.0 but real second game).
I believe you're talking about from the depths. Last I checked trying to run it almost crashed my computer. Their code is very heavily optimized … to their own scenario, which means terratech would need to heavily modify any code they got from them, if they were even willing to part with it, but a collaboration for ideas does seem like a good idea imo
 

Nightblade Greyswandir

Nothing is good enough!
Feb 3, 2017
2,750
3,026
575
45
Terraland
ngttadventures.blogspot.se
I believe you're talking about from the depths. Last I checked trying to run it almost crashed my computer. Their code is very heavily optimized … to their own scenario, which means terratech would need to heavily modify any code they got from them, if they were even willing to part with it, but a collaboration for ideas does seem like a good idea imo
The Last Leviathan, but I haven't tried it, so I do not know how good/optimized this one is.
 

Mottflyer

Well-Known Member
Mar 8, 2015
139
395
475
Why not just have 2 variables?

Buoyancy and displacement.

Buoyancy is how good a block can float in water going from -1.00(Sinks like a rock) to 1.00(Floats 100% on top of water) So you can have floats and stuff.
Also 0.00 buoyance blocks would just stay motionless in water, neither rising or falling.

Displacement is how good a whole tech can float on water with all of it's blocks that are touching the water(like an actual boat does). Lots of heavy blocks all together(Like in a boat shape) can float this way.
And each block has a displacement variable depending on how big it is.
 
Last edited:
  • Like
Reactions: The Grand Teki

Sozin

Dog Emperor
Jul 9, 2016
658
1,318
505
Why not just have 2 variables?

Buoyancy and displacement.

Buoyancy is how good a block can float in water going from -1.00(Sinks like a rock) to 1.00(Floats 100% on top of water) So you can have floats and stuff.
Also 0.00 buoyance blocks would just stay motionless in water, neither rising or falling.

Displacement is how good a whole tech can float on water with all of it's blocks that are touching the water(like an actual boat does). Lots of heavy blocks all together(Like in a boat shape) can float this way.
And each block has a displacement variable depending on how big it is.
...well that's one way to simulate it. But it would be just that. A simulation, and a very transparent one at that.
It would most decidedly *not* be physics based, or even slightly realistic.
Ignoring the physics aspect, these are some holes that can be poked in it:
"Displacement" - how is it calculated? What determines which blocks are touching the water? How do you intend to calculate such when Displacement depends on it, but it depends on Displacement?
Buoyancy - ... err. okay?... so how is buoyancy force calculated? B/c ultimately any algorithm will have to provide the game engine (Unity) with a set of force vectors.

Other questions that need to be answered;
-How will you handle tilt from unbalanced ships?
-how will you handle the dynamic nature of techs (techs can be modified or destroyed on a whim)
- how will you handle horizontal forces from firing weapons
- how will you handle sinking ships?
-how will you handle ships ramming?
-how will you handle interactions with shoreline?
 
  • Like
Reactions: The Grand Teki

The Grand Teki

Well-Known Member
Feb 17, 2017
1,335
1,237
520
UESO hq.
...well that's one way to simulate it. But it would be just that. A simulation, and a very transparent one at that.
It would most decidedly *not* be physics based, or even slightly realistic.
Ignoring the physics aspect, these are some holes that can be poked in it:
"Displacement" - how is it calculated? What determines which blocks are touching the water? How do you intend to calculate such when Displacement depends on it, but it depends on Displacement?
Buoyancy - ... err. okay?... so how is buoyancy force calculated? B/c ultimately any algorithm will have to provide the game engine (Unity) with a set of force vectors.

Other questions that need to be answered;
-How will you handle tilt from unbalanced ships?
-how will you handle the dynamic nature of techs (techs can be modified or destroyed on a whim)
- how will you handle horizontal forces from firing weapons
-how will you fire ships ramming?
-how will you handle interactions with shoreline?
plz dont poke me with this i just wanted a simple idea >~<
 

Sozin

Dog Emperor
Jul 9, 2016
658
1,318
505
plz dont poke me with this i just wanted a simple idea >~<
The crux of the problem.
Buoyancy, indeed, all of fluid dynamics, is most decidedly not simple. Terratech is a physics-based game. Fluid dynamics are complex enough that it is physically impossible to fully simulate it at a reasonable speed. The question then becomes: what level of reality are you willing to sacrifice?
I am not willing to sacrifice enough to make an unrealistic simulation that works in general cases, but not edge cases.

Edit: I should mention that a purely static system where all variables are known can be simulated in decent speed with optimizations made simply because you know all the variables. Indeed the simplest optimization would be to just make a recording and play it instead of doing any simulations. But, TerraTech is a dynamic, interactive system, where you *have few, if any guarantees* as to the behavior of player-created objects (techs). Which essentially means you literally cannot precompute the most important aspects, which means you have to do so on demand, which greatly limits the number of possible optimizations available.
 

The Grand Teki

Well-Known Member
Feb 17, 2017
1,335
1,237
520
UESO hq.
The crux of the problem.
Buoyancy, indeed, all of fluid dynamics, is most decidedly not simple. Terratech is a physics-based game. Fluid dynamics are complex enough that it is physically impossible to fully simulate it at a reasonable speed. The question then becomes: what level of reality are you willing to sacrifice?
I am not willing to sacrifice enough to make an unrealistic simulation that works in general cases, but not edge cases.
Okay, I get it, it's defineately NOT simple to make water physics.
 
  • Like
Reactions: Sozin