Author Topic: Weird question about game resolution  (Read 5600 times)

Anu8is

  • Posts: 4
  • Maggot Crusher.
    • View Profile
Weird question about game resolution
« on: May 17, 2015, 11:22:11 AM »
Soooo, hello everybody! Long time no see, huh? (Since i post my message last time  :-X) So, now i have new question for developers that may be kind a weird. I found that scale of Hammerwatch sprites change after every 704 pixels. For example if your screen resolution is 398x657 => 1056 pixels, now if you add 704 pixels to that (value is 1760) and find resolution which match that value (ex. 1000x760) then sprites change size! My question is: why 704? This is some rule, or just you want that? I'm interesting  ;D

P.S.: and again sorry for my spelling, english not my native language. :-X

Myran

  • Developer
  • Posts: 183
    • View Profile
Re: Weird question about game resolution
« Reply #1 on: May 19, 2015, 12:56:47 AM »
Well, the number 704 isn't really chosen for any reason other than what we like the view distance to be.

Here is the code that sets the scale:
Code: [Select]
if (WorldDrawer.RenderSettings.LetterBox)
height = (int)Math.Round(width / (16f / 9f));

Width = width;
Height = height;

var idealScale = (height + width) / 44;
if (width / (float)height > 2.5f)
idealScale = height / 16;

int scale;
var scales = new[] { 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192 };
for (scale = 1; scales[scale] < idealScale; scale++) ;

if (Math.Abs(idealScale - scales[scale]) > Math.Abs(idealScale - scales[scale - 1]))
scale--;

cam.ScaleFact = scales[scale];

So I set the ideal scale to be "(height + width) / 44", then I adjust it to get an even multiplier of the pixels so that we can have pixel-perfect rendering. That 44 gets multiplied by 16 in the render code since 16 is the scale that the sprites are at (and 44*16 is 704). So changing that zooms the camera in or out and we just set it to whatever we thought was good.
This breaks at weird aspect ratios which is why I added the "if (width / (float)height > 2.5f)" check.

czarman

  • Posts: 1
  • Maggot Crusher.
    • View Profile
Re: Weird question about game resolution
« Reply #2 on: June 08, 2015, 03:13:56 PM »
But is it possible to edit this code to a different scale?

We would like to have a higher Resolution 2560 x 1440 or better 3440 x 1440 but without the Zoom scaling factor - like 800 x 600 pixel rate.

So the Pixel Rate should stay at 800 x 600 but the Resolution is much wider / higher / bigger.

So the Picture is very crispy and FOV would be stunning.