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 speed seems to be capped

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Mar 2019 08:07
No matter what i do i cannot get this sprite to move any faster. I know another app that set the frame rate to max but i don't want to do that and run battery down.
What am i doing wrong here?
Thanks in advance for any help
haliop_New
User Banned
Posted: 26th Mar 2019 12:31
I have actually found out
that if you lower your virtual resolution it could help since there are less (fake) pixels on the screen.. if you build your entire app using the sizes of the virtual resolution then it does not matter what resolution you play ...
for example:

a sprite with physics of let's say mass 100 and gravity set to 0,100 will fall the way you would expect...
but if the same sprite with the same mass and the same gravity set to 0,100 will fall even faster if the virtual Width /2 and the virtual height/2

get my point?
fewer pixels on screen from one physic calculation to another.

but this also means that the sprite should be set like this:

setSpriteSize(spriteId, VW/ something, VH / something )
VW = virtual Width
VH = virtual Height

so then no matter what Virtual resolution you are on, the sprite will look the same on all cross-platforms even on PC but, physics now have fewer pixels to "draw" from one vertice to another.
haliop_New
User Banned
Posted: 26th Mar 2019 12:45 Edited at: 26th Mar 2019 12:47
try this



I have also added Mass, but kept it to 1, didn't see any real difference between 1 and 100 but there should be ...
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Mar 2019 07:52
I just discovered if you SetPhysicsScale(0.2) or lower then the sprites move faster.
Not sure if that it the approved method but it's working for me for now
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 27th Mar 2019 20:11
Quote: "This function allows you to change the scale factor if your virtual resolution is going to be different from 100,100."

Your resolution is much bigger than 100x100, so I guess you did the right thing. Haven't experimented much with physics yet, though.

Remember to call this function only once, before the physic system is running.


PSY LABS Games
Coders don't die, they just gosub without return
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Mar 2019 22:21
Unfortunately i get wildly differing velocities across devices so i think virtual width/height is the way to go.
haliop_New
User Banned
Posted: 28th Mar 2019 08:17
physics scale is right where needed but not here...
if you look closely on debug you will see that the actual size of the physics is different when you change the physics Scale I hardly ever use it, as I want the physics to be the same as on screen.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Mar 2019 09:11
Yes. Totally agree. Virtual resolution is the way to go

Login to post a reply

Server time is: 2024-11-23 02:16:47
Your offset time is: 2024-11-23 02:16:47