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 / 2d physics problem

Author
Message
haliop_New
User Banned
Posted: 22nd Feb 2019 14:04
You can check it yourself with this link

https://play.google.com/store/apps/details?id=com.RhinoInstinct.MiniMathX

it seems that on some devices physics runs great but on some, they are slowed down...
I am not using stepPhysics should I? if so how would I know whats the right float to put inside... since FPS may vary but not so much...
on HTML export it runs on 25 fps and its fine... but on some mobile android devices it runs on 30 fps but physics are acting super slow... I don't know why... can someone enlighten me why this is happening? I just lost a lot of users because of it.
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 22nd Feb 2019 15:07
You will get errors with 2d physics when below 60fps I found, though more noticeable the lower the FPS goes... Is there a reason you are limited to 30fps? Technically physics shouldn't really be tied to the frame rate but for some reason it does seem to be in agk
But no you don't need step physics or any such commands unless you're not using sync and stepphysics is normally used to slow down the physics (or pause it completely) to improve performance of the other aspects of the app.
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 16:06
Quote: "I am not using stepPhysics should I?"

If your using any kind of moving physics you have to, to get the movements to work
fubar
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 22nd Feb 2019 19:22 Edited at: 22nd Feb 2019 19:23
you shouldn't, it's optional, as stated in the help file
Quote: "It is not required that you call this command in your game loop, if you do not call it, Sync or Update will call it for you with the last frame time to allow the physics simulation to catch up in real time. If you do call StepPhysics then it will not be called for you by Sync or Update for that frame, this allows you to do your own physics timing if you prefer."


it also covers some advice on how to fix the "slow" down issue
Quote: "By using a fixed time step every frame your physics will perform exactly the same across all devices and all frame rates, but a reducuction in fps will result in the physics appearing to go slower, as it will always step the same amount of time whether the frame was quick or slow to draw. Using a variable step for each frame will keep physics moving at the same speed regardless of frame rate, but it will no longer be deterministic across devices and different frame rates. For example if your game depends on a physics entity falling and bouncing to the same height each time it is run then you should use a fixed time step. If the position of physics objects is not important to you game logic then a variable time step may be best."
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
haliop_New
User Banned
Posted: 22nd Feb 2019 21:18
I think I have found the problem, thank you for your quick answers. testing to see if that is the case if so i will update here.
puzzler2018
User Banned
Posted: 22nd Feb 2019 21:21
To many creating objects within the main do sync loop?
Tier 1 Developer
haliop_New
User Banned
Posted: 23rd Feb 2019 01:09
naa ... its the virtual resolution setup... I got it wrong I fixed it but I need to test it on a higher res device.

Login to post a reply

Server time is: 2024-04-25 02:02:13
Your offset time is: 2024-04-25 02:02:13