Simulation speed changes for unkown reason

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Simulation speed changes for unkown reason

Postby Marc » Wed Aug 19, 2009 2:24 pm

I found an example for the scenecollision here http://newtondynamics.com/forum/viewtopic.php?f=12&t=5052&p=36355&hilit=NewtonSceneCollisionOptimize#p36355 but how do I use the performance counters? I guess I have to call NewtonReadPerformanceTicks but with what parameters to get what values?
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Wed Aug 19, 2009 4:48 pm

agi_shi wrote:
Delfi wrote:if gcc builds are so fast, you could try offering GCC dlls on win32 aswell? :D

You can find recent MinGW builds with the latest GCC for windows here: http://www.tdragon.net/recentgcc/


I will try this this weekend, and see what we get, Cross my finger Nock in the wood.
If we get the scene in the video for 22 milsecunds to lower than 4 in GCC tha a huge win, that beats every thing.

I 'd never seen anything like that without algorism change.
I start to worder if I was buidl GCC in dbug mode all the time, BUT I repeat teh sperirment and it is teh same over an over.

I have not being able to test it in 32 bits, because when I tryed to Install Unbuntu 32 the intaller keep saying I alredy hav Ubunto installed
and refuses to install a new copy, unless I ovewrite teh 64 bit one.

So I build Linux 32 in teh old Laptop which really, Really *.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby hpesoj » Wed Aug 19, 2009 5:05 pm

Julio Jerez wrote:I have not being able to test it in 32 bits, because when I tryed to Install Unbuntu 32 the intaller keep saying I alredy hav Ubunto installed
and refuses to install a new copy, unless I ovewrite teh 64 bit one.


I guess you are using Wubi? Apparently there is no way to have multiple Wubi installations, but you can hack it if you're feeling brave: http://ubuntuforums.org/showthread.php?t=486538
hpesoj
 
Posts: 90
Joined: Sun Jan 09, 2005 4:36 pm
Location: Cambridge/Bristol, UK

Re: Simulation speed changes for unkown reason

Postby Thomas » Wed Aug 19, 2009 6:05 pm

have you tried http://www.virtualbox.org/? it's very easy to use and great for having several different linux installs at the same time.
Thomas
Moderator
Moderator
 
Posts: 65
Joined: Sat Nov 01, 2003 1:51 pm
Location: austria

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Wed Aug 19, 2009 6:21 pm

I will try that after I get the GCC for windows,
I will no tamper with geting dual Booth, I has ruing my set up so many time already and I hate resintalling teh OS for not reason,

Tha Virtual stuff looks good, I once was using Parallel in my Mac Pro, but it is too buggy, and I end up with Boot Camp.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Wed Aug 19, 2009 6:37 pm

I was looking for infomation as to whit usin teh flagh fast-math and ffloat-store lead to so a bad binary in GCC and I cam across this
http://blogs.sun.com/BestPerf/entry/fre ... halem_race

I think these people are making the same mistake I am making.
I end using using -O2 and tah produed teh fatser possible binary if has so fat by amost a factor of three time.
The are seeing results similar to what I had for years but they are using a compiler different than Visual studio.

this is what they conclude
The freely available Sun Studio 12 Update 1 compiler on OpenSolaris provides more than double the performance of GCC V4.4 on SuSE Linux, as measured by SPECfp_base2006.

If compilation is restricted to avoid using autoparallelization, Sun Studio still wins by 38% (base to base), or by more than 25% (Studio base vs. GCC peak).
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Thu Aug 20, 2009 12:46 am

Huston we have a problem.

I was testing teh SDK to see if theer are problem wi teh Fast code, and the problems are all over the place

Collision falure every where, I am gon to nee some tiem to fidn what test are failing because I can mak ethe nessesary chnage sin teh code rateh than rely on teh compiler settings.
Man What a bomber.

Also Mark I was spawnning many entities by hitting the letter M and waiting until they land, buy the go true the floor, is that right or it is a bug?
The thing is that they go trought the floor even with the precise option on.
Any way I will see if I can get the fixed, because the gain is too great to be ignored.

Now that I seen the montain top, I can not go back.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Thu Aug 20, 2009 1:55 am

No it does not seem wrong, the collision errors are also in 2.06 and 2.07 they are tunneling because some small boxes are falling for to high elevations.
Thsi seem so fantastic that I am still skectical, anyway I put this Bill, so that you guys can test it before I move forwarded with the Vertical axis thing.
I hope it is alright.

Also I added the collision destroy call back.

http://www.newtondynamics.com/downloads/NewtonWin-2.08.rar

Ha for those following the performance I test by running eth Tower Tall, and setting auto sleep off.
I get less than 16 ms per frame in the profiler and in 2.05 about 22 ms per frame,
If some do that test [please let me know.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Thu Aug 20, 2009 3:28 am

It turn out still I had a bug when I fixed Invalidate cache.

I also forgot to activate the cell, and thsi swhy teh FPS when to 60, bu teh boied were no colliding with teh floor,
This is why I panic thinking it was a float error bug.

Any way I fix it an dnwo I get 52 fps in your game.
I notoce you has a very lareg numbe of worlds, hwo many work do you have in teh game?

also It is very imprtnat that you put all those static bodies into a Scen Collision, becaus eteh activation and deatication is making the behave like active bodies and cause lot of activity for nothing.
All those bodies should not provoke activity other than collison checks when a dynamic body is close.
Plase test this and if there are not Bugs let us see if we can move then to a Scene collision, and more than 90% sure it will mak eteh physics time irrelevant.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Marc » Thu Aug 20, 2009 6:10 am

Wow, so much update. Well the units should not fall through the ground. I guess they do that when they fall with high speed and tunnel through the heightfield. The heightfield code is basically from an example from 1.32 or 1.53, I don't remember.

Yes I have several worlds. First of all, there is the world representing the current logical gamestate. Then there are worlds that get created and destroyed relatively fast for doing some primitive vs. primitive collision checks for ai and user interaction like testing if a building the user wants to build actually fits. I didn't want to mess with determinism so I put those queries in their seperate newtonworlds. And then, the biggest thing, is the history of gamestates - about 8 times per sec for the alst 5 to 10seconds maybe. They are not updated most of the time though. This is related to the way I'm doing the networking: Basically, I have a synced clock between all participating pcs and when an event happens on any of them, like a user giving a command or the server dictating something, they timestamp the event with the current system time. Independent of this, they advance their gamestate according to the synced clock. If an event arrives, they rewind to a state in history that is before this event and continue from there. There are some other things going on like estimating rtt and running the simulation with some latency adjusted to that rtt to prevent rewinding happening often as well as redating some inputs if there is huge lag. That's why there are so many gamestates and consequently newtonworlds. And that's also why they all share so much collision geometry. You can see when a rewind is happening by looking at the console window. I think atm I have disabled the latency calculation for rewind stability testing, so whenever you push m or n, most likely a rewind will occur.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Simulation speed changes for unkown reason

Postby Marc » Thu Aug 20, 2009 6:57 am

I tried 2.08, but the effect is still there. After adding about 10 monsters, things started to move slower again. :/
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Thu Aug 20, 2009 8:16 am

how much is the difference in speed?
Is the slow down permanentry of a spike?


to implemnet teh perfromance counters ther are tow funtions
void NewtonSetPerformanceClock (const NewtonWorld* newtonWorld, NewtonGetTicksCountCallback callback);
unsigned NewtonReadPerformanceTicks (const NewtonWorld* newtonWorld, unsigned performanceEntry);

The first funtion set a callback the read a timer,
then function NewtonReadPerformanceTicks to read the mumber f tick that ever major system is taking.
each system is identofy by a define in the Newton.h file.
could you add that maybe we can see what is slowing down

so what yuo do is teh you read the time spend afte each update, they are per world, you you will have to add tiem in each update you do per frame.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Marc » Thu Aug 20, 2009 8:55 am

I made a video to show what I actually mean. I used CamStudio. It's kind of crappy, the framerate is low, the colors are wrong there are compression artifacts. But you can get the problem: http://www.confrontation-unlimited.net/temp/slowdown.avi

At the beginning, everything is ok, the blue guys move around fast. Then I add a monster and things get suddenly slow. Like slow motion. You can see how slow the new guy falls down by comparing it to its shadow and how slow the blue guys walk towards him. Then they fight, as well in slow motion. Suddenly, they kill it and they move fast again. Then I create another guy, the red bat, and this time, no slowdown occurs. You can see how fast they move around each other. Do you think this is related to cpu peak issues?

If it's not clear, I can try with some other screen capture utility, maybe they create better videos. Yours always look better and have higher framerate. I tried gamecam, but it didn't capture anything for my game. I tried fraps but it doesn't caputer everything in my game - surprisingly, it somehow captures the content of wpf windows, but not the content of non wpf windows - and alwayss only for one window :/ Maybe there is no good capture tool for my kind of windows setup ...
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Thu Aug 20, 2009 9:08 am

I use frap, the last version is very good.

so I thr problem is no tha thr frame rate is slwing down bu the speed of the simulation.

I thonk I did see that teh units move slower when somethong happens, are you sure you are no skipping updates?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Simulation speed changes for unkown reason

Postby Julio Jerez » Thu Aug 20, 2009 9:11 am

Marc wrote:This thread drifting to code speed optimizations makes me wonder if we are actually thinking about the same kind of issue we are searching. My issue is not that sometimes the cpu usage gets high but instead, the simulation gets slow, like a NewtonUpdate(0.016) only seems like NewtonUpdate(0.001) - like Bullettime in Matrix. And not using NewtonBodySetFreezeState prevents this from happening. The "demo" and the instructions are oriented towards that. I just wanted to make that clear, not that you are using the demo and searching for another effect than I wanted to show. :)


I see you did say that.
and you say this goes away when you do not use function NewtonBodySetFreezeState ?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest