Jump to content

  • Log In with Google      Sign In   
  • Create Account

Game resolution


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 lastuser   Members   -  Reputation: 119

Like
0Likes
Like

Posted 29 April 2013 - 02:50 PM

Hi everyone!

 

Im a very rockie DirectX and game Programmer.

 

Short Story:

Im making a 2D Game haha.

 

My question is about game resolutions, lets say I have the background of my game at 1920 X 1080 px, so this image will look good on that resolution. 

 

What happens if the user have a 1024 X 768 resolution, should I put a image with that size and detect the resolution? 

 

How it's done on DirectX?

 

Thanks in Advance.

 

LastUser.



Sponsor:

#2 Racoonacoon   Members   -  Reputation: 443

Like
1Likes
Like

Posted 29 April 2013 - 03:51 PM

Hey LastUser,

 

What I typically do is draw the game onto a render target that has a set size (such as 1920 x 1080) and then apply a scaling matrix with letterboxing to get it to fit on the user's resolution. The advantage of this is that it is pretty easy to do and it looks good, but the downside is that you are always rendering to a potentially large render target when the user may have a much lower resolution.

 

Another option is to draw more or less of your game depending on the resolution the game is running at. The disadvantage of this method is that it may change the gameplay mechanics somewhat. For example, if the user played your game with a huge resolution they would be able to see much more of the world, which may enable them to spot enemies and such, while someone running your game on a low resolution would get a much narrower view.



#3 lastuser   Members   -  Reputation: 119

Like
0Likes
Like

Posted 29 April 2013 - 04:08 PM

Hi Racoonacoon,

 

Thanks for the reply!

 

Yes, that's a problem, the mechanics must be the same and the user muyst see equally far at  high and low res.

 

Making sprites and images for all resolutions is not an option.

 

I think the first option is the best, the game should adapt the images to the user resolution, I'll try that!

 

May I do another question?

 

When game developers talk about a render target is something like LPDIRECT3DSURFACE9, Sprite and that sort of things?

 

Thanks again!

 

LastUser



#4 Adam_42   Crossbones+   -  Reputation: 2512

Like
1Likes
Like

Posted 29 April 2013 - 06:00 PM

Don't forget that monitor aspect ratios vary significantly. Standard resolutions range from 5:4 for a 1280x1024 screen through 4:3 and 16:10 to 16:9. You can also get other values, the most extreme ones tend to be multi monitor setups. http://store.steampowered.com/hwsurvey has some stats showing which resolutions are most popular.

 

Also if you support running in Windowed mode then, unless you don't permit resizing, almost any aspect ratio is possible.

 

Ideally the game and user interface would adapt to fill the screen with something useful regardless of what shape and size the monitor is.

 

On the other hand doing that is more work than just supporting one or two standard shapes, and using some combination of stretching and letterboxing for the others.



#5 Racoonacoon   Members   -  Reputation: 443

Like
0Likes
Like

Posted 29 April 2013 - 08:09 PM

When game developers talk about a render target is something like LPDIRECT3DSURFACE9, Sprite and that sort of things?

 

It depends on what version of DirectX you are using. I'm not really familiar with DirectX 9, but I know DX 11 uses ID3D11RenderTargetView for its render targets.



#6 VladR   Members   -  Reputation: 722

Like
0Likes
Like

Posted 01 May 2013 - 03:02 PM

When game developers talk about a render target is something like LPDIRECT3DSURFACE9, Sprite and that sort of things?

 

It depends on what version of DirectX you are using. I'm not really familiar with DirectX 9, but I know DX 11 uses ID3D11RenderTargetView for its render targets.

 

The Render Target concept is independent of API (Mesa, OpenGL, DirectX, XNA, ...), moreso the underlying version (DX9 vs DX11).


VladR    My 3rd person action RPG on GreenLight:    http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

 


#7 Norman Barrows   Crossbones+   -  Reputation: 2158

Like
0Likes
Like

Posted 01 May 2013 - 05:35 PM

I think the first option is the best, the game should adapt the images to the user resolution, I'll try that!

 

d3dxsprite can handle this for drawing your sprites.

 

but you'll want to implement a device independant screen coordinate system for your calls to draw sprites and text.

 

you define a  virtual 10000 x 10000 screen coordinate system.

 

you store the current resolution the user is running at: screen_w, screen_h.

 

then you have a set of routines to convert from virtual to screen coords and back:

 

screen_x = virt_x * screen_w / 10000.

screen_y = virt_y * screen_h / 10000.

virt_x = screen_x * 10000 / screen_w.

virt_y = screen_y * 10000 / screen_h.

 

so to put text at the middle of the screen you say text(5000,5000,"hello world!");

 

and your text routine converts 5000,5000 to screen coords, and your text appears in the middle of the screen at all resolutions.

 

you do likewise for the x,y and scale for sprites, and your entire 2d graphics system will be device independent and will work with any resolution up to 10000 x 10000 that the user's hardware can run.

 

note that d3dxfont creates fonts at one size and can't scale them on the fly. if you use it, you'll want to recreate fonts at new sizes when the resolution changes, so the text stays the same size all the time. 

 

also note that d3dxfonts are SLOW!

 

an alternative to d3dxfonts it to make your own set of font textures in a paint program, then simply display them like any other sprite. MUCH faster. and since they're a sprite, they will be automatically device independent along with the rest of the engine.


Norm Barrows

Rockland Software Productions

"Building PC games since 1988"

 

rocklandsoftware.net

 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS