stonesense icon indicating copy to clipboard operation
stonesense copied to clipboard

An option for segment_size_XY:auto (also maximum to render)

Open PeridexisErrant opened this issue 10 years ago • 1 comments

If it is possible to resize the XY segmentsize while stonesense is running - and retrieve the dimensions of the window or overlay - an interesting possibility pops up.

To completely fill a window of X by Y pixels, we can render a segment of 2^0.5 * ( X + Y ) / 32 (rounding up) stonesense tiles on each side. Doing this while stonesense is running would cope with window resizing, while always filling the window regardless of user settings. For a fullscreen HD window, this comes out at 133 - meaning that the default of 70 may be increased for some users.

The init setting for segmentsize would then be a maximum, allowing users to cut off part for a crossection or performance reasons if desired, or reducing configuration otherwise. It would also help users who play different computers with the same package, since it balances screen size and performance automatically.

Further performance improvements could be achieved by not rendering tiles which would be outside the viewable rectangle. Using the minimum segmentsize to fill a given window, fully half of the segment will not be visible - so the improvement is potentially quite large.

PeridexisErrant avatar Jun 24 '14 06:06 PeridexisErrant

First, yes, it is possible to dynamically change The X and Y segment sizes dynamically. Indeed they can actually be changed independently. They are only combined in the config file. No clue why.

Your formula slightly oversimplifies some things, given the different modes, zooming options, and the functioning of the Z dimention, but the basic concept is valid and reasonable, and would actually make good sense to be the default option.

There actually is code intended to avoid rendering tiles that are completely outside the view area of the window. I'm not so sure that it is actually working though, since the check for invisible tiles comes earlier in the same method. That probably needs to be fixed.

I don't plan to submit a patch for this one myself, but I would like to see it implemented.

KevinCathcart avatar Jul 02 '14 21:07 KevinCathcart