Sign in to follow this  
abaraba1

Common bug(s) in PhysX, Havok and Bullet SOLVED! - fixed timesteps/maxSubStep

Recommended Posts

hello everybody, this new algorithm can fix quite a few problems, some that you knew about and some that you never thought were possible... this is so unbelievably important, because, this is one function that you will be calling the most in your entire real-time animation application / game ..quite literary - on every single STEP on the way ..and sometimes even more than once //--------------------------------------------------------- nVidia PhysX Tips: # Trade off fixed timesteps: * A lot of substeps: physics can be the bottleneck * Few substeps: moon gravity effects //--------------------------------------------------------- it practically solves both problems related to subSteps/maxSubSteps, simply because it does not introduce any max number of anything ..there is no need to guess such thing at the design time, we can always measure the time and act accordingly in a real-time ready? lets go.. lets define UNDERSAMPLING, whatever that word really means, in this story we will (re)define it like this: # simFixedStep (fixed simulation time step) # deltaTime (time used to render last frame) eg. A) slow computer + max. game settings + complex scene geometry + many moving objects = UNDERSAMPLING, practically it means this: --------------------------------- deltaTime > simFixedStep --------------------------------- ..say, real-time measurement shows less than 60FPS and our constant, built-in simFixedStep= 1/60 seconds ..where expected result is to keep AVERAGE simulation frequency at steady, fixed rate regardless of 'deltaTime' ..but really, we have situation like this: # anmDT (time used to render the whole scene once) # simDT, N (time used to complete one simulation step, number of iterations) # deltaTime= (simDT * N) + anmDT (time used to simulate and render last frame) although obvious, this may pass unnoticed - "undersampling" is theoretically and practically only possible if the time to execute one simulation step is smaller than the fixed time step being simulated ..in a real-time that is +++ "Half-solution A" ..here's 2nd scenario and one of the ways to avoid spiraling singularity by treating it as a 'special case' ..it is actually your old algorithm until simDT >= STEP at which point we have no choice but to slow down the simulation speed if we insist to stay with the same fixed time step - the difference is that this implementation will not spiral "down to death" and no capping will occur which should result in smoother animation and still preserve accuracy and determinism... furthermore, this little addition will try to compromise between keeping high FPS and high as possible simulation frequency depending on fpsTensor variable.. //-------------------------------------------------------------------------------- float accum= 0.0f float simDT, anmDT; float STEP= 1.0f / 100; int cnt, fpsTensor= 30; while( theBeatGoesOn ) { nowTime= getCurrentTime(RTN_SECONDS); accum+= deltaTime= nowTime - lastTime; anmDT= deltaTime - simDT; if(cnt>0) simDT/= cnt; lastTime= nowTime; cnt= 0; while( accum >= STEP ) { cnt++; stepSimulation( STEP ); accum-= (simDT >= STEP)? simDT+(STEP*anmDT*fpsTensor) : STEP; } simDT= getCurrentTime(RTN_SECONDS) - lastTime; renderScene(); } //-------------------------------------------------------------------------------- (R)All rights reserved, dont you dare use this code unless you can prove to me you're human being. Use of this algorithm in commercial products without my permission will be cheerfully taken to court. //-------------------------------------------------------------------------------- *** [BULLET IMPLEMENTATION] in "btDiscreteDynamicsWorld.cpp" replace "btDiscreteDynamicsWorld::stepSimulation" with this: //------------------------------------------------------------------------------ #include <stdio.h> static btClock realTime; double simDT, anmDT, STEP; double secCnt, deltaTime = 0.0; int cnt, FPS, SPS, fpsTensor= 60; int btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep) { deltaTime= double(realTime.getTimeMicroseconds())*0.000001f; if(deltaTime > 0.75) deltaTime= 0; STEP= fixedTimeStep; m_localTime+= deltaTime; realTime.reset(); FPS++; saveKinematicState(fixedTimeStep); applyGravity(); anmDT= deltaTime - simDT; if(cnt > 0) simDT/= cnt; cnt= 0; while( m_localTime >= fixedTimeStep ) { cnt++; SPS++; internalSingleStepSimulation(fixedTimeStep); m_localTime-= (simDT >= STEP)? simDT+(STEP*anmDT*fpsTensor) : STEP; } synchronizeMotionStates(); clearForces(); simDT= double(realTime.getTimeMicroseconds())*0.000001f; return cnt; } //------------------------------------------------------------------------------ ...re-compile and voila ...no more moon-walking! there is no need to change anything anywhere else, it completely disregards the timeStep and maxSubsteps that your games, demos and Bullet demos pass as arguments, they not really required to be supplied if this function is supposed to deal with time allocation anyway ..in case you have fast CPU im not sure if you will notice anything because everything will work as before.. or maybe even better? ..but if you try benchmark demos or have slow CPU you will definitively notice the difference, if you used maxSubSteps > 1 this is still only half-solution and it goes ON when (simDT >= STEP), that is when one simulation step need same or more time to execute than what is 'fixedTimeStep', it seem to be quite nice and visually smooth effect... but until then, its just like the old algorithm - bit choppy as simDT gets close to STEP - its a *VISUAL BELL* that tells you to lower down your simulation frequency or optimize the physics... former can be included in algorithm so it handles it automatically if that is acceptable for the end application, so that fpsTensor work left and right in regards to fixedTimeStep and pivot simulation speed and animation around desired FPS keeping it smooth on both sides around that critical fixedStep value # anmDT (time used to render the whole scene once) # simDT, N (time used to complete one simulation step, number of iterations) # deltaTime= (simDT * N) + anmDT (time used to simulate and render last frame) # FPS, SPS (animation Frames.Per.Sec, simulation Steps.Per.Sec) [ simulation SPS & animation FPS only exist as a real-time measurements, its a bit misleading to talk about Hz/FPS in design-time, that's only what you HOPE FOR, but on the program level you are really dealing in "deltaTime" and "simFixedStep" values only ..and what we are trying to do here is to average those STEPS and FRAMES per real-time second, which then maybe can be called "temporal interpolation", but im not quite sure what is the point of "geometrical interpolation" these physics libraries use today, it seem to be just unnecessary and artificial way to "smooth" the visual artifact produced by capping the number of subSteps ] cheers, http://www.geocities.com/ze_aks/ http://www.geocities.com/ze_aks/myos [Edited by - abaraba1 on September 14, 2008 8:04:23 PM]

Share this post


Link to post
Share on other sites
Definitely interesting post. What advantage does that have over the simplistic accumulator approach?


real accum = 0;

game loop
{
const real FREQ = 1.0 / 60.0, MIN_DT = 1.0 / 10.0; // 60 FPS integration, min. 10 FPS
for (accum += min(dt, MIN_DT); accum => FREQ; accum -= FREQ)
integratePhysics(FREQ);

render();
}

Share this post


Link to post
Share on other sites
thats it.. how wonderful!

- so where were you hiding all this time?
- why didnt you tell us about it before?
- why all the 3 mayor Physics engines have implementation with *maxSubsteps*?
- and why is such a confusion around such a simple thing?


>>"What advantage does that have over the simplistic accumulator approach?"

im not sure, i just got around realizing all "this" a few days ago.. and it took a month of confusion trying to figure out what in the world is going on?!!

i basically constructed algorithm around so i can prove to people why is old algorithm with maxSubSteps bad and why we must not have any MAX number of anything ..and no one actually believed me!?


but you got it to the point really.. beautiful!


anyway, i feel you know more about all this then i do,
so what do you think how these two compare?


cheers


[Edited by - abaraba1 on September 8, 2008 5:42:45 AM]

Share this post


Link to post
Share on other sites
all right,
i'll do my inner dialog thing again,
but everyone is of course welcome to join any time ..whether to improve algorithm or to explain why PhysX, Havok and Bullet use maxSubSteps?


"simplistic accumulator"
lets turn few things around, make it bit more general and we get something like this, that can too effectively substitute Bullet's stepSimulation() function:

//------------------------------------------------------
int btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep)
{
m_localTime+= (timeStep < fixedTimeStep*2)? timeStep : fixedTimeStep*2;
saveKinematicState(fixedTimeStep); applyGravity(); maxSubSteps= 0;
while( m_localTime >= fixedTimeStep )
{
internalSingleStepSimulation(fixedTimeStep);
m_localTime-= fixedTimeStep; maxSubSteps++;
}
synchronizeMotionStates(); clearForces();
return maxSubSteps;
}
//------------------------------------------------------

again,
there is no need to change anything anywhere else

- maxSubSteps is completely disregarded and used as a counter
- this time you need to supply deltaTime, here called timeStep

main loop:
dt = timeSinceLastFrame();
stepSimulation(dt);
//stepSimulation(dt, 0, 1.0/60);

renderScene();


..solution B is simply about switching simulation frequency which might suit some cases better,
but the one above is probably more general and give desired visual effect considering the circumstances
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------



- it basically replaces all this,
and i suppose there is similar equivalent of "maxSubSteps" implementation in Havok, PhysX, ODE, Newton.. ?

****** ORIGINAL STEPPING FUNCTION with "maxSubSteps" ******
//---------------------------------------------------------------------------
int btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep)
{
startProfiling(timeStep);
BT_PROFILE("stepSimulation");
int numSimulationSubSteps = 0;
if (maxSubSteps)
{
//fixed timestep with interpolation
m_localTime += timeStep;
if (m_localTime >= fixedTimeStep)
{
numSimulationSubSteps = int( m_localTime / fixedTimeStep);
m_localTime -= numSimulationSubSteps * fixedTimeStep;
}
} else
{
//variable timestep
fixedTimeStep = timeStep;
m_localTime = timeStep;
if (btFuzzyZero(timeStep))
{
numSimulationSubSteps = 0;
maxSubSteps = 0;
} else
{
numSimulationSubSteps = 1;
maxSubSteps = 1;
}
}

//process some debugging flags
if (getDebugDrawer())
{
gDisableDeactivation = (getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0;
}
if (numSimulationSubSteps)
{
saveKinematicState(fixedTimeStep);
applyGravity();

//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
int clampedSimulationSteps = (numSimulationSubSteps > maxSubSteps)? maxSubSteps : numSimulationSubSteps;

for (int i=0;i<clampedSimulationSteps;i++)
{
internalSingleStepSimulation(fixedTimeStep);
synchronizeMotionStates();
}

}
synchronizeMotionStates();
clearForces();

#ifndef BT_NO_PROFILE
CProfileManager::Increment_Frame_Counter();
#endif //BT_NO_PROFILE
return numSimulationSubSteps;
}
//---------------------------------------------------------------------------

[Edited by - abaraba1 on September 12, 2008 7:12:14 PM]

Share this post


Link to post
Share on other sites
hi agi_shi,

could you tell us what Physics library do you use and could you point some reference that talk about this "simplistic accumulator"? ..i find that term did not really exist and does not return any search results, so id appreciate if you can point where did you find about it and if there is something i failed to notice about the whole thing?

anyway, as it seem you have been using this much longer than i managed to test it in the last couple of days - could you share some of your experience with stepping the simulation in fixedTimeSteps?



thank you


//---------------------------------
all kinds of feedback/comments appreciated.. anyone?

Share this post


Link to post
Share on other sites
hi grhodes_at_work,

- could you please give some comments on the whole subject?
- can you confirm that algorithms indeed work in practice as i described?
- would you agree that this is nicer design solution with much better visual results?


thank you

Share this post


Link to post
Share on other sites
..surely this is in everyones interest and someone could at least confirm am i right or wrong?

i can only test it as much, and i ask everyone for help,
hope thats not too much to ask.. after all, if it works then we all benefit, right?


thank you

Share this post


Link to post
Share on other sites
Quote:
Original post by agi_shi
Definitely interesting post. What advantage does that have over the simplistic accumulator approach?


real accum = 0;

game loop
{
const real FREQ = 1.0 / 60.0, MIN_DT = 1.0 / 10.0; // 60 FPS integration, min. 10 FPS
for (accum += min(dt, MIN_DT); accum => FREQ; accum -= FREQ)
integratePhysics(FREQ);

render();
}


If dt is based on real time there's the possibility that the time taken to simulate it causes an increase of dt to the next loop. On a bad system that may cause dt to keep increasing over several loops, and there'll be a long time lapse between visual updates, so it looks choppy.

It seems abaraba1's algorithm is intended to cause shorter/smoother time lapses, but slow motion instead (though I must say I'm not clear on all details in the code). So if I understood it'll look smoother and still be stable, is that right? (Question to abaraba1)

Quote:
Original post by abaraba1
- and why is such a confusion around such a simple thing?


Because time steps are used in both graphics and physics, and games require both, while their respective implementations are different. Some people wants graphical speed, other wants physical stability and realistic time, so discussions about time steps don't end with one answer, but several answers, and those cause the confusion over which to choose, I believe.

Lastly I want to recommend a good "A discussion about fixed time steps"-thread that's worth reading.

Share this post


Link to post
Share on other sites
thank you my friend,
you are my 1st normal human contact with the "world community" and i've been trying to discuss this for over a month during which i've been met with strong resistance and disapproval, i've been told nothing but how i "do not understand" and "not getting the point"... i've been banned from public forums merely for asking a questions and trying to figure this thing out ..then, after that - complete silence?!

thanks again!



>>"So if I understood it'll look smoother and still be stable, is that right? (Question to abaraba1)"

yes,
in essence - instead of to cap number of iterations you "cap" or "scale"(with the 1st algo) the accumulator/deltaTime which is in practice very similar thing only the later appear smoother because of the way how the FRAMES get *distributed* in the real time - but indeed it is a difficult thing to imagine..

Unfortunately, no one can be told what the 'temporal interpolation' is. You have to see it for yourself.


ahm.. so, regardless of everything,
i would like to recommend and suggest Bullet physics library if for nothing else but just to test this and practically SEE what is the difference. Bullet library will compile quickly and easily on Windows, Linux or Mac, it comes with lots of demos that compile and build automatically when you build the library. In a matter of minutes you could try to copy/paste algorithm from above, recompile and you will definitively notice the difference and see what is this all about by running the Bullet demos again.

http://www.bulletphysics.com/Bullet/wordpress/



>>"Lastly I want to recommend a good "A discussion about fixed time steps"-thread that's worth reading."

thanks, i wish i knew about it sooner.. that is exactly what im talking about, so in case some people having trouble to read my 'funny english' i too recommend that thread as a good read..



cheers

[Edited by - abaraba1 on September 14, 2008 10:31:54 PM]

Share this post


Link to post
Share on other sites
The problem solved by abaraba1 is real, e.g., the problem solved here can and does sometimes occur in real-time simulations. Dim_Yimma_H described what is going on here rather elegantly, in a post near the (current) end of the thread (and that post really serves as a helpful introduction to the whole discussion). In fact, in really bad cases, the frame rate can increase to effectively infinity, e.g., the whole application can ultimately enter into a near infinite loop, since the number of simulation steps (at a fixed STEP integration time step) could increase forever. This is an indication of (among other things perhaps) a physics model that is poorly balanced for the target hardware platform.

It appears to me that the solution presented in the first post should indeed prevent the simulation loop from approaching infinite time due to an ever-increasing frame time, in the case that (simDT*N)+anmDT > the last frame time. I really have no time to go and test the solution. The simple heuristic that abaraba1 presents for artifically limiting the number of simulation steps (e.g., the "accum -= ..." line in the generic solution inside the simulation loop) may work well in practice, but I cannot say. I can say that it is only one of many heuristics, and others would likely work just as well.

So, I like that this thread discusses an issue that doesn't always come up when talking about fixed time step simulation in the game loop. It isn't the first time this has been discussed, but it's nice that it is a dedicated thread. The presentation was a bit long and rambling, and the purpose wasn't really made clear (the way I read it) until Dim_Yimma_H wrote a response.

I do not like that there is a claim of intellectual property rights claim in the original post, e.g., the claim of legal action if the algorithm is used in commercial products without permission. First, if you are going to post something that is proprietary and requires a license, please do not post it unless you warn people that you are showing a secret. At the very least, write your proprietary notice at the beginning of the post. And, really, proprietary information should not be posted here in public threads, in my opinion. If you have something you want to protect, host it on your own website with a clearly marked license agreement. Further, if you are offering to negotiate a commercial license, you need to provide a legal business address with an official way to contact you should someone wish to pursue such a license. That is missing here...a gamedev.net forum account is unsuitable as a legal point of contact. Secondly, I do not believe this algorithm is protectable under intellectual property rules (my opinion. I am not a lawyer.) I am certain there is prior art. Even a thorough search of the gamedev archives will turn up discussions of this problem and potential solutiosn. I've written about it myself, in fact, thought without (I think) suggesting a specific solution in pseudo- or real code. My guess is that many existing commercial games that use physics for eye candy already do something similar, and that (for example) the technical support provided by nVidia/Ageia, Havok, and others already advise customers to do something along these lines.

One more thing. An opinion. For a real game design, which might be expected to run on a variety of platforms that may be configured differently and so produce different frame rates, it is unlikely to be acceptable that the physics slows down if the physics is part of gameplay. Any game that uses physics for gameplay, rather than just eye candy, will need to tune the physics model (fewer objects, simpler collision shapes, etc.) to guarantee on the target platforms that the actual simDT is small enough to not cause the frame rate to grow...allowing physics to run at full speed (even with a few multiple fixed-size sim steps per frame). This type of tuning, where each component of the simulation (render, sim, AI, network, art loading, ...) are all balanced to fit a frame time slice is common practice in modern game implementation, and will continue to be done. At least for commercial game development, solutions such as the one presented here can be very beneficial to support eye candy physics, but I don't immediately see it as a huge benefit for gameplay physics.

So, to summarize, I see a simple solution to a very real problem, one that could be added to any game loop with a minimal of effort. For commercial games the solution is likely beneficial only for eye candy physics rather than gameplay physics. Users should be aware of the claim of intellectual property usage rights requirements, though I do not believe the innovation is protectable due to the existence of prior art (my opinion only...I am not a lawyer).

(P.S. I apologize if some of this seems harsh. Just giving my honest, straightforward opinion and pointing out some things that any forum member who peruses this thread should be aware of, e.g., the legal stuff which really doesn't belong here.)

[Edited by - grhodes_at_work on September 16, 2008 2:35:46 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by abaraba1
in essence - instead of to cap number of iterations you "cap" or "scale"(with the 1st algo) the accumulator/deltaTime which is in practice very similar thing only the later appear smoother because of the way how the FRAMES get *distributed* in the real time - but indeed it is a difficult thing to imagine..

I tried your algorithm together with my own physics library (but without a computation I didn't understand) and it does indeed look smoother than before [smile]
(Of course, when adding a bunch of too many objects.)

The part I don't understand how it works is the following computation:
Quote:
Original post by abaraba1
+(STEP*anmDT*fpsTensor)

I like your idea of making it look smoother but allowing some slower motion, because it can make a game playable even on bad systems. I can understand though, if that makes the game easier, that some people still prefer striving for real time even when performance is bad. (Though, it may be possible to mark records/achievements under that condition with a symbol of invalidity.)

Quote:
Original post by grhodes_at_work
Dim_Yimma_H described what is going on here rather elegantly,

I'm glad to hear that, thank you!

Quote:
Original post by grhodes_at_work
Just giving my honest, straightforward opinion and pointing out some things that any forum member who peruses this thread should be aware of, e.g., the legal stuff which really doesn't belong here.

At first I thought that legal stuff was meant to sound amusing, with "prove to me you're human being", but in the end I'm not sure.

Share this post


Link to post
Share on other sites
Dim_Yimma_H,
>>"I tried your algorithm together with my own physics library (but without a computation I didn't understand) and it does indeed look smoother than before"

thank you!
now forgive me i'll skip over the rest of what you said as i want to keep this message as short as possible, but i'll address every single thing in my "conclusion" after i clear up some "side-stuff" that turned out to be an issue in this whole "thing", i dont want to discuss this side-stuff i want to get it out of the way and so we can continue to talk about algorithms

like this thing:
>>"At first I thought that legal stuff was meant to sound amusing, with "prove to me you're human being", but in the end I'm not sure."
//----------------------------------------------------------------------------


grhodes_at_work,
- thank you, i dont need to "fight" for this anymore


>>"The problem "solved" by abaraba1 is real.."

1.) could you remove the quotation marks then?
because, it practically solves one problem and address the other in the most desirable way considering the circumstances.

But maybe most importantly - IT SEEM TO REMOVE SOME ERRORS with original algo,
its about "geometrical interpolation" this physics engines use today - it seem that they first introduce the error, then try to fix it with something that in itself causes further inaccuracies - can you comment on that? tell me what Physics library you use and i'll show you exactly what i mean.




>>"The presentation was a bit long and rambling, and the purpose wasn't really made clear"


- obviously it turns out i have a problem communicating with the most of "the world" ...People are different. Cultures are different, languages are different, moral and ethical norms differ from family to family, form town to town, from country to country and from planet to planet (see Star Trek). English is not my 1st language, i use dictionary a lot and i have sense of humor that not many people get, unfortunately. So, please...


2.) Please give me an example of my "rambling" so i know what to avoid in the future. Please copy/paste sentence or two so i know exactly what do you mean by that, otherwise i can not improve, thank you.



3.) the purpose i said was this:
//---------------------------------------------------
* A lot of substeps: physics can be the bottleneck
* Few substeps: moon gravity effects
- it practically solves both problems related to subSteps/maxSubSteps..
//----------------------------------------------------------------------




4.) long? ..is that bad?
/------------------------------------------------------------------------
A) # deltaTime= (simDT * N) + anmDT
(time used to simulate and render last frame)

B) undersampling is only possible if the time to execute one simulation step is smaller than the fixed time step
/------------------------------------------------------------------------

that above is all the information necessary,
the rest was mostly copy/paste source code and explanation of practical workings for the ones who did want to learn more about it, the others could happily scroll down.. i basically repeat one and the same thing over and over again and trying to say it in many different ways and still could not make anyone believe for the whole month, so i was actually afraid it will be too short.. yet again

interestingly,
i got a lot of that "long post" comment in the last month,
at the end it always turned out to mean: -"eh, i can't really be bothered to read all that"..


- why is the "long" a bad thing? is your message not long?

at least i talk about an algorithm and give source code that just by itself is sufficient to understand the point if reader has some basic programming skills, i mean the algorithm is, what? ...3-5 lines long?

..and you talk about what YOU like and what YOU don't like.. i like cats by the way, but what does that has to do with the rest of us and what does that has to do with the matter in question?



5.)
>>"I DO NOT LIKE that there is a claim of intellectual property rights claim in the original post.."

- why? ..the reason?
i see copyright notes in every single source file i open on my computer,
why would companies and everyone else have such rights and not me?

again, i do not want to discuss this here, i want to get it out of the way - who do i talk to? where the information about this can be found?


but dont we all program so we could benefit from it in some way, say - money -, so maybe this actually is very interesting and important subject to anyone who comes up with new algorithms, new ideas, new Intellectual Property..

- but, do humans need such a thing at all?
- how is this connected to the IP nonsense related to poor video drivers and whole DRIVERS ON LINUX issue? why is there no full graphic accelerated drivers for kernels? why only drivers for windowing systems? wheres acceleration on PS2 Linux? whats all the "taboo" around the damn graphics drivers and algorithms?

that should be OURS!!
IP is rubbish, we mut SHARE and COMMUNICATE if we want to progress!

..this was my WHOLE POINT with silly copyright notice (btw, since then i got angry, so - patent pending ;-)



>>"..DO NOT post it unless you warn people"

- why?
unless you state the reason we dont know if you're actually right or wrong about that?

>>"And, really, proprietary information should not be posted here in public threads, in my opinion"

why not?
it is free for humans, for human public on public forums.. that, i hope, should cover most of us


>>"Secondly, I do not believe this algorithm is protectable under intellectual property rules"

ok, now you're getting close to my point,
but why does all this bothers you so much, all you say "don't do" and how you "don't like", but why?


>>"At least for commercial game development, solutions such as the one presented here can be very beneficial to support eye candy physics, but I don't immediately see it as a huge benefit for gameplay physics."

- there is no such categorization,
but even if there was the most of the benefit will actually be with "gameplay physics" or whichever "physics" is more computationally expensive



>>..the technical support provided by nVidia/Ageia, Havok, and others already advise customers to do something along these lines."

No!

they advise this:
* A lot of substeps: physics can be the bottleneck
* Few substeps: moon gravity effects

and this:
http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30262482.aspx

and this:
http://developer.nvidia.com/forums/index.php?showtopic=2203
http://developer.nvidia.com/forums/index.php?showtopic=2149




>>"I really have no time to go and test the solution."

it would have taken less time to test the solution than to write your e-mail, you as a moderator have a responsibility to make such an important issue CLEAR

by the number of visits to this thread its obvious people want to know, and since no one believes me - its you, as an authority, as a "Principal Scientist" to make it clear and explain it to the public if indeed my English and communication skills are that bad, its you who should correct it and make it clear instead of just pointing finger at what you do not like without giving any reason and explanation - im just an unemployed, uneducated dude, i dont know any better, but i did my best and did it to the boundaries of my ability - thats my excuse, whats yours?


I apologize if some of this seems harsh,
but you talk about everything else except what is important - the algorithm, about which you can not probably really talk unless you have seen it or tested it.

Share this post


Link to post
Share on other sites
Hi,

Maybe I'm misinterpreting something here (English isn't my first language either) but I can't get rid of the feeling that you're taking the algorithm a bit too seriously. It's not as if you found the holy grail of physics simulation. Still you're talking about the "responsibility" of moderators to promote "such an important issue". There's no such responsibility.

You're asking why this thread has so many views? Easy: the title suggest another appearance of someone who claims to have found the answer - like the one claiming to have found the solution for copy protection. Those threads tend to be quite entertaining, although in a sad way. It's not as if PhysX, Havok and Bullet have been created by a bunch of idiots, so if someone claims to have found a major bug and/or solution in all three implementation it's suspicious to say the least.

Luckily what the title suggests doesn't turn out to be true: you're actually very focused on one real problem and I really appreciate that. But the way you present your findings is simply disadvantageous: very long posts (which distracts people), no code tags (unreadable code), the explicit note of you taking everyone to court who uses the algorithm commercially.

Personally, I doubt that what you describe hasn't been done before and I also don't expect it to be "unbelievably important". But then again, I'm probably not in the position to evaluate it. If you think the algorithm you describe is of scientific importance write a paper about it and have it reviewed. Maybe you get published in an appropriate journal.

But please stop complaining about people not testing and worshiping your ten lines of code at once. People will acknowledge you where acknowledgment is due. You can't enforce it.

Please consider this post constructive criticism. No offense intended.

Share this post


Link to post
Share on other sites
So, you quote Galilei. Do you think that we're (I'm) ignorants just like the people back at Galilei's time? Or did you only want to bring an example of a case where it took a (long) while before someone got acknowledged? Or something completely different? Anyway, I think that a snappy catchphrase is not really useful in a discussion.

Share this post


Link to post
Share on other sites
>>"But please stop complaining about people not testing and worshiping your ten lines of code at once."

just test it please,
tho worshiping sounds amusing.. any feedback is welcome, i do like criticism, but you have to argue some point, you can not just go on saying stuff without an ARGUMENT, please read carefully every single word i said and feel free to QUOTE anything and then argue your point.. of course, you might save yourself some time if you do test it first - seeing is believing, i ask nothing more but you to see for yourself ..dont believe me, of course not!

i worship agi_shi's code,
i had it wrong way around at first, it was much uglier - thanks agi_shi, you're welcome any time to tell us more about it!


"People, I just want to say, you know, can we all get along? Can we get along? Can we stop making it, making it horrible for the older people and the kids?...It’s just not right. It’s not right. It’s not, it’s not going to change anything. We’ll, we’ll get our justice....Please, we can get along here. We all can get along. I mean, we’re all stuck here for a while. Let’s try to work it out. Let’s try to beat it. Let’s try to beat it. Let’s try to work it out."

[Edited by - abaraba1 on September 16, 2008 10:44:34 AM]

Share this post


Link to post
Share on other sites
>>"..write a paper about it and have it reviewed."
- where/who can review it?


>>"Personally, I doubt that what you describe hasn't been done before.."
- i agree,
and actually i never thought so ..but, how to go about finding that one out?


>>"..and I also don't expect it to be "unbelievably important"."
- in the context where this function is executed every 'tick' - yes,
because that might be a good place to optimize and if there is some error in this function it might accumulate and cause who knows what...

but really - no, you right.
this is whats really important:

//-----------------------------------------------------------------------------
it is a DESIGN TIME DECISION, this means that you must be aware of how much time it takes CPU to execute stepSimulation() - as same as you have little FPS counter at the design-time, so you should have "simDT" and if that number ever gets to "red" (close to fixedStep) you try to design with larger fixedStep or you try to optimize, basically im saying - its the CPU that is critical for determining and deciding on min. sys. requirements because of (simDT * N) ..GPU scales much better, smoother


in any case, in the design time,
you want to go for the LARGEST POSSIBLE fixedTimeStep you can get by (aiming at low frequency eg. 10Hz) just so you can support that lower class CPU or you have more time to render..
//-----------------------------------------------------------------------------


this is all still only my opinion of course,
Dim_Yimma_H is the only person in the world that confirmed it in practice, thanks!
hehee sorry to have dragged you into this, but you're the human-man, you'll be fine..

anyway,
even if it does work in practice that doesnt mean all my conclusions are correct

[Edited by - abaraba1 on September 17, 2008 9:13:42 AM]

Share this post


Link to post
Share on other sites
Don't worry, variety in discussion is probably a good thing!

I'm thinking about the computation that decreases the accumulated time, that distributes physics steps in an achievable manner. In the case when simulation time becomes longer than real time, the following code is used in the original post:
Quote:
Original post by abaraba1
accum-= (simDT >= STEP)? simDT+(STEP*anmDT*fpsTensor) : STEP

Logically, simDT, the current time that the simulation requires, must be included to be able to avoid freezing the simulation loop. In this case, simDT was divided by cnt from last frame, because that number of steps was nearly achievable, so it's the highest number of steps to aim for without risking to freeze the loop. (Though, I wonder if it's sometimes too many steps?)

If anmDT increases then it'll cause fewer physics steps, if it decreases then it'll allow more physics steps. What I don't understand, is if STEP*anmDT*fpsTensor is enough to free a particular time value, or if it's tweaking?

I'd wish to instead add the animation time divided over the physics steps. Though, I don't have any suitable debugging code now so I'm not sure about correctness.

[Edited by - Dim_Yimma_H on September 17, 2008 2:22:48 PM]

Share this post


Link to post
Share on other sites
Sorry, but I have to throw my $0.02 into the bin.

It appears as though the Moderator actually agreed with you...and acknowledged that this was a real problem in the physics realm. And it appears as though you did a great job of chopping up his post to make it appear as though he was just attacking you.

Secondly, as has previously been stated, it is not his job to promote your work. He is a person like everyone else, and his job is to moderate these forums as the name suggests. And last time I recalled, moderating had nothing to do with promoting.

And on a third note, I have to say that you do have a great find there. I don't want to detract any attention away from that.

Basically, the jist of my constructive criticism, is that it didn't appear that you read all posts fully before you respond to them.

Share this post


Link to post
Share on other sites
>>"accum-= (simDT >= STEP)? simDT+(STEP*anmDT*fpsTensor) : STEP"

i dont think that anyone would really want to use that in its original form,
the point with it was to show: -"..we can always measure the time and act accordingly in a real-time"


the whole difference between the algorithms is in the way how you control the number of the iterations, and that doesn't need to be explicitly:


//-------------------------- *** ORIGINAL algo - capping the NUMBER
cnt= 0;
time= 10;

maxSteps= 5;

while(time > 0 && cnt < maxSteps)
{
step(); cnt++;
time--;
}
//--------------------------
Iterations, cnt= 5
"Time left", time= 5




//-------------------------- *** 1st algo - scaling the TIME "inside"
cnt=0;
time= 10;

scaleFactor= 1;

while(time > 0)
{
step(); cnt++;
time--;
time-= scaleFactor;
}
//--------------------------
Iterations, cnt= 5
"Time left", time= 0





//-------------------------- *** 2st algo - capping the TIME "outside"
cnt=0;
time= 10;

if(time > 5) time= 5;

while(time > 0)
{
step(); cnt++;
time--;
}
//--------------------------
Iterations, cnt= 5
"Time left", time= 0




..does this make sense?





//------------------------------------------------------------------------
now, the problem with original is that you have to guess and it manifests in two ways under certain circumstances:
1.) guess was too low for target CPU - "moon gravity effect"
2.) no matter how high - on some target 'slow enough CPU' it will "spiral to death"

..which is not a "real problem",
because you can sort it out in design-time, but the peculiar thing is that it also seem try to deal with the reminder of the time after the iterations have finished, which i think only introduces the errors and its not really necessary ..or is it?

[Edited by - abaraba1 on September 17, 2008 11:41:58 PM]

Share this post


Link to post
Share on other sites
VizOne,

>>"So, you quote Galilei..."

- man, you say the darndest things i would never dare to even think..
im not faulting your logic here, so i guess i do need to explain what i meant

on all that what you said,
i just wanted to say: -"To be honest, it moves"

you can go on live your whole life thinking the earth is flat if you like, its not "important" information if you don't care about it, but if you use it in your line of work.. there was no point in arguing if you were not interested enough to pursue the matter for your own interests

my 1st association on possible interpretation was to Homer Simpson's comment on religion: -"..and all they ask for is a little bit of blind fate"
//-----------------------------------------------------------------------------



Halifax2,

>>"Sorry, but I have to throw my $0.02 into the bin."

- its most welcome



>>"..it is not his job to promote your work."

- true,
i only wanted him to make it clear, so i would not get more of those messages, which you can see i did get right after.. of course, who could blame him not being aware that Intel and nVidia could let something like this slip by

Intel & nVidia still silent.. i feel this was everyone elses job(work) but mine, i felt i did someones job without even being paid for that and then i had to chase them and beg them to even listen to me, its like im running after you to give you $100 and you poke me in the eye every time i get close, saying "its a fake" without even looking at it - yes, its insane

its not "my work",
this has nothing to do with PROMOTING, its in a form: like it? - take it!
im not working on any commercial games, i dont need to worry if my sales will be low because of some bugs in physics library.. i just found something and thought i should let 'you' know, where 'you' is everyone in the business of real-time simulation / games.




>>"And it appears as though you did a great job of chopping up his post to make it appear as though he was just attacking you."

- yes, i apologize,
the reason is that i lost it, i simply went crazy.. i gave up so many times - should i believe my two eyes or everyone else telling me "you not getting a point" - i came back every time, a bit more tired, but a much more crazier..

that was anything but personal,
at least he went out to talk and tried to compromise without being fully aware of the situation, but again, who could blame him.. that message was intended for Bullet, nVidia, Intel and ODE, but i could not get them to even say anything sensible at all

why they were/are not saying anything - i did/do not know, my best guess was that it has to do something with IP/copyright, so about the time when i got half-crazy i put that copyright note to "test" the reaction.. "test results" were amazing - conclusion: unclear

so, even if i wasnt crazy, which i was, i would most certainly be by now.. its a simple human mechanism that can protect you from the reality... rainbows and lollipops
(the problem is in turning it off)



thank you,
and thanks for pointing all that out



/-------------------------------------------------------------------------------
btw,
im not sure if i read this somewhere or was i dreaming of it, but i think that in "scientific" or maybe even any other discussion there is no need to say things like:
-"Please consider this post constructive criticism. No offense intended"
-"Basically, the jist of my constructive criticism.."

i believe every criticism is constructive as long as you state your reasoning or otherwise show the logic of your conclusion, i even believe you can go as far and say that im stupid as long as you can explain it or at least try to reason your opinion with some arguments

i also think i read somewhere that, in the discussion, you should state all your opinions as if they were absolute truth, even tho you doubt it all yourself - the "i think" is always assumed, and not really necessary to repeat all the time as in practice it indeed can not be nothing more but one persons opinion..



ahm ...have i told you about that time,
when i made the best Operating System in the world?

http://www.geocities.com/ze_aks/myos.html


...

[Edited by - abaraba1 on September 17, 2008 11:18:27 PM]

Share this post


Link to post
Share on other sites
in case it turns out that public forums are not really a best way to go about confirming this,
i have only one question:

>>"..write a paper about it and have it reviewed."

- where/who can review it?





/--------------------------------------------------------------------------------------------------
..in all my craziness, let me wonder for a second about all those crazy web-sites that claim perpetual-motion-machines, anti-gravity, water-for-fuel ..maybe even aliens and all that crazy stuff

surely if it was really real,
*someone* would have see to it that its tested, confirmed OR proven as hoax.. it would be impossible that all those crazy people would go on raving mad on their crazy web-sites and that no one would - at least - check it out


it really bugs me now,
why cant we, humans, make all that stuff, that is of such great importance, more clear?

[Edited by - abaraba1 on September 18, 2008 7:23:15 AM]

Share this post


Link to post
Share on other sites
Quote:
you are my 1st normal human contact with the "world community" and i've been trying to discuss this for over a month during which i've been met with strong resistance and disapproval, i've been told nothing but how i "do not understand" and "not getting the point"... i've been banned from public forums merely for asking a questions and trying to figure this thing out ..then, after that - complete silence?!


I'd like to jump in and give a quick comment on this snippet. A possible reason not many people respond is that you're posts are largely illegible. There is no formatting whatsoever. Please compare you're posts to the ones by Dim_Yimma_H and grhodes_at_work.

Their posts have:
- Paragraphs.
- Full sentences, starting with capitals and ending with full stops (.)
- Dim_Yimma_H posts have quotes (see here
These items help to guide the eye and to split different subjects. In your posts is almost impossible to see where one thing stops and the next thing starts.

To be fair, your intial post wasn't too bad, but would have benefitted from [ code ] and/or [ source ] tags.

Share this post


Link to post
Share on other sites
you did not really read anything, did you?
- you may know karate, but i know crazy..


0.)
so, you quote all that and describe it as - "not many people respond"?


1.)
please explain how any of those reasons prevented you to read 5 lines long algorithm and say something about it?


2.)
please explain how any of those reasons prevented you to copy/paste code, to test it and to report your findings?


3.)
if you do not use fixed time steps and this matter does not concern you, then you dont really need to be here in this thread,
if yes - how does this algorithm work for you?


4.)
why say something that was already said and not even attempt answering any questions.. is your point that i was banned from forums because i didnt use tags?


..will this ever stop?!
where all these teenagers come from, go away with your tags,
im not gonna be finding these bugs every week so that i need to learn how to guide your blind eyes


sorry about the tags.. i was drunk

[Edited by - abaraba1 on September 18, 2008 9:05:09 AM]

Share this post


Link to post
Share on other sites
At the request of the forum moderator, I've reviewed this thread and personally do not find it worth continuing.

I don't feel qualified personally to remark on the technical aspects of the idea being discussed, although I think that has been adequately covered by the other participants in the thread.


Instead, I'd like to focus on presentation. abaraba1, your posts (as noted by rick_appleton) are very difficult to read. One of the first things you need to realize about proposing ideas to other people is that presentation is critical. Good presentation makes all the difference between people ignoring your input and paying attention to it. Posting while drunk, for example, is generally frowned upon and doesn't do you any favours.

Proper spelling and grammar are important, even if you do not feel that they are. Capitalisation and punctuation are critical for helping people want to read your post. Sure, omitting them doesn't prevent anyone from reading the post, but it sure makes people not want to read it. Poorly written text is difficult and time-consuming to read. If you aren't willing to take the time to write neatly and cleanly, then why should anyone else be willing to take the time to muddle through your posts?

Similarly, code/source tags are important as well. They make it easy and convenient to copy/paste code and test it out. Although you are correct that it is still possible to do so without proper tagging, it's a pain.


For better or worse, people are powerfully impacted by presentation. You may well find your ideas getting much better reception if you take the effort to present them in a succinct, correct, and professional manner. This includes writing a formal paper as has been suggested to you previously. (There are many places to submit such papers; a little bit of research can find several candidates for you, or you are free to ask where to publish it in a forum such as this one.)


Finally, to be perfectly clear, your ideas are welcome here - with the caveat that you are expected to present them clearly, and discuss them politely, even in the face of criticism and disagreement.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this