Sign in to follow this  
Motoky

How does resolution work?

Recommended Posts

I've always wondered, when developing a game, there are obviously going to be a lot of different people with different specs and such. This is why you usually provide players with graphical settings so they can adjust it to suit there machines.

 

Now, I haven't made anything myself as of yet, but currently working on clones of games while adding to my own ideas and documents. How does resolution actually work? When you display a 2D game, you have all of the sprites in specific positions, when you increase the resolution of a game, those positions are going to change and aren't the sizes of the sprites going to change as well?? I have only messed with viewports in SFML before, so not 100% sure on how it all works, or even if that's the right thing to use.

 

Do you develop your games based around 1920 x 1080, or do you have to reset the positions and sizes of sprites, collision detection, etc. around different resolutions??

Share this post


Link to post
Share on other sites

When you display a 2D game, you have all of the sprites in specific positions, when you increase the resolution of a game, those positions are going to change...

 

That depends on how you specify the positions. Rather than fixed pixel or window coordinates, you can specify the positions in screen-space coordinates to avoid having to recalculate everything. That is, (depending on your system) screen-space can run from (x=-1, y=+1) in the upper left corner, to (x=+1,y=-1) in the lower left corner. Those coordinates are independent of screen size and resolution. If you maintain a fixed aspect ratio, the layout of the screen will remain the same.

 

With that approach, you can use higher or lower resolution images for the sprites to be used with different screen resolutions. If you create each sprite image with the same aspect ratio (width/height ratio), you can load only the images with the resolution needed.

Edited by Buckeye

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this