Jump to content

Physics has me stuck


Rick
 Share

Recommended Posts

Just tried it and no change for me. Downloaded the LE 3 example program Aggror posted in this thread (falling boxes). Put the line of code in the same spot in the VS project that I mentioned above, rebuilt the Release version. Closed all programs so as to not have anything sucking resources. Ran the test program and no difference. App froze about 3 seconds into the run. Not even close to the LE 2 test that does the same thing.

  • Upvote 1
Link to comment
Share on other sites

Okay, something strange is definitely going on in that demo. I suspect it has to do with critical section locks.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

In Aggror's script there are a few problems.

  1. The boxes are using swept collision mode, which will make them very slow. His Leadwerks 2 example does not use swept mode.
  2. The for loop is iterating by one instead of two, creating twice as many boxes when the same boxAmount value is set. (I know he has it set to 150 in the Leadwerks 3 script.)
  3. The boxes are all unique which will make rendering slower. Creating a box once and then making instances of it is faster.
  4. context->Sync() should be passing false in to get an accurate reading of the true speed.

 

I did a little tuning and came up with this build:

 

 

 

Link to comment
Share on other sites

Hi

 

using the physicstest I get a sluggish respons (and sometimes a crash) while the physicstestold is smooth. It looks like the difference in the lua script is just that the app.lua creates one box (base) prior to the loop while the the appold.lua creates just the boxes in the loop (no base). The other changes mentioned seems to be in both lua script.

 

Does the size of the .exe file reflects other changes to (the file marked as old is some bigger than the other exe file) ?

 

 

BR

Eirik

Link to comment
Share on other sites

Hi

 

Testet shadmars program on my laptop and I get steady 45 + (starts on 55+) frames per sec. using 1000 boxes (Lenovo 530W with nVidia card). Setting the amount of boxes to 500 gives an average of 400+ frames (difficult to see because it changes a lot but it looks like the average is around 400).

 

BR

Eirik

Link to comment
Share on other sites

Sorry for the errors in my script. I hadn't seen them.

 

Do we always need to use Sync(false) when using a lot of physics?

I can't test this right now unfortunately but will post back after I am back home.

If the optional parameter is left to the default (true) vertical syncing will be enabled. This caps the screen refresh rate to 60 FPS, so you cannot measure performance faster than that.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

What have you changed Agrorr ?

Is it LE2 ?

 

I tested on my Tower PC :

Over 200 FPS all time ,no slow down even on last cubes.

 

That's totally different from previous versions in terms of speed, it's fast and smooth.

 

But perhaps it's different when using otehr stuff than cubes, like Rick project ?

Stop toying and make games

Link to comment
Share on other sites

I think my issue is the shape I generated from the model. I removed all of those and just made a csg floor and I get about 40 fps on average, which is about the same thing I get with Josh's new demo. The LE2 demo is still smoother but oh well.

Link to comment
Share on other sites

I think my issue is the shape I generated from the model. I removed all of those and just made a csg floor and I get about 40 fps on average, which is about the same thing I get with Josh's new demo. The LE2 demo is still smoother but oh well.

Convex hulls and polygonal geometry can be very slow if the shape is complex. Not sure exactly what you are doing, but you can build a shape for your model out of CSG brushes and save that, to make a good low-res physics shape.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I did make polymesh shapes for all of those walls/floor and that's why it was slow. Those walls don't have backfaces and they are really cut down on polygons with faces being removed so not sure if that screws up the "Make shape from mesh" functionality to cause slowness, but when I took the shape off them I get higher FPS. It also made the shape VERY thin meaning I could move through them fairly easily even with swept collision on the player.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...