Modify physics -get rid of viscosi -underwater model
-
- 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
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.
We don't have any of that, but yes. ODE does support basic dynamics. It's just killing an ant with a fusion bomb.
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
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.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
-
- 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
You're overestimating the level of coupling between graphics and physics.
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
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?
-
- Elite
- Posts: 1567
- Joined: Tue Jan 26, 2010 2:03 am
Re: Modify physics -get rid of viscosi -underwater model
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
-
- Elite Venturer
- Posts: 753
- Joined: Sat Apr 15, 2006 2:40 am
- Location: chthonic safety
Re: Modify physics -get rid of viscosi -underwater model
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.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.
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.
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
-
- 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
Joints are a lot more than what turrets need.TBeholder wrote: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.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.
...
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.
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).
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
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.
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.
-
- 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
If you make it a patch, please add it to the patch tracker in SF.
I will apply it (after making it configurable).
I will apply it (after making it configurable).
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
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..
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..
-
- Bounty Hunter
- Posts: 153
- Joined: Sat Oct 22, 2011 9:17 am
Re: Modify physics -get rid of viscosi -underwater model
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?
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
Just uncomment the line
//std::cerr << "Unit (" << gravitationtarget->name << "):"<<planet->name << "):"<<r.Magnitude()<<" " << std::endl;
and you will see magnitude in stderr.
//std::cerr << "Unit (" << gravitationtarget->name << "):"<<planet->name << "):"<<r.Magnitude()<<" " << std::endl;
and you will see magnitude in stderr.
-
- 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
Sounds like fun... Can't you just imagine shooting someone's engines out near a planet and watching them slowly crash? 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!
-
- Elite
- Posts: 1567
- Joined: Tue Jan 26, 2010 2:03 am
Re: Modify physics -get rid of viscosi -underwater model
hehe ok Dr. Evil, no more sharks with frikkin lasers for you!
Last edited by pheonixstorm on Mon Nov 28, 2011 6:54 am, edited 1 time in total.
Reason: Changed to better smiley hehe
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
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
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...
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...
-
- 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
Gee, and I didn't even start on the psycho laser. So, what would you use gravity for?pheonixstorm wrote:hehe ok Dr. Evil, no more sharks with frikkin lasers for you!
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
Priori collision system finished.
Currently the HUD displays unit name and time to collision.
Will send updated cockpit.cpp soon to test.
Currently the HUD displays unit name and time to collision.
Will send updated cockpit.cpp soon to test.
-
- Elite
- Posts: 1567
- Joined: Tue Jan 26, 2010 2:03 am
Re: Modify physics -get rid of viscosi -underwater model
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
-
- 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
When collision time is under 10 sec maybe it will cue a nice little audio file: "Proximity Alert! Proximity Alert!"
-
- 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
Correction: when collision is avoidable if immediate action is taken. When it is unavoidable, it should say "eject! eject!"
-
- 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
And can it do the math to plot an intercept course?
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
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?
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?
-
- 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
Actually, while potentially useful, especially for AI, I was being silly as much as anything.BEZ_BASHNI wrote:Interseption course is not a big deal...
-
- 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
Best thing would be to make a patch and upload to the patch tracker.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.
Python is just too slow for AI. The capabilities are there, but largely unused because of that.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?
-
- Merchant
- Posts: 53
- Joined: Wed Nov 16, 2011 7:00 pm
Re: Modify physics -get rid of viscosi -underwater model
Will appreciate if somebody will do it not for the test version I'm using...klauss wrote:Best thing would be to make a patch and upload to the patch tracker.
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
Eve online have 100% python engine....Only gfx functions are done in C++...Python is just too slow for AI. The capabilities are there, but largely unused because of that