Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Screen size problem

Started by mjnhfgbdsafbxhg 10 replies 2.4k views
Original Post
mjnhfgbdsafbxhg
mjnhfgbdsafbxhg
Im using tiles to render an isometric map, with a resolution of 1024x768. If i change the resolution, my map (and all the game) will be bigger or smaller; instead i want that the aspect to be the same with any res, and have the same number of tiles in the screen (using 1024x768 as reference). Can someone tell me how to do this? The only solution i found was creating a scaling matrix and add that transform before rendering any sprite, but i dont know if there are better alternatives! p.s. sorry for the bad english :D
Dunge
Dunge
One thing you should do is first only accept 4:3 resolutions so no wide screen user cheat. Other than that, Direct3D usually scale polygons to look the same on any resolution, so I guess you use another API? Need more information..
mjnhfgbdsafbxhg
mjnhfgbdsafbxhg
Hmm.. maybe i found an easier solution. I render all my sprites to a 1024x768 surface (supposing my graphic was based on the same resolution reference) and then if the user has different resolution, i stretchrect it on the backbuffer. What do you think?
Grycil
Grycil
I don't see the interest to have different resolutions if you display exactly the same image.
You should rather force the user resolution. It will avoid the artefacts generated by the stretching.
hornpipe2
hornpipe2
Plus if that stretch isn't hardware-accelerated it will slow your game down running at anything other than 1024x768.
My 4eV entry: Euro1943
jouley
jouley
IMO, it's much better to NOT force a resolution on a user for something like this. Not only is it another step between me and playing the game, but it's annoying to have to resize/reorganize any windows/icons that happened to get sized/moved during the switching. Also, though 1024x768 is a standard resolution, you can never be too sure that everyone out there has a monitor that can handle it. Unless your performance really takes a hit when resizing a surface or using your scaling matrix, I'd stick with that method. I had to do the same thing when making my first Win32 GDI games, and if that can handle the processing, I feel confident that DirectX can, too.

In the end, though, do what works! Best of luck,
-jouley
Kaze
Kaze
i not up to date with directX but the way iv tried consists of;

1- get a list of all available resolutions
2- choose the one closest to what you want
3- makes the largest 1:1.2 (or whatever you want) rectangle you can make
4- set up the screen as that rectangle and scale the coordinates so from one corner to the other is 0,0 to 100,120
(i don't know what the directx eqivalent to glviewport and glscale are)

Doing this lets you run in any resolution without having to alter internal game code or having the graphics distorted, this is important because laptops don’t use standard resolution.
kvp
kvp
Quote:
Original post by Kaze
i not up to date with directX but the way iv tried consists of;

1- get a list of all available resolutions
2- choose the one closest to what you want
3- makes the largest 1:1.2 (or whatever you want) rectangle you can make
4- set up the screen as that rectangle and scale the coordinates so from one corner to the other is 0,0 to 100,120
(i don't know what the directx eqivalent to glviewport and glscale are)

Doing this lets you run in any resolution without having to alter internal game code or having the graphics distorted, this is important because laptops don’t use standard resolution.


An old trick to use instead of stretching the coordinate system is to make a window inside the main window and surround it with a border. (the border can be bitmapped or plain black) This way the actual game will always run in a fixed window but will be resolution independent. (smaller resolutions than the internal window won't work, but all larger ones will, including non 4:3 ones)
mjnhfgbdsafbxhg
mjnhfgbdsafbxhg
Thanks for the answers! In directx is easy too to do that; about the performance, i still have to try, but i think it doesn't hurt much.. :)
Ey-Lord
Ey-Lord
I won't go that way. Espacially for the 16/9 resolution.
I can tell you, it's very ugly /frustrating/... to play a 4:3 game when you are on a wide screen .

In many games, every resolutions are accepted and the biggest you got, the more you can see on the screen. Unfair ? Not so much, it does give a slight advantage but i never saw any game where the top player were better beacause of a biggest screen ...
If your game is offline, then the problem is not even a problem anymore, since the player has no advantage vs other player.

If, the field of view is a problem with hight res, just blur it a bit on the edge so the advantage of seeing more is reduced a bit, but the player still have something to view on the screen . ( or any other trick taht will do the job ).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.