Product Chat / Physics changes to the engine, comments please

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Oct 2018 19:50 Edited at: 12th Oct 2018 21:49


So I'm deep In the engine fiddling with more physics related stuff (yes I know I'm supposed to be doing particles but I'm learning multi-tasking) and this time I'm trying to balance mass/force/buoyancy related bits and pieces to make things behave more naturally.

The video shows progress so far and I'm looking for comments on how it's looking so far.

Also, for those I know are building maps with a water theme, how should I deal with buoyancy?

The solutions I've thought of are:
1) Add a 'buoyancy factor' parameter to fpe/editor to specify how an individual entity should behave.
2) Use the entity volume and weight and mathematically calculate a buoyancy value..
3) Add a Lua command to set the buoyancy value on a per entity basis.

or maybe a combinatioon of all three?

(by bouyancy factor I mean where in relation to the water surface level an entity will float)
Been there, done that, got all the T-Shirts!
PM
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 9th Oct 2018 20:42
Multiple choise is always good, great work by the way

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 9th Oct 2018 20:49
The thing that immediately sticks out to me about this is that the objects currently seem to be spinning around their origin points, but not around their centres of gravity. For example, those boxes would have stuff in right? That stuff would change their centre of gravity, make it lower (so instead of XYZ 0,0,0 it might be 0,-5,0). When shot, although they would spin, the objects would always tend back towards getting their centre of gravity as low in the water as possible. That's not to say they would spin back the way they came, just that they would wobble about a bit until the centre of gravity was balanced out.

Not entirely sure I explained that well, but do you get where I'm coming from?

AE
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Oct 2018 21:26 Edited at: 9th Oct 2018 21:27
Ah, well there is yet another variable to contend with! How on earth to represent, on an entity by entity basis, what the centre of gravity is!

Currently the engine calculates the 'mass' of an entities physics object based entirely on its volume multiplied by the 'weight' factor. Centre of gravity is pretty much the centre of the physical object itself, i.e. assuming an even density distribution.

How to deal with this is a whole nother can of worms!

Any buoyancy factor will only affect the entity when in water, centre of gravity, or centre of mass in technical speak, will affect how an entity behaves out of water as well.

The problem is that we have a huge amount of legacy entities which have neither buoyancy or centre of mass values, so how to make the engine deal realistically with these legacy entities?
Been there, done that, got all the T-Shirts!
PM
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 9th Oct 2018 23:48 Edited at: 9th Oct 2018 23:50
It's that panel at 0:35 that's breaking the illusion, and come to think of it, I'm not sure centre of gravity would fix it per say. The centre of gravity would be the centre of that panel. But in real life, you'd expect it to always quickly orient itself so it lay flat on the surface of the water, not upright as it does at 0:39. I guess it does this because the water is in itself exerting its own force up on the panel, and the panel seeks to balance this out by distributing the forces applied to it as equally over its mass as it can. But, like you say, how on Earth you figure out a numerical way to tell the engine on an entity by entity basis, 'lay this entity on the side that distributes its weight the most' is beyond me

And what about a sealed half-filled barrel of oil? All the weight sits in the bottom of the barrel on land, but in the water, it would lay on its side.

Don't worry too much about legacy entities for now. If it's just some parameters that can be added to the .fpe file, it's a simple notepad job.

AE
devlin
10
Years of Service
User Offline
Joined: 12th Feb 2014
Location:
Posted: 10th Oct 2018 06:14
simply amazing.
love the work you are doing,
thanks
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 10th Oct 2018 17:44 Edited at: 10th Oct 2018 17:46
I would say option 2 and 3 would be the best bet I would prefer not to have more fpe settings to set per entity myself. It defeats the purpose of having media to pick from as the next project you do will have the same fpe settings and so you have to make a copy or keep changing stuff all the time for different behaviour. Better to make that lua related or an in editor option or preferably both

I think Avenging Eagle is perhaps, being a little picky here. I'm sure something like that could be done with a local position on the object overriding the automatic stuff, but for me it's not a biggie at all. I'd probably never use it unless something really looked wrong.

The only thing I would say is the force may be a little weak for a gun hit. I've no idea in reality, but even an air pistol would move the small stuff faster

Nice stuff and about time GG got the physics stuff in properly I would say it's looking really good!
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Stab in the Dark software
GameGuru TGC Backer
21
Years of Service
User Offline
Joined: 12th Dec 2002
Location: Upstate New York USA
Posted: 11th Oct 2018 00:04 Edited at: 11th Oct 2018 00:06
In the Bullet Physics engine you need to use the compound collision shape
to be able to adjust the center of mass. The way it works is, it basically
creates a special container collision shape that is used to shift the entities
usable collision shape. This allows for shifting of the center of mass
before the collision shape is created. This compound collision shape can
be saved with the center of mass so it can be loaded with the object.
This video shows it in action but also shows using the convex hull decomposition
algorithm to calculate the compound collision shape using multiple convex collision shapes.
AmenMoses look into using the compound collision shape.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 11th Oct 2018 00:37
Very informative. Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 11th Oct 2018 08:52
I want convex hull decomposition in Game Guru so bad. Back when we had the ongoing polls about new features we'd like to see added, it was always at the top of my list.

AE
Blacknyt46
8
Years of Service
User Offline
Joined: 29th Feb 2016
Location:
Posted: 12th Oct 2018 07:03
That's Amazing!
Jim C
Wolf
Forum Support
17
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 12th Oct 2018 19:27
I am impressed.
The simplicity of GG's physics (especially in regard with real time lighting and shadows) has always kind of hindred my design choices. I love to see you make such promising headway in with it.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 12th Oct 2018 21:48
On the back-burner for a bit, I'm back on the par-tickles again.

I did a bit of research to see if anyone else using Bullet engine had a solution but no joy, basically it's an in progress, maybe, for version 3 sort of situation so I'm basically going to have to figure it out myself. The basic problem is that primitive shapes in Bullet have the centre of mass in the centre of the shape, i.e. box, sphere, cylinder (which is all GG uses at present for dynamic entities) whereas for this sort of floatation effect (where you don't actually have any 'real' water) it would be handy to be able to specify the COM separately from the centre of the shape.

I may be able to 'fake' it realistically enough for most uses by using the 'weight' modifier, that way you can fiddle with that value to get an entity to float deeper in the water to mimic an offset COM.


Been there, done that, got all the T-Shirts!
PM
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 13th Oct 2018 01:12
It would be good if anyone knows about a water buoyancy system written in Bullet could post a link to give us an idea of the how far others have got with this. I created something workable back in the ODE days with essentially four corners of the entity having their own body, and when it entered the water volume and each body was forced to the water line, it created a pretty good impression of a floating palette or box. Certainly a mile away from true Newtonian physics when it comes to water, but for games, you only need something that services the gameplay and if that task is jumping from floating beam to floating beam, it works quite well.

Perhaps when par-tickles are done, I can lend a hand to put something like this in place (unless someone heads us off with a great water buoyancy simulation done in Bullet).
PC SPECS: Windows 8.1 Pro 64-bit, Intel Core i7-5930K (PASSMARK:13645), NVIDIA Geforce GTX 980 GPU (PASSMARK:9762) , 32GB RAM

Blacknyt46
8
Years of Service
User Offline
Joined: 29th Feb 2016
Location:
Posted: 16th Oct 2018 09:24
I found this older forum from 2010 I think? I'm not sure if this could help in anyway? http://pybullet.org/Bullet/phpBB3/viewtopic.php?t=5234
Jim C
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 16th Oct 2018 12:20
This might be of help

https://github.com/kveratis/GameCode4/tree/master/Source/GCC4/3rdParty/bullet-2.79/Demos/HeightFieldFluidDemo

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM

Login to post a reply

Server time is: 2024-11-24 03:50:49
Your offset time is: 2024-11-24 03:50:49