I have run into a performance-related problem in making my game. I made a small program to isolate the problem:
make object cube 1,1
for n=2 to 5000
instance object n,1
position object n,rnd(300),rnd(300),rnd(300)
rotate object n,rnd(359),rnd(359),rnd(359)
next
position camera 150,150,500
point camera 150,150,150
sync on
sync rate 0
do
sync
loop
Running this program at 1080p gives 150 fps and ~20% GPU usage (as reported by
GPU meter.) CPU usage is ~%60 on one core, ~%40 on another, and none on the others.
-Using hi-poly spheres instead of cubes increases gpu usage, but not framerate.
-Moving everything close to the camera increases gpu usage, but not framerate (because it has to draw more pixels).
-Not using instancing reduced framerate from 150 to 90, and dropped gpu usage as well.
-Using only one cube has %97 usage and OVER 9000 fps
The GPU meter is not the problem. Almost all other games show %95-%100 usage on it at all times, except for Arma 2, which is known to have a low gpu usage.
The problem is some sort of overhead processing it does on all objects. My game will have a lot of cubes bouncing around, is there some way to optimize this?