Poor performance with 9 raycast vehicles

Post Reply
User avatar
Pyritie
Posts: 25
Joined: Thu Aug 11, 2011 6:42 pm

Poor performance with 9 raycast vehicles

Post by Pyritie »

I'm making a kart game. For a while I only had one kart with some stuff in the level I could smash about and everything was fine.

Recently I added a bunch of other karts with some simple waypoint AI. Now the speed has decreased a TON and it's really slow.

I used to use a fixed timestep of 1/90 with max substeps of 10 (which was accurate and smooth but after someone in #ogre3d suggested I lower it, it got faster) but now I changed that to 1/45 with max substeps of 45.

Changing the substeps helped with the speed somewhat but with 9 karts it's still really slow. The karts' chassis is a simple convex hull (around 60ish vertices), and the track is made of about 3 big BvhTriangleMeshShapes, each with around 2k polies.

What can I do to speed things up?
Attachments
.<br /><br />9 karts and 1/45 timestep<br /><br />.
.

9 karts and 1/45 timestep

.
Capture251.PNG (15.06 KiB) Viewed 9961 times
.<br /><br />1 kart and 1/90 timestep<br /><br />.
.

1 kart and 1/90 timestep

.
Capture250.PNG (15.36 KiB) Viewed 9961 times
.<br /><br />9 karts and 1/90 timestep<br /><br />.
.

9 karts and 1/90 timestep

.
Capture249.PNG (15.7 KiB) Viewed 9961 times
User avatar
Pyritie
Posts: 25
Joined: Thu Aug 11, 2011 6:42 pm

Re: Poor performance with 9 raycast vehicles

Post by Pyritie »

also I'm using bulletsharp with mogre
Attachments
.<br /><br />1 kart and 1/45 timestep<br /><br />.
.

1 kart and 1/45 timestep

.
Capture252.PNG (14.41 KiB) Viewed 9959 times
DestroyerOfCities
Posts: 20
Joined: Fri Dec 10, 2010 3:39 am

Re: Poor performance with 9 raycast vehicles

Post by DestroyerOfCities »

If I had to guess, it would be those 2000 poly triangle meshes. Those are the least efficient shape type, since they have to account for concavity. What happens if you just throw the 9 karts on a plane?
User avatar
Pyritie
Posts: 25
Joined: Thu Aug 11, 2011 6:42 pm

Re: Poor performance with 9 raycast vehicles

Post by Pyritie »

9 karts with just a plane and no other level graphics:

Image

9 karts on the regular course with all of the other physics objects except the triangle meshes:

Image

what do you suggest I use instead? I'm trying to get a heightmap working (and putting the overhangs in a trimesh) but they're pretty difficult to debug since turning on debug drawing pretty much slows rendering to a halt
User avatar
Pyritie
Posts: 25
Joined: Thu Aug 11, 2011 6:42 pm

Re: Poor performance with 9 raycast vehicles

Post by Pyritie »

hmmm... I think another big source of slowdowns are these "trigger regions" I have, used for waypoints for the AI-controlled karts.

Apparently this is what it's like without these trigger regions:

Image

and with them:

Image


the problem looks like the trigger regions are preventing objects from being deactivated, meaning that it's constantly simulating far more objects than it needs to. (After one lap, I polled all of my objects and about half of them were active!) The trigger regions are only supposed to do anything with the karts and nothing else on the track. I've tried using GhostObjects and RigidBodies and neither seem to fix it -- am I doing something wrong or is there a better way to do this?
User avatar
Pyritie
Posts: 25
Joined: Thu Aug 11, 2011 6:42 pm

Re: Poor performance with 9 raycast vehicles

Post by Pyritie »

bump
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: Poor performance with 9 raycast vehicles

Post by anthrax11 »

Try the new SP1 release, which fixes a performance regression.
User avatar
Pyritie
Posts: 25
Joined: Thu Aug 11, 2011 6:42 pm

Re: Poor performance with 9 raycast vehicles

Post by Pyritie »

I think that fixed that problem, hooray!
Post Reply