Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] Step3DPhysicsWorld() don't work with greater than SetSyncRate( 1000, 0 )

Author
Message
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 4th Oct 2016 21:00
Why I have SetSyncRate (10000,0)? I have a GeForce 770 GTX and wanted to know, how far I could push the graphics card and which objects will have a huge impact and which not.
Physics will stop or is very slow, but if SetSyncRate (1000,0) is set, it works fine. Framerate is about 2200 Frames in this setting.

Maybe this was the same problem like here https://forum.thegamecreators.com/thread/217190

My code


A trick, that worked for be able to set the Synchrate to 2000 frames is


But this still shows, that the physics is not able to calculate itself exactly if the changes maybe to tiny.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 7th Oct 2016 23:21
What you are doing is wrong!
AGK is not meant for bench testing a GPU.
It is designed to run efficiently on mobile devices.
The physics will run at the same rate as long as the framerate is between 20 to 100 FPS.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 8th Oct 2016 13:03
"Stab in the Dark" wrote: "What you are doing is wrong!"


What I am trying to achieve is, to understand, which code or assets have the most influence in my game. I understand, that AGK2 is for developing on mobile platforms, but I could do anything on PC without noticing frame drops if I make a cut for 60 FPS e.g. But the same program could run only with 30 frames on the target platform. I hoped to get like a constant for my PC and my android device (ForgeTV), where I know, that maybe 240 FPS on the PC would be like 45 FPS on the Android Console. I could set FPS to 60, for the TV its fine, but later with more content, my game could get frame drops and lower FPS, I don't realize that mybe when testing on PC. Because between 1500 and 150 FPS it would say 60 FPS. But maybe the same content would have impact like from 200 FPS to 20 FPS on the Android console. If I know that factor, I could say if the factor is maybe 5x times, and I have 100 FPS on the PC, I will have more than 20 FPS on the console, but If I have only 99 FPS on the PC, I will have under 20 FPS on the Android device.

The problem here is, that I could not get that factor and so I can't say if the program which runs fine on PC, would run fine, good, bad or what ever with same conditions on a lower end device.

The point is, I don't want to test every line of code on the traget device, if it is not absolutly necessary.

Also the variance between android devices could be great. e.g. OUYA (Tegra 3) and ForgeTV (Adreno 420)

I know, that I have to be between 20 and 100 FPS. The problem maybe is not the physics, but loading things in the background. If the device would be much faster, it would be possible to load textues and objects between frames, but to get it right and flexible, it is necessary to know, how much time there is. The main-loop would be slower, and to get the advantage of the faster frame rates, it could be one possibility, to update physics not every frame.






Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 8th Oct 2016 13:14 Edited at: 8th Oct 2016 13:16
Maybe this could work, SetSyncRate(10000)

This will make physics run at 100 FPS, in the worst case physics runs at the same frame rate like FPS, when FPS is lower 100.


Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 8th Oct 2016 13:51
Framerate independence is when the simulation is decoupled from the rendering loop and always steps at the same interval.
AGK uses the Bullet physics engine which is framerate independent.

Your post demonstrates that you do not understand framerate and are confusing yourself with this idea that you
need to run it as fast as you can.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 11th Oct 2016 09:31
Why are you doing this? SetSyncRate(10000) : Run at 10,000 FPS.
You should be doing this: SetSyncRate(0) : Run at maximum FPS.

But as the guy who wrote the physics engine has already said, it'll run at it's own rate regardless of the display update rate.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 11th Oct 2016 13:26 Edited at: 11th Oct 2016 13:45
Mobiius wrote: "You should be doing this: SetSyncRate(0) : Run at maximum FPS."


That is exactly the problem. SetSyncRate(0) runs at ~ 2,000 Frames on my system.

Stab in the Dark software wrote: "Framerate independence is when the simulation is decoupled from the rendering loop and always steps at the same interval.
AGK uses the Bullet physics engine which is framerate independent.

Your post demonstrates that you do not understand framerate and are confusing yourself with this idea that you
need to run it as fast as you can."


@Stab in the Dark
Stab in the Dark wrote: "The physics will run at the same rate as long as the framerate is between 20 to 100 FPS."


If I would use SetSyncRate(0) I have to set the Physic sync to ~ 100 FPS, because it is NOT! framerate independent, if I have to ensure that the FPS is between 20..100.
Don't get me wrong. I love Bullet Physics in AGK. And the simplest way for my projects would be to set the FPS not to "0", but to "60".

Why do I want a framerate more than 100 FPS? I am thinking of VR with about 120 FPS for smooth gameplay or FreeSync.
I don't want to cut down the FPS on systems which are able for higher Framerates. I tested it on the android device and because of the TV it will only run 60 FPS.


I understand that the command swap() is waiting till the frame would be drawn to get a specific framerate. So if I cut down the FPS to 60 FPS, my main loop will only cycle 60 times.
I don't know yet, how I would implement asynchronious processes or threading.

I could do some functions with there own loops without refreshing the screen. I have to time them. Without physics, and without flipping draw buffers.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 11th Oct 2016 13:51 Edited at: 11th Oct 2016 18:04
Stab in the Dark software wrote: "What you are doing is wrong!
Your post demonstrates that you do not understand framerate and are confusing yourself with this idea that you
need to run it as fast as you can.""


Maybe I am not the smartest to be the greatest programmer in the world. But I don't understand, why you want me to feel bad? I can't change the subject (of this thread), so the Bullet implementation works fine and it is not a bug.
But than the documentation should give a hint, that you can't use SetSyncRate(0) with Bullet Physics on modern PC hardware. So maybe a better way would be, to show the people who are willing to use AGK2 and Bullet Physics how they do it more the right way.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 11th Oct 2016 14:34
Quote: " I am thinking of VR with about 120 FPS for smooth gameplay"
I doubt you'll find any headsets that have a refresh rate that high. 60Hz is more likely.

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 11th Oct 2016 14:36 Edited at: 11th Oct 2016 14:37
Quote: "So maybe a better way would be, to show the people who are willing to use AGK2 and Bullet Physics how they do it more the right way."
He has. The thread is here:
https://forum.thegamecreators.com/thread/216683

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 11th Oct 2016 18:18
@CJB

I know that physics post. Would be nice, to see some of the code also in the AppGameKit help.
Also the HTC Vive has 90 FPS and Sony says the game has to be more than 60 FPS all the time.
http://www.polygon.com/2016/3/17/11256142/sony-framerate-60fps-vr-certification

But it's all fine. I can set SetSyncRate(100) or I don't use SetSyncRate() anymore, develope my game, and if there any problems later, because of to fast monitors or VR-headsets, I could fix that later.
Acer's XF (e.g. Acer XF270) can do 144 FPS, and physics works fine till 1000 FPS, so there would be also no problem.

So maybe this post could remind us all if somebody else tries SetSyncRate(0) with Step3DPhysicsWorld() in the main-loop and physics will not work like expected because of too fast graphics card.

@Stab in the Dark software
I am also trying to help others here in the forum. I am not a programmer since yesterday

kind regards
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 11th Oct 2016 20:11 Edited at: 11th Oct 2016 20:17
This link has the full explanation on how Bullet physics steps the physics world
to get frame rate independence. The page states that Bullet is independent of frame rate
but that is not entirely true. The physics engine has to make sub steps to either speed up or slow down
depending on the framerate to keep physics constant. The max sub steps is set to 20 in AppGameKit which was determined
to be the best value for a framerate between 20 and 100 fps. If you run at 1000 fps you are giving the physics a very high
resolution which would need a different max sub step and is not needed for game physics.
The complete explanation is at this link.

http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World

P.S. I did not write the physics engine I only integrated it to the 3D part of AGK2.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 11th Oct 2016 20:46
@Stab in the Dark software
thanks a lot for this helpful answer

keep the good work. I also like your helpful physics thread.

Login to post a reply

Server time is: 2024-11-25 01:46:51
Your offset time is: 2024-11-25 01:46:51