Game Development Community

TSMesh::buildPolyList optimization

by Igor G · in Torque Game Engine · 05/24/2007 (1:10 pm) · 3 replies

My world starts lagging when there's more than 60-ish players, and it's because of collision detection with DTS objects. The buildPolyList function is consuming the most CPU cycles and I am attempting to try and speed it up.

So..this may be a dumb question - I am not very familiar yet with how TGE deals with collision detection, but can this poly list be built once instead of every frame? I mean, the DTS shape is pretty static, so why call this function every frame for every player?

Thanks.

#1
05/24/2007 (1:44 pm)
That call should only occur for players with are close enough to the static shape. Is your shape or its bounding box too big?
#2
05/24/2007 (3:05 pm)
One of the main uses of buildPolyList() is to calculate the which polys the dynamic shadows cast onto which changes constantly as object who cast dynamic shadows move around (like the Player). This means that it can't really precalculate the results. buildPolyList() also supports animation which would cause the polys/verts returned to potentially be very different every frame.
#3
05/24/2007 (5:33 pm)
Yes - My shapes are big, and contains many collision polygons. Also, my shape is instanced many times in a dense world. So, if these users are running around, they almost constantly hit my shapes.

So, if my shapes do not animate and if I didn't want dynamic shadows, pre-calculating this list would theoretically be possible?