Jump to content

Movement Compensation on Scaled Games?


Ydt
 Share

Recommended Posts

Maybe this is a silly question.. But for example I have a project that that moves an entity at 1 pixel per tick. When scaling down to smaller screens this entity moves across the screen much faster then anticipated because there are less pixels (I think?). What methods do I take to insure everything is moving at a constant speed across all screen sizes?

 

Any insight or tips with this issue would be much appreciated!

Link to comment
Share on other sites

Basically you need to use delta timing to solve the problem, like the people before me have already mentioned. It's pretty easy to add to a project even if you haven't thought of it before. Generally you would design your game by using delta timing from the scratch, so instead of having a 1px / step movement rate you have something like 30px / second and then you just multiply this speed with the time every step of your game takes to execute.

 

However there still might be problems if you arent scaling your game from a fixed size to the screen size on devices but instead make the play area larger. Generally this is something you want to think beforehand when designing the game – whether the bigger playarea is going to be a problem, or is it just more graphically pleasing without big impact on the gameplay itself for users that have bigger screens at their disposal.

Link to comment
Share on other sites

Defining your speed as pixels per second (rather than per tick) is a good suggestion.

 

However even better in my opinion (as this is what we do in our engine), is defining speed as "world units" per second. Then to compensate for different screen sizes, you can set a scale in the canvas transform so that 1 world unit isn't necessarily 1 pixel on the screen - it can be more or less depending on your screen size. The advantage of this approach is that you set this scale only once, and don't have to worry about changing speed values for all your objects.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...