Hacker News new | ask | show | jobs
by Nuthen 1282 days ago
Great article, thank you for sharing this experience. The part I found most interesting is the section about the aspect ratio and interpolating between the 16:9 and 16:10 views relative to the original, although I'm having some trouble fully understanding the implementation. Why is the game interpolating between them based on the games aspect ratio?
1 comments

I can't know ahead of time the exact aspect ratio the player will run the game at. 16:9 and 16:10 are the most common on today's monitors, but the game might be running in a window, or fullscreen on an unusual monitor.

If I just made the game at a fixed 16:9 ratio, it'd leave empty space at the edges of any window that isn't exactly 16:9. Same if I chose 16:10 or any fixed aspect ratio.

By supporting a range of ratios between 16:9 and 16:10, I maximize the number of window sizes that the game will display nicely in without any empty space (black bars) at the sides.

The best way, I thought, to support a range of aspect ratios was to define two rectangles in the scene, having the minimum and maximum ratios supported, and interpolate the camera rectangle between them.

Hope that makes sense!

I really appreciated the visualization you provided for that.