Paul (or anyone), I wonder if you can help please?
Ok, so this is going to take a little setting up, but here goes. I've been converting my 2D game to 3D, but the frame rate is really low - barely 45 fps, where it should be in the hundreds potentially. I;ve cut out all other code, and none of it made a difference, so I've employed the AppGameKit debugging commands. Some thiongs to note:
My machine is an 8 core AMD, with an 8gb GeForce GTX 1080, 16GB systme ram. The system is not slow (45fps in GTA V maxed out in 4k....so my simple graphics should be dstroyed).
So, here's some core things about the code:
SyncRate is set to (0,0) - there's no limit here.
A range of timings is used but the basics are that the time to render is measured as GetUpdateTime()+GetDrawingSetupTime()+GetDrawingTime()
(this is on screen as "AGK render time"). This is backed up by getting the timer value before calling Sync, then again right after - they are roughly the same
(this is on screen as "Render time"). Ib both cases, it says the render took less than 10% of a frame time, which at 60 fps is 0.0166666666666667 (1.0/60). Given this, the theoretical frame rate is about 500 FPS plus....but
the code is slugging out at 45-50 fps. I will stress at this point, no other code is running in the background, and making it full screen does not impact it.
What I noticed is that the physics take 0.06 seconds on average (GetPhysicsTime()+GetPhysicsSolveTime())...but I do not use physics ANYWHERE in the game. In fact, I call delete3dphysicsworld before it starts to make sure. So what is this?
The frame update is done using the following code:
if timer()<looptimer#
repeat
until timer()>looptimer#
endif
rendertime#=GetUpdateTime()+GetDrawingSetupTime()+GetDrawingTime()
frametimemax#=1.00/60
synctime#=timer()
sync()
looptimer#=(synctime#+frametimemax#)-rendertime#
This should maintain a smooth set frame rate - I can set this to any value, however it is being limited by the system.
I then turn the 3D system off again and go back to the 2D game.....oddly this reports the maximum FPS as 70fps using the exact same code. Is this version there are no 3D objects beyond simple spheres, so no animation, no skeletons, no bones. The odd thing here is that the physics update time is still at 0.0522...why is that?
So a couple of key issues:
* what's the physics in the background that are measured and why are they taking up so much time? Is this impacting the 3d system?
*am I missing something obvious that is restricting the 3d frame rate - why is it topping out at 45 fps when it should be able to render at 400+ easily?
* are the limited 2D sprites slowing it down for some reason?
I would appreciate your feedback - the graphics are really very simple at this point, there shouldn;t be this severe level of slow down.
Video below tries to show.
Also, there is a problem with the internal shadows - they don't seem to clip with objects - I have an object casting a shadow on the floor, which goes right through the wall (a cube made internally in AppGameKit, protrudes below the floor) and onto the floor on the other side. Is this normal?