I have a problem to get an identical ball speed across different android devices. Its an outbreakgame with a bouncing ball. I have developed the app on my galaxy s7 but when testing it on my s3 the ball and other objects are approx 30% faster, or something ???.
- I am using a surfaceview and the framerate is constant that is about 60fps
the ballspeed is set in termns of dp and stored as a xml-resource. (same with ball radius)
<dimen name="ballSpeed">5dp</dimen> <dimen name="ballRadius">6.25dp</dimen>
I simply retrieve the field stored in the resource-file
float ballSpeed = createGC.getContext().getResources().getDimensionPixelSize(R.dimen.ballSpeed);
and then pass ballspeed to the ball-objects constructor
So how could the speed difference be explained? fps is the same an speed and radius are expressed in dpi. But somehow the speed for the Samsung Galaxy s3 faster. I guess it could have to do with the screensize.
s7 inch: 5.1
s3 inch: 4.8
So my questions are:
Could the different screensizes be the explanation to he difference in speed? And how could I possibly take this into account?