   Resolution dependent game - totally useless now?
  Well, I nearly finished my game, but it turns out that a resolution of 1280x800 is hardly supported by anything. Is there anyway to make it work on, say: 1024x786 aswell, and not having everything screwed up? Please keep in mind that I position my GUI in absolute pixels, and also query mouseclicks that way. (a button width width and height 100pixels, should still have a correct hot area, even when stretched/refitted to the new resolution).One thing I learned the hard way already: test on old, non-gamer machines first.   
  Quick and dirty: render everything to a rendertarget or off-screen texture, and scale it down to the desired size, keeping the aspect ratio. On 1024x768, you'll have black bars on the top and bottom, but I don't think that's a deal-breaker.Do the same for your mouse clicks - if you're running at 1024x768, scale the coordinates up (eg. by 1.25x for the x and y, for 1024x768 -> 1280x800) so that the rest of your application believes you're running at 1280x800 rather than some other resolution.   ;Quote:Original post by Sc4FreakQuick and dirty: render everything to a rendertarget or off-screen texture, and scale it down to the desired size, keeping the aspect ratio. On 1024x768, you'll have black bars on the top and bottom, but I don't think that's a deal-breaker.Do the same for your mouse clicks - if you're running at 1024x768, scale the coordinates up (eg. by 1.25x for the x and y, for 1024x768 -> 1280x800) so that the rest of your application believes you're running at 1280x800 rather than some other resolution.To add:In fact most commercial games are resolution specific and you get the rest of the resolutions just by some scaling - maybe not as simple as described above, but certainly, they don't have a different version for each resolution supported.   ;  Thank you, that certainly took a load of my chest. I'll look into rendering to texture, I never needed that before.Quote:In fact most commercial games are resolution specific and you get the rest of the resolutions just by some scaling - maybe not as simple as described above, but certainly, they don't have a different version for each resolution supported.That makes sense, I suppose user interfaces in high resolution games just scale down a larger gui component depending on the resolution needed.@Sc4Freak: What would be the correct way of doing it, since you said "quick and dirty"? I have seen games that have no black bars, and still support all kinds of possible resolutions. (left4dead for example)   ;  Compare; The Elder Scrolls: Oblivion, Half-Life (1, 2, 2.1, 2.2), and most other first-person games. Runs at any resolution because they have very minimal interfaces, or vector-based interfaces, or geometry-based interfaces with texturing that looks very good even when scaled up.Contrast; Etherlords (I, II), the default HUDs of Descent (I, II, not III), most strategy games; a hard, usually very low minimum resolution, either only one or two resolutions are supported, and often the interface maintains fixed pixel dimensions when higher resolutions are selected.This all used to be just a matter of scaling linearly up, until PC monitors in varying aspect ratios became more common. These days, we don't just deal with 640x480 vs 800x600 vs 1024x768, which all have the benefit of being 4:3. We have 1280x768 (4:3), 1280x1024 (5:4), 1280x720 (16:9), 1280x800 (16:10), 1440x900 (also 16:10), 1600x1200 (4:3), 1680x1050 (16:10), and more.Adaptability to differing aspect ratios is more important these days, so you likely want to clamp different parts of your interface to different edges of your screen, whether your interface scales to fit the expanding resolution or not.   ;  sothere are a few ways to provide "resolution independent" UI. 1. use a normalized device co-ordinate system for the placement of UI objects. This means you can run at whatever damn resolution you want, and the UI will be in relatively the same location. The problem(s) with this approach is that you can get nasty sub pixel accuracy issues (where the normalized co-ordinate system position value is mapped halfway between two pixels), and there is a question on how you handle UI Element Scale.You can either scale your UI uniformly, although this is not recommended, or the oft used alternative is to provide scaling hints to individual UI elements. eg: Fixed Height, Scale Width. No Scale, or Scale et al.  You'll still need to provide some way of justifying objects which represent tiled images though.2.You introduce a concept of an "anchor". The anchor is typically an enum value, which indicates which edge(s) of the screen the object is anchored to.For example, the health bar might be anchored to the top of the screen. This means, that if the target resolution is different to the original, authored resolution, the distance that your Health Bar is from the top of the screen will be scaled by the relative scale between two screen heights.You could also anchor things to multiple edges, or even to the center of the screen using a similar approach.You may still get some sub pixel issues, but this approach tends to produce far better results than the first one.You still need to deal with the "scale" of the actual object, and the same approaches can be used here, as in the first solution.