Please submit bugs and omissions here

Posted By: Marco_Grubert

Please submit bugs and omissions here - 03/24/04 07:38

I am starting with a major overhaul to the physics engine today. Since I may have missed some earlier bug reports please post relevant links or screenshots here. Even better: if you have a level that clearly demonstrates the problem send it to mgrubert@conitec.net and I will get on it right away.
Posted By: ventilator

Re: Please submit bugs and omissions here - 03/24/04 07:56

after version 6.00.6, physics entity vs. non-physics entity collision wasn't as reliable as before. no matter if my.polygon is on or off for the hit entity, physics entities often rocket around much too extreme after a collision.

it can be seen with the crane simulator for example. try to shoot some balls at the base of the crane with the current engine version!

it would be nice if you could get polygon accurate collision to work with models like the slide i posted in the beta forum some months ago.

...
do you only fix problems or should we also post suggestions for new features?
Posted By: fastlane69

Re: Please submit bugs and omissions here - 03/24/04 14:58

The only "bug" I can account for 100% atm is the inconsistancy in the PE's handling of the angular variables. Setting torques seems fine, but using phent_getvelocity in a angular context is not fine.

Here's the thread and a more comprehensive discussion of the issue:

http://www.conitecserver.com/ubbthreads/showflat.php?Cat=&Number=288514&page=0&view=collapsed&sb=5&o=31&fpart=1

This bug is at, oh, 60% confidence:

I have my object drop from the sky under the influence of the PE. At one point I attached a Ball Constraint to the player and to the world. Point where it was fixed to the world was a few quants to the right of my object. What I expected to happen, happens...I swing. Problem is, if I take out all drag and friction, I should reach my starting height again, right? Energy conservation and all that muck. Yet each and every time, playing around with all manner of ph_correction and such, I ended up falling "limp", losing my swing, and just hanging out. There is nothing in my code that I can think of that would acount for this. It's almost as if *someone* forgot to WD40 the ball joints!

Finally, this bug is at 40% confidence:

In order to calculate my objects acceleration, I have old and new velocities stored as skills and I then calculate acceleration each timestep. Now, my project is C/S, but I have the server in non-dedicated mode so that it too has a player. What I have noticed, though I'm still not sure it's not MY bug, is that I start falling from the sky with relatively constant acceleration BUT the closer I get to the ground, the more wildly varing values of accel. I get. Since if I"m playing my player on the server, there should be no update lag, and even WITH lag, this selective discrepency is odd. Like I said, not sure that it's endemic to my code or some bug.

Posted By: Alexander Esslinger

Re: Please submit bugs and omissions here - 03/24/04 21:10

  • Add support for bones, so that the phyics engine can take controll over certain bones, which are then no longer animated, but simulated.
  • Add some sort of softbody physics based on springs

EDIT: Ups, I thought that omission means something like suggestion. But since I think the features are imported, I let them be .
Posted By: ventilator

Re: Please submit bugs and omissions here - 03/24/04 21:25

  • auto rest feature and better stacking performance without jittering
  • limits for ball joints
  • cylinder and capsule collision hulls
  • compound collision objects (fixed joints)
  • definable physics properties for individual level geometry surfaces
  • fix wheel bending
  • fix (sometimes) jumping wheels on flat ground at the edge of two adjacent level polygons
<edit> ...i couldn't resist to post some additional ones! </edit>

does a6 currently use ode 0.035 or 0.039? i read 0.039 is a big improvement but it has been released after the a6 release.

Posted By: William

Re: Please submit bugs and omissions here - 03/25/04 11:36

My list of features that I need Implemented.

- Ball Constraint Limits

- Cylinder Hulls

- Fix Wheel Bending(Major)

- Fix sudden erratic behaviour which randomly occurs with physics entities

- While using a wheel constraint physics entities leave its set position, and snaps back. This happens randomly as well, its almost as the wheel sticks to the ground for a fraction of a second then just snaps back. This hinders movement.

- Movement of a vehicle using the physics engine on terrain. Currently when a vehicle moves over a terrain it is tossed all over the place due to the amount of different angles of polygons it is traveling on. This is due to the wheel bending most likely. I also noticed that the wheel sticking problem is also more frequent on terrain.

- Allow events to be used with entities enabled in the physics engine.

The issue I have with the physics engine is the wheel falling through the terrain. I currently made a small fix of this but a real fix would be great. I know that I must send a build of the level with scripts to Conitec, and stated that I would do it before - I was very short on time so I never did re-send it. Next week, I'll send you and jcl the problem so you can review it. I'm sorry about the delay.

BTW, Will my old scripts using the physics engine be compatible once you implement the new version?

Very thankful, and glad to hear you started!
Posted By: Rhuarc

Re: Please submit bugs and omissions here - 03/25/04 12:02

Personally, I would like to see the following- it might restore enough faith to finally upgrade to A6 pro for the physics:

- Make it possible to "clamp" physics entities to bones on a model- it would save me weeks of coding and longer in debugging for my ragdoll physics (which check out on the concept models finally!!).

- Fix the axle bending problem

- Physics event handling (Major!)

-Rhuarc
Posted By: Phantom88

Re: Please submit bugs and omissions here - 03/31/04 01:53

Hehe, if you change anything on ODE itself be sure to post it on ODEs pages

~Phantom88~
Posted By: ventilator

Re: Please submit bugs and omissions here - 04/24/04 00:34

in 6.22 physics collision problems seem to be much more extreme at level polygon edges (but maybe i just didn't test that in earlier versions). marco please try to shot balls at the red debug mode lines in the crane level. the balls shouldn't reflect in these directions on a flat ground!

does the physics engine use the tesselated bsp geometry for collision? wouldn't it be better (less edges) if just the polygons from the blocks in the .wmp file were used?

...
could you reproduce the collision problems with shooting balls at the crane base now? this problem makes the physics engine unusable because it doesn't only happen with the crane but with most models on my pc!
Posted By: William

Re: Please submit bugs and omissions here - 04/24/04 14:12

After alot of work, I have effectively singled out exactly why certain physics entities have a tendancy to have bad collision on terrain! A while ago I posted about bad collision with physics entities and terrain. http://www.conitecserver.com/ubbthreads/showflat.php?Cat=&Number=320317&page=5&view=collapsed&sb=5&o=&fpart=1#320317 You also may remember that I had previously believed the problem had to do with my function names - I was wrong. After much testing, I've come to the the conclusion that the last entity enabled in the physics engine will have faulty collision detection on terrain! Whats weird is that the entites which previously had faulty collision, will suddenly have perfect collision detection, when another entity is enabled into 3dgsPE on terrain. This problem is much more wide spread then I first believed. Upon further testing I noticed that no matter what, whether there is an constraint or no constraint the last entity enabled into 3dgs PE will have faulty collision detection with terrain. Hopefully this will be an easy fix for you Marco. Simply check why the engine gives faulty collision detection between terrain and models which were enabled in the physics engine last. If you have any questions please ask - I know a few others had this problem, and I'll soon release the vehicle code with the "cheap fix".
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/26/04 14:09

2bit, is your faulty collision with terrain also include the "jitters"? In my applications, which are approximatly 100 single entity physics without any constraints, I have zero percent problem with fall though at any gravity setting (from 0g to ~200g) and within what I consider resonable velocities (less than or on the order of 1000q/s), but I have a big "jittering" problem where my entity jitters like popcorn on the gound and doesnt just lay there as it should. Marco had commented that this may have to do with the number and/or handling of the contact points.

As to your observation, I have a networked physics application where the client is registered with the PE upon login. Hence, the last client logged on is guaranteed to be the last player registered with the PE. I have observed no diffrent behaiviour from last registered to any registered...all my physics entities "jitter" seemingly at random.
Posted By: William

Re: Please submit bugs and omissions here - 04/27/04 09:40

Did you do your tests on terrain? Since everything works fine on block geometry. About the jittering, yes I've observed it many times, and it needs to be fixed. This isn't jittering though, since the last physics entity enabled actually intersects the terrain and goes down about 1/3rd then pops back up - only to repeat itself agian. Of course, I guess I can just apply the physics engine to some rock out in the middle of nowhere last, that way it will have the faulty collision and everything else will be good.
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/27/04 09:59

Yeah all my tests are on terrain (single terrain, ~300000 quants squared of area) and I'm telling you that this last entity theory does not pan out on my system.
I have more than one entity with the Jitters and the last entity is just as stable as teh first.
Further, with the jittering, there is not going through the terrain as you describe. It does not go through a third of the way like you say. It just "jitters".
Posted By: William

Re: Please submit bugs and omissions here - 04/27/04 10:06

Perhaps you need a vehicle with 4 wheel constriants to re-produce my problem. Since that is the only way I have tested it. I dont understand why it's not showing up for you like it is for me.
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/29/04 01:14

I've notcied since day one that most of the PE problems revolve around the constraint system, I bet you thats why we have diffrent results as I don't use constraints.
Posted By: BHoltzman

Re: Please submit bugs and omissions here - 04/29/04 02:33

Just a guess about the difference in behavior.

You may have different results with the same code on different systems because of the speed of the systems? Where the faster system is drawing more FPS so objects change position in smaller increments than with the slower system?
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 04/29/04 05:39

Quote:

You may have different results with the same code on different systems because of the speed of the systems? Where the faster system is drawing more FPS so objects change position in smaller increments than with the slower system?




The physics system is using constant step sizes of 1.0 / PH_FPS_MAXLOCK seconds.
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/29/04 06:55

Interesting. I had no idea that as I changed my fps_max, I also changed my physics stepsize. But they aren't really constant are they Marco? I can change fps_max and lock it through script after all.
Let me run some numbers:

fps_max=20---------> 50ms stepsize
fps_max=40--------->25ms stepsize

Both reasonable values.... but what about fps_max=240 as the default and fps_msz=400 as the maximum:

fps_max=240------------->4.2ms stepsize
fps_max=400------------>2.5 ms stepsize.

These *seem* awefully small stepsizes....

Three conclusions I'm drawing:

a)This *could* explain alot of the divergent behaiviour we are seeing as a result of using diffrent fps_max rates or using a step size inadequate for our game/sim. For example, people who leave they fps_max at default will have 240 physics steps calculated each second....hence the heavy physics load alot of people have observed.

b) I think Bholtz is onto somthing: Your formula seems to suggest an attempt to lock the physics simulation to the framerate, thus hopefully acheiving one PE update each frame update. But wouldn't this lead to a de-synchronization if the system can't pump out frames that fast? For eg, at fps_lock=240, the PE is updating every 4ms. But on a slow system, wouldn't trying to keep up this framerate mean that a particular frame could last MORE than the 4ms that the PE is updating for?

c) I always thought the stepsize would somehow adjust for the CURRENT or AVERAGE framerate and not locking into a preset MAXIMUM value. If fps_max=100, but your system can only pump out an fps=20, then the PE is IMO making 5 times as many calculations than necessary and these superflous calculations also carry with them 5 times as many errors.


I'm off to test some of the hypothesis I posited above; specifically make a fps_max vs. PE stability analysis. Another interesting nugget Marco thanks!
Posted By: ventilator

Re: Please submit bugs and omissions here - 04/29/04 06:57

FPS_MAX has nothing to do with PH_FPS_MAXLOCK!
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/29/04 07:26

Jebus H. Krist your right!!!

From the FAQ section (THE FAQ! geesh)...

Quote:

By default PH_FPS_MAX_LOCK is set to 70 fps. If FPS_LOCK is enabled and FPS_MAX is also set to 70 fps the simulation time will be synchronized. Setting FPS_MAX to, say, 35 will make the objects move at half their speed instead.




Which means I'm going right now and locking my framerate at 70!!! This explains why my objects seemed to fall so slow!

However, Point 3 is still valid; The PE has a static stepsize. Assuming the PE is doing some sort of ODE integration, every Physics simulation I have ever programmed takes an ADAPTIVE stepsize in order to better integrate the physics behaiviour and reduce error. For eg, (straight from "Numerical REcipies in C") 4th order static stepsize Runge-kutta has a error O(h^5). A naive adaptive routine, say Runge-Kutta-Felberg method have errors of O(h^6) and this error can be imporved upon further by more intelligent adaptive procedures (Richardson Extrapolation for eg). In my experience, a locked-in stepsize is asking for trouble no matter what stepsize you choose
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 04/29/04 07:46

Quote:

However, Point 3 is still valid; The PE has a static stepsize. Assuming the PE is doing some sort of ODE integration, every Physics simulation I have ever programmed takes an ADAPTIVE stepsize in order to better integrate the physics behaiviour and reduce error. For eg, (straight from "Numerical REcipies in C") 4th order static stepsize Runge-kutta has a error O(h^5). A naive adaptive routine, say Runge-Kutta-Felberg method have errors of O(h^6) and this error can be imporved upon further by more intelligent adaptive procedures (Richardson Extrapolation for eg). In my experience, a locked-in stepsize is asking for trouble no matter what stepsize you choose



Please keep in mind that Numerical Recipes (got it here in the office) was not written with game programming in mind. One of the design flaws Doug and I have been battling with regular A6 collision detection is that movement step sizes are scalable and not fixed. This makes it hard to have reproducable behavior (think game replay or consistent gliding) in certain situations. IMHO fixed step sizes with occasional frame skipping is the way to go. If I remember correctly there was a similar argument in Game Developer's Magazine concerning Havok about a year ago.

Your original criticism however is valid: if the framerate drops because of physics calculations being too slow then for the next frame it will be even slower, etc. until the system comes to a halt or whatever bottleneck exists (e.g. collision detection, constraint solving) is overcome. Currently no frame skipping is done because I have not run into this problem very often, but this is definitely something that I should add: if physics processing takes longer than a certain amount of time freeze the objects for a few milliseconds. That will lead to hickups in the objects' motion but keeps the system from stalling.
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/29/04 14:07

btw, I was thinking about this and had to ask, why 70???

At ph_fps_maxlock=70, the stepsize is 0.0142857142857... s.
It's trancendential and I don't know about using trancendentials as a stepsize, is there advantages?
Even if you round it, it still bring images of zenos paradox to mind and a trancendential stepsize that never "steps".

I would argue that another choice might tidy up your ODE system a bit?
In the range of 70, 64 gives a better alternative with a stepsize of 0.015625 s.
I prefer 80 though with a tidy stepsize of .0125 s.

Just curious.
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 04/29/04 14:48

Quote:

btw, I was thinking about this and had to ask, why 70???



It's an empirical value ;-)
I was testing various framerate settings and this was the lowest one giving acceptable behavior in terms of penetration detection and speed (lower -> objects pass through each other, higher -> too slow).
Since ph_fps_maxlock is queried every frame you can set it to whichever value you like at any time. That it's transcendental does not matter since it's chopped off to 32-bit floating point anyway. What would make sense though is to pick a value that can be represented exactly in IEEE754, so that N iterations of stepsize 1/N does yield 1.0.
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/30/04 01:25

Gotcha.

Is changing ph_fps_maxlock just a simple redef in cscript?

ie:

var ph_fps_maxlock=80;
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 04/30/04 04:16

Don't try to redefine, just assign a new value to that global variable. In main or elsewhere.
Posted By: fastlane69

Re: Please submit bugs and omissions here - 04/30/04 05:51

kk. gotcha. thx.
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 05/05/04 09:06

Quote:

after version 6.00.6, physics entity vs. non-physics entity collision wasn't as reliable as before. no matter if my.polygon is on or off for the hit entity, physics entities often rocket around much too extreme after a collision.


I fixed a bug related to that a couple of weeks ago. Don't know if this is what you were experiencing. Can you retry with the beta to be released tomorrow ?

Quote:

Hehe, if you change anything on ODE itself be sure to post it on ODEs pages.


Occasionally I contribute to ODE (e.g. I provided a solution to the stack crash problem) , but one reason why I picked this system is that they are not using this horrible GNU license but instead a developer-friendly BSD one.

Quote:

At one point I attached a Ball Constraint to the player and to the world. Point where it was fixed to the world was a few quants to the right of my object. What I expected to happen, happens...I swing. Problem is, if I take out all drag and friction, I should reach my starting height again, right?


Yes ideally you should reach the starting point again. Ideally adding 10,000 0.0001's should result in a value of 1.0, unfortunately it does not work that way. I did create a test script with a 16 quant sphere attached to (0,0,0) and starting 464 quants along the x-axis. It lost about half a degree per minute of swing time and still looked acceptable after 5 minutes. I can see though, why you would need a perfect swing for your MMUSCLE education. Maybe you can fake it by re-initializing the sphere after each cycle- just check whether the maximum displacement has been reached and call the init function again.
Here's the code used:
Code:

action InitSwing {
phent_settype(my, PH_RIGID, PH_SPHERE);
phent_setmass(my, 0.01, PH_SPHERE);
phent_setelasticity(my, 0, 0);
phent_setdamping(my, 0,0);
phent_setmaxspeed(my, 99999,99999);
var cons;
cons= phcon_add(PH_BALL, my, 0);
phcon_setparams1(cons, vector(0,0,0), nullvector, nullvector);
ph_setgravity(vector(0,0,-380));
}



Some more information on how the update is progressing:

* Add some sort of softbody physics based on springs
The beta will have experimental water surfaces that exhibit spring-mass like behavior.

* auto rest feature
Implemented.

* fix wheel bending
Done. (Reduces wheel bending in most cases- you can still make them bend by applying large forces).

* Movement of a vehicle using the physics engine on terrain. Currently when a vehicle moves over a terrain it is tossed all over the place
There was a bug which caused collisions to be missed on terrain, e.g. only three of four wheels would report terrain contacts at any given time.


* Allow events to be used with entities enabled in the physics engine.
What about EVENT_FRICTION? Which event types do you need?


Posted By: Rocko75

Re: Please submit bugs and omissions here - 05/05/04 19:57

Quote:

Some more information on how the update is progressing:

* auto rest feature
Implemented.

* fix wheel bending
Done. (Reduces wheel bending in most cases- you can still make them bend by applying large forces).

* Movement of a vehicle using the physics engine on terrain. Currently when a vehicle moves over a terrain it is tossed all over the place
There was a bug which caused collisions to be missed on terrain, e.g. only three of four wheels would report terrain contacts at any given time.




Perfect! Some problems less to worry about I hope - but one big Question stays open:

What about physik-enitys getting stuck in Level-Blocks? I'm working on a Racing Game and my Cars get very oft stuck in Level-Blocks (i.e. Edges of walls etc.). Once its stuck, it starts to move randomly inside the block, jump wildly and after a while is thrown at massive speed somewhere near Jupiter or Mars.

Can this be solved... or in any way be detected by my game? Currently I see no way, to detected if my car is stuck or not - so the user has to realize he can't move anymore and manualy reset his car to the last position. This very anoying and I haven't found any workaround yet!

Any solutions?

Thanx, Arnim.
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 05/06/04 05:08

Quote:

What about physik-enitys getting stuck in Level-Blocks? I'm working on a Racing Game and my Cars get very oft stuck in Level-Blocks (i.e. Edges of walls etc.). Once its stuck, it starts to move randomly inside the block, jump wildly and after a while is thrown at massive speed somewhere near Jupiter or Mars.


I ran some tests on that yesterday but it was working fine. I still have to find a way to reproduce this problem in a reliable way.
Posted By: Rocko75

Re: Please submit bugs and omissions here - 05/06/04 07:11

Quote:

I ran some tests on that yesterday but it was working fine. I still have to find a way to reproduce this problem in a reliable way.




I was quite successful, in reproducing this "explosions" in one of my levels. In this particular case, we asume a car, with four PH_WHEEL constrained wheels. Now we take alevel-block a litle above the floor, so the space below is to small for the car to enter, but on the other hand high enough for the engine hood of the car to go below. (Of course the engine hood is low at the front of the car and higher near the front-window) If you drive slowly under this block there is no problem, the car stops when the engine hood touches the bottom of the block. But if you go faster you get the problem, 100%, the car hood goes bellow the block, runs into its wheel constraints, everything gets stuck and volia, one big explosion and the car flies wildly into space.
Posted By: Marco_Grubert

Re: Please submit bugs and omissions here - 05/06/04 07:59

Okay, that explains the problem. What happens is that the hood partially enters the level block and then creates lots of contact points (polygon-polygon) depending on how far inside the block it is these contacts may be impossible to satisfy at the same time. Workarounds: don't use PH_POLY but rather PH_BOX for your car. This greatly reduces the number of contacts created. Decrease the CFM and increase the ERP values to make the car less squishy so it does not penetrate the level block as much. Check for EVENT_FRICTION and reduce forward motion while the car collides with the block.


Here's a quick overview of how penetration tests are done in A6:
There are two kinds of collision tests. One test is done at the beginning of each frame and when objects are slightly (!) intersecting the physics system limits the movement in that direction by a certain amount, (depends on setcorrections and constraint properties). If they are deeply intertwined or have a high polycount (with PH_POLY set) this creates lots of contact points that can become impossible to satisfy. E.g. two boxes at the same spot perfectly aligned would yield contacts in +X,-X,+Y,-Y,+Z, and -Z directions - where to go from there? Usually it's not as bad, yet bad enough to cause an explosion.

When no collision is detected at the beginning of the frame (e.g. they are 0.1 quants apart) the object is free to move in that direction. This would allow fast moving objects to be at position x before and at position x+wall_thickness after the physics update. To prevent object penetration I use c_trace to check whether the object's center has intersected a wall and if so move the object back a few quants so that it's bounding sphere touches the wall. This can fail because the object's center may not penetrate an object but the object's perimeter does penetrate it to a great degree (remember that small penetration is good, large penetration is bad).
Posted By: Rocko75

Re: Please submit bugs and omissions here - 05/06/04 18:37

Quote:

Check for EVENT_FRICTION and reduce forward motion while the car collides with the block.




I checked EVENT_FRICTION but this only works with collisions between Models, so a collision with the level is not detected at all!
Posted By: fastlane69

Re: Please submit bugs and omissions here - 05/07/04 00:44

Quote:

(remember that small penetration is good, large penetration is bad).






Not according to my girlfriends.
© 2024 lite-C Forums