Modify physics -get rid of viscosi -underwater model

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

ODE (not Odie :p ) is great for constraints, friction, joints.

We don't have any of that, but yes. ODE does support basic dynamics. It's just killing an ant with a fusion bomb.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

But, really, if you want ODE in VS, you don't need Ogre. In fact, it will be quite an overhead to try and bind it through Ogre
To test any physical engine I need visualization. In VS the visualization code is mixed with some physics, collision detection and speed limits... If someone will provide a physics stripped VS version where you press forward and a ships model and a camera just floats like x=x+1, it will be possible to build a new physics. But now I dont see much sence in sorting vs code mess.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

You're overestimating the level of coupling between graphics and physics.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Looks like I solve the ogre compilation iisue and now have small time to improve physics model.. Are there any docs about vs source besides poor comments in code?
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Modify physics -get rid of viscosi -underwater model

Post by pheonixstorm »

Whatever can be found in the wiki or in the developer focus forum. There was a thread there from last year I think from someone who was rewriting the physics.. not sure if it was even completed or not. Don't remember seeing any code either.. but should be some notes or ideas that were tossed around. Might be useful.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Re: Modify physics -get rid of viscosi -underwater model

Post by TBeholder »

klauss wrote:ODE (not Odie :p ) is great for constraints, friction, joints.
We don't have any of that, but yes. ODE does support basic dynamics. It's just killing an ant with a fusion bomb.
Joints look like a good idea to plug in all those subunits (and other additions), after all. This may be the worst side of VS as it is right now.
Another side is how easy it can be enhanced with dirty tricks (like variable precision). ODE at least seems to be transparent enough to be tweakable (e.g. collision joints vs. cache issue above) so far.
But yeah, if there was an engine with good support of collision, rigid body dynamics and joints, but without friction and world gravity/friction, that would be enough. The question is how much of an overhead we get with those features - if they are easily turned off, the number of unused features is not a big deal, even those that can't be eventually twisted to our purpose (friction is at least useable for landing).
So, a fusion bomb would be Bullet. ODE is more of a sledgehammer... and we have more than one ant at a time. :wink:
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

TBeholder wrote:
klauss wrote:ODE (not Odie :p ) is great for constraints, friction, joints.
We don't have any of that, but yes. ODE does support basic dynamics. It's just killing an ant with a fusion bomb.
Joints look like a good idea to plug in all those subunits (and other additions), after all. This may be the worst side of VS as it is right now.
...
The question is how much of an overhead we get with those features - if they are easily turned off, the number of unused features is not a big deal, even those that can't be eventually twisted to our purpose (friction is at least useable for landing).
So, a fusion bomb would be Bullet. ODE is more of a sledgehammer... and we have more than one ant at a time. :wink:
Joints are a lot more than what turrets need.

Joints are constraints about degrees of freedom, solved by transmission of forces. It simulates a lot more than a turret mount.

The overhead is in this technique of constraint resolution, which involves solving inequation matrices of hundreds of rows. It's complex, and it's error-prone (precision errors propagate horribly).
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Gravity finished!!!
Possible to orbit planet if you achieve appropriate speed.
Orbiting OGRE planet on a low height is a real fun...

I will try to make patches ,but here's a simple way to patch

1 step
file star_system_ generic.cpp

insert before void StarSystem::UpdateUnitPhysics( bool firstframe )
the following code:
---------------------------------------------

void StarSystem::ApplyGravity( bool firstframe )
{
//for (un_iter iter = physics_buffer[current_sim_location].createIterator(); (unit = *iter);) {
Unit *gravitationtarget=NULL;
//for (un_fiter iter = gravitationalUnits().fastIterator();
for (un_fiter iter = getUnitList().fastIterator();
(gravitationtarget = *iter) ; ++iter) {
//CYCLING THROUGH ALL UNIT,THAT CAN BE CATCHED WITH GRAVITY
Vector local_g(0,0,0);
Unit *planet=NULL;
for (un_fiter iter = gravitationalUnits().fastIterator();
(planet = *iter) ; ++iter) {
//Cycling through massiv units ,wich create 99.99% gravity in the starsystem
if (planet->isPlanet())
{

if (((Planet*) planet)->GetGravity()>0 && ((Planet*) planet)->GetRadius()>0 &&( planet!=gravitationtarget))
{
Vector r = (planet->Position()-gravitationtarget->Position());//Vector facing from unit to each planet
float distance=r.Magnitude();
float thisplanet_g=((Planet*) planet)->GetGravity()*((Planet*) planet)->GetRadius()*((Planet*) planet)->GetRadius()/(distance*distance);
r.Normalize();
r=r*thisplanet_g;
local_g=local_g+r;
// debug mode - will display acceleration for each unit caused by each planet
//std::cerr << "Unit (" << gravitationtarget->name << "):"<<planet->name << "):"<<r.Magnitude()<<" " << std::endl;

};
};
//"<<local_g.Magnitude()<<" "<< gravitationtarget->isPlanet()<<" "<<gravitationtarget->isUnit()<<"END" << std::endl;
};
//apply force here
gravitationtarget->Accelerate(local_g);

};
--------------------
step 2
file
star_system_ generic.h
insert before void UpdateUnitPhysics( bool firstframe );
the line
---------------
void ApplyGravity( bool firstframe );
-----------------

step 3
search in your file: star_system_ generic.cpp

for line : UpdateUnitPhysics( firstframe );
and insert before it a line
void ApplyGravity( bool firstframe );

(shoud appear around line 799 and 850 )

step 4.
file universe_generic.cpp
after the line:
ss->UpdateUnitPhysics( true );

insert:
ss->ApplyGravity( true);



Thats it.. Enjoy orbital flights.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

If you make it a patch, please add it to the patch tracker in SF.
I will apply it (after making it configurable).
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Patch uploaded .
Should work on latest release. I cut off orge lines.
Gravity works well on units and planets.
I debug it on modelview.mission.
Forgot to add to the patch the patch for movelview .mission -we need to add gravity to the local sun in the xml...But will work fine without it also.

To test the patch you can :
1. Approach planet.
2.Disable FCMP
3. See your ship falling to the planet with the increasing speed.
4. Enable FCMP and stabilize the speed.
5. Jettion some cargo out and see it falling to the planet.

On a small planet it is possible to reach speed in range-5000 ms-10000 and make the ship rotate aroud the planet forewer with FCMP off and engines off.(orbit simulation)
If you will jettison some cargo out it will stay on the orbit..
Hicks
Bounty Hunter
Bounty Hunter
Posts: 153
Joined: Sat Oct 22, 2011 9:17 am

Re: Modify physics -get rid of viscosi -underwater model

Post by Hicks »

Any chance we can get some coding to display magnitude and diraction on the interface? just so we know what the force is and where its coming from?
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Just uncomment the line
//std::cerr << "Unit (" << gravitationtarget->name << "):"<<planet->name << "):"<<r.Magnitude()<<" " << std::endl;
and you will see magnitude in stderr.
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

Sounds like fun... Can't you just imagine shooting someone's engines out near a planet and watching them slowly crash? :twisted: Add some simple atmosphere dynamics (primarily drag and heat building to damage) and get leech/EMP weapons working better. (In my mind leach weapons puts a load on the shields drawing them down, then draining your primary and SPEC capacitors, and finally kills the reactor temporarily by "simulating an imminent field collapse triggering an emergency shutdown and reset" which also kills the flight computer while EMP kills the flight comp. and deals varying amounts of damage to electrical systems while leaving armor untouched.) This would make gravity it's self a weapon!
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Modify physics -get rid of viscosi -underwater model

Post by pheonixstorm »

hehe ok Dr. Evil, no more sharks with frikkin lasers for you! :twisted:
Last edited by pheonixstorm on Mon Nov 28, 2011 6:54 am, edited 1 time in total.
Reason: Changed to better smiley hehe
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Started working at collision detection for fast-moving objects.As well as ODE implantation. ODE cannot solve collision detection at high speed by itself.
Trying to find a good opensource model , but now I 'm not sure it exists.
To finish with gravity I need :
1 Some system visualisation wich will draw all orbits .
2.Autopilot update which will popup screen where the user can choose the way to approach planets or stations - simlest- first jump point will have to be on the same plane with orbit - second jump the tangent to the orbit with a meetingpoit with a target..
3. Collision system...

I see no problem detecting collision of high-speed objects with a limited maneuverability..
I want to make some sort of output on the hud were will be the objects and the time to contact,that the ship will meet on it way with the current course...
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

pheonixstorm wrote:hehe ok Dr. Evil, no more sharks with frikkin lasers for you! :twisted:
Gee, and I didn't even start on the psycho laser. So, what would you use gravity for?
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Priori collision system finished.
Currently the HUD displays unit name and time to collision.
Will send updated cockpit.cpp soon to test.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Modify physics -get rid of viscosi -underwater model

Post by pheonixstorm »

so does this mean the cockpit is gonna start screaming at us?? "Arrrrrgh we're all gonna die!!!" or maybe a little evil bill n ted.. "Aim for the cat dude aim for the cat!"
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

When collision time is under 10 sec maybe it will cue a nice little audio file: "Proximity Alert! Proximity Alert!"
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

Correction: when collision is avoidable if immediate action is taken. When it is unavoidable, it should say "eject! eject!"
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

And can it do the math to plot an intercept course? :twisted:
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Interseption course is not a big deal...

Q1: Where to put test version of cockpit.cpp ?- I cannot a upload files to forum.
Q2: What happened with python scrips in VS... Looks like they used only for bases and mission creation and ai is not operated by python anymore?
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

BEZ_BASHNI wrote:Interseption course is not a big deal...
Actually, while potentially useful, especially for AI, I was being silly as much as anything. :wink:
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

BEZ_BASHNI wrote:Interseption course is not a big deal...

Q1: Where to put test version of cockpit.cpp ?- I cannot a upload files to forum.
Best thing would be to make a patch and upload to the patch tracker.
BEZ_BASHNI wrote:Q2: What happened with python scrips in VS... Looks like they used only for bases and mission creation and ai is not operated by python anymore?
Python is just too slow for AI. The capabilities are there, but largely unused because of that.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

klauss wrote:Best thing would be to make a patch and upload to the patch tracker.
Will appreciate if somebody will do it not for the test version I'm using...
heres the file -
the procedure is in one file -later I plan to move it outside...
The code is compatible with all last versions...

http://www.bez-bashni.com/cockpit.cpp
Python is just too slow for AI. The capabilities are there, but largely unused because of that
Eve online have 100% python engine....Only gfx functions are done in C++...
Post Reply