Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've started to make a 2D sidescroller, the camera and world rendering works as I expect, but now comes the physics part of world.

What I need is that one tile in x or direction should correspond to 1 meter. Since I have a variable time step (Android mobile game), I can't figure it out, since the timing and velocity always will be dependent of the device. So, is there any good way to make one tile to correspond 1 meter? This would be good, otherwise the physics implementation would later be weird.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Velocity does indeed relate to both time and distance. However, distance, time and even velocity will remain the same between all your devices, the only thing different will be the span between updates. Of course, I need to link the required documentation for anything talking about physics and time. As long as you maintain x units of movement = x number of pixels you're fine. This brings up the issue of scaling your art assets for different size screens. Just scale your distance units in the same way as your art assets. You can just have global scaling variables that reflect what the "native" size of your game has been scaled to, then apply those to all updates that utilize drawing, position, physics or movement.

share|improve this answer
    
Thanks for answering! So, the bottom line, is that I should use the variable time step method and then, by testing, changing a scale factor to make it approximately 1 meter per one tile? –  Vilzow Jun 2 '12 at 16:35
1  
You don't need to do it by testing. Once you've decided that your units are meters and you define how many native pixels equals 1 meter, everything just falls in behind that. For example, you create your native art to be x pixels per meter. –  Byte56 Jun 2 '12 at 17:54
    
Ok, thank you, @Byte56! –  Vilzow Jun 2 '12 at 18:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.