motion linear velocity differs on different devices
Hello guys , I noticed in my platformer game that every actor moves according to the framerate of the device, Iv been testing my game on 10 different devices, 6 have the same results and are all newer devices but 4 older devices are different , and each of them hold different result than the other one.
For example, if i move 2 actors together at the same velocity and are parallel to each other, if the game lags a bit or slows down, one of the actors moves slower and the other one maintains the same speed , the result becomes different , I cant time my obstacles to match on all devices , but that is only when I use motion linear velocity , if I use interpolate position it gives me the exact result on all devices. The problem is I need to use velocity instead of changing position in some cases.
The same thing happens with constraining an actor to another , I am constraining a hitbox to the main hero actor, the hit box is attached on the hero's head and uppper body , i set it to be visible to see the result, sometimes if i jump from a high spot and land on an enemy I get hit ,even though it shouldnt hit the hero actor it should destroy the enemy but the hit box doesnt keep up with the velocity of the actor attached to it, so it collides with the enemy causing damage.
Both of these problems appear on older devices , samsung galaxy s4 and samsung galaxy tab 3 , and samsung grand prime. I figured that this happens cause of the framerate ( not sure though ). I even thought that the problem is from the device , but I have tested popular games of the same genre to compare the results , even if it runs slower on the device their results are always the same , the obstacles, enemies , etc. always move according to how it was programmed to move , and not according to framerate of the device. But I thought again maybe they used different methods to avoid this problem from happening. Anyone had this problem with their games ? Is there a good alternative that I can test out ?
Thanks
Comments
What are the 'frame rates' for the devices you've listed ?
@Socks 45-55 fps , only happens with android , except for galaxy s5 cause it runs 60 fps
The reason why interpolate works is becuase it is outside the physics engine. Since in the physics engine velocity is in direct relationship to time, aka frame rate is time, this is why you are seeing a difference. Try putting the actors closer together in the layer, right next to eachother would be ideal. If there is an actor, between them, who's code is the result of the lag this would cause the two to move at different rates.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@Lost_Oasis_Games I see, thanks I did not know that.
I recently dug into the box2d physics engine and learned a lot. See this months meetup video of the presentation I did.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS