Tuesday, December 27, 2016

A lesson developers seldom learn: Text-based tutorials

There exists a principle of graphical user design that many books and university courses on that subject present: If you feel the need to explain the use of some element via a text label, that's a sign that it's badly designed and could benefit from a re-design. The simpler the element is to use, the more likely it is that it's badly designed if its use has to be explained with text.

(Note that this is different from simply naming an element with a text label. The name of, for example, a button can make it clear and self-explanatory what that button does. Problems begin when the function of said button is not clear from its name alone, and instead there needs to be additional text explaining what it does. Perhaps the most egregious example of this is a dialog with something like "click OK to (do something)", or similar.)

Optimally a user interface would have as little explanatory text as possible, and still be very intuitive and easy to use, where every element is either completely self-explanatory, or at least very easy to figure out (and doable so "safely", in other words, just trying it doesn't cause irreversible, or hard-to-reverse, changes to anything.)

This same idea can be, and optimally should be, applied to video game design as well. It should be a lesson taken to heart, with the vast majority of games: If you feel the need to explain something, or add a tutorial, in the form of text on screen, then you are doing it wrong.

As an example, suppose you are making a 2D platformer, where the playable character can "wall-jump" (in other words, when the character is in mid-air, but touching a wall, the jump button will make the character jump off the wall, to an even bigger height). These wall-jumps may be an integral part of gameplay (even to the point of some levels requiring it to be passed.)

There are essentially two options to inform the player of this mechanic: Explain it with text, or create an introductory level where players will intuitively and naturally discover the mechanic on their own.

Some games embrace and implement this idea of subtle "tutorial levels" to a magnificent extent (the Portal series being a good example.) However, way too many games are too lazy about this and will simply go the easy way of just slapping some text-based tutorial texts on screen. This just feels like lazy game design.

Intuitive controls and game mechanics, learnable without any text-based tutorials, are especially important in casual and mobile games. That's because the average casual gamer does not read text. (There is also the practical consideration that not all players might actually understand the language.) But they are important in all types of games.

But this is a lesson that most game developers have still not learned. Text-based tutorials are ubiquitous, even though games that succeed in being intuitive without them feel much better designed.

Friday, December 23, 2016

PS4 Pro 4k checkerboard interpolation explained

The PlayStation 4 Pro is an upgraded version of the original PlayStation 4, with a more efficient CPU and graphics chip. New to the console is native support for 4k displays, in other words 3840x2160 pixels (which is exactly double that of the standard 1920x1080 "full-HD" resolution in both directions, or, in other words, exactly four times as many pixels.)

The 4k resolution is, however, quite demanding in terms of graphics hardware, and even the PS4 Pro is not capable of rendering many existing PS4 games at that resolution (as it requires four times as much fill rate from the graphics hardware.)

In order to take advantage of the 4k display, however, the PS4 Pro uses by default (unless a game specifically wants to use native 4k) an interpolation mode in which only twice as much fill rate is needed, rather than quadruple. In other words, it renders the game at 1080p twice, covering half of the entire 4k screen, and then interpolating the other half.

It does this by first rendering the game normally at 1080p, and then again, but with the viewport shifted by half a pixel diagonally. When these two images are then interweaved onto the screen, it will cover the entire 4k display with a kind of checkerboard pattern. The remaining pixels are then just interpolated from the surrounding pixels, which is a lightweight operation for the graphics hardware to do.

The following image (which has enlarged pixels) demonstrates this process (click on any of the images below for a full-sized version). The first image is a small section of one of the two 1080p images, the second image demonstrates the checkerboard pattern formed by the two 1080p images, and the third image has the remaining pixels interpolated from those.


As you can see, the final result will have more details to it than the original 1080p version.

Below is the same example in four modes for comparison, how they would look like in a 1080p and a 4k display: The original 1080p version, that version simply upscaled to 4k, the checkerboard interpolated version, and a version rendered in native 4k.


While the checkerboard-interpolated version doesn't exactly match the quality of the native 4k resolution, it's nevertheless closer to it than the 1080p version.

That section, as well as the following ones, are taken from this screenshot. The locations of the details being demonstrated are marked in the image. Click on the images to see a full sized version.


As the last image demonstrates, this technique is not always without its flaws, as it sometimes introduces a very distinctive dithering-like pattern. The quality of the technique is highly dependent on what kind of content the image contains.

Tuesday, December 20, 2016

Choosing the perfect monitor... harder than one might think

I decided recently to buy a new monitor to replace my almost 7-years-old BenQ GL2430. Not that there's something wrong with it; it's actually quite good for its price. But I wanted something better, especially since I have a PlayStation 4 Pro.

There were several things I was looking for.

Panel type


That old monitor used a TN (twisted nematic) display. The advantage of that panel type has historically been a much cheaper price, and good refresh rates. Although in this particular case a 5 ms refresh rate is nothing to brag about. The biggest disadvantage of TN panels is that they have extremely poor viewing angles, especially vertically: With that monitor (as well as most other TN monitors as well), you only need to raise or lower your head a few degrees to see a significant change in colors. It's in fact so bad that the upper area of the display will have a visibly different pixel coloring than the lower side, for the simple reason that the viewing angle is different for them (unless you are watching from quite far away).

A much higher quality alternative is the IPS (in-plane switching) panel. While not absolutely free of that viewing angle problem, it's nevertheless only a very small fraction of that, compared to TN panels. Also IPS panels tend to have more vibrant colors, and be able to reproduce the entire sRGB color spectrum better and more accurately (which is why they are preferred by professionals dealing with graphics, such as printing). Historically their disadvantage has been a higher price, and slower refresh rates. However, in recent years both things have improved significantly, up to the point that IPS panels are seriously starting to compete with TN panels in terms of reaching the mass market.

Since I'm upgrading my monitor, I really prefer the IPS option.

Resolution


The next consideration was the resolution. While 1920x1080 of that BenQ monitor is not horrendous, if I'm upgrading my monitor I would prefer a higher resolution. There are several options for this, but the two most common ones with a 16:9 aspect ratio are the WQHD resolution, ie. 2560x1440 pixels, and the 4K UHD resolution, ie. 3840x2160 pixels (which is exactly twice the amount of pixels of the standard 1920x1080 on both directions).

Now, if I had been buying this for my PC only, then the WQHD resolution might have been the perfect spot. That's because my PC, while quite a hefty gaming PC (i5, GTX970), is not exactly capable of rendering most modern graphically-heavy games at 4k resolution at 60 FPS. But that 2560x1440 ought to be fine. The problem is, however, that I am also buying the monitor for use with the PS4 Pro.

The PS4 Pro only supports "standard" TV resolutions. That means 1080p or 2160p, but nothing in between. If you connect a 1440p monitor to it, it will simply use a 1080p resolution. (This information was actually surprisingly hard to find online.) Using a 1080p resolution on a 1440p monitor might not be the best possible scenario (as each source pixel will be scaled to 1.333 size for the display, meaning that two thirds of the pixels will be blurry.)

While buying a 1080p monitor was not completely out of the question, it was really tempting to be able to use the PS4 Pro at 4k. Thus, preferably, the new monitor would be a 3840x2160 "4k" monitor.

There was one additional requirement for the 4k monitor, though: It had to support HDMI 2.0 as input. That's because HDMI 1.x only supports 4k resolution at 30Hz, while HDMI 2.0 supports it at 60Hz. The PS4 Pro has a HDMI 2.0 output, and can, at least in theory, output in 4k at 60Hz. Some games (current or future) might even do that.

So, primarily I would be looking for a 4k monitor, with a fallback to a very good 1080p one if everything else fails.

G-sync


The next consideration was a long-time dream of mine: G-sync support. It would just be great to be able to have g-sync, and not worry anymore about games not just quite reaching that golden 60 frames per second, and me having to resort to some sort of compromise (ie. either lower the graphical quality, or accept a 30-fps lock.)

And, of course, the price of the monitor shouldn't be exorbitant. While I was ready to spend a decent amount of money on it, I'm not exactly super-rich.

Conclusion


So, one would think that the best possible solution to all of the above is, well, all of the above. Except it turns out that, at least at this point in time, there doesn't seem to be a monitor available with all of the above features!

The closest thing that seems to exist is the Acer Predator XB271HK: 3820x2160, IPS, g-sync. That would seem like the jackpot, except for two things: It only has an HDMI 1.4 input port (meaning that the PS4 Pro wouldn't be able to use it at 60Hz), and a rather hefty price. That former limitation is quite a killer; if only it were HDMI 2.0, it would be an almost perfect monitor, even considering its price. It's really incomprehensible why Acer decided to put a HDMI 1.4 input in it (given that they have HDMI 2.0 in many of their other 4k monitors.)

4k monitors with g-sync are still a real rarity, even if using TN, and especially if using IPS.

Perhaps quite surprisingly, my fallback plan doesn't seem to be much better either: The combination of 1080p, IPS and g-sync seems to be almost as rare! There just don't seem to be almost any monitor with that combination either. (This would be a much easier choice given that it wouldn't even need to have HDMI 2.0.) Basically all 1080p g-sync monitors are TN.

There are quite many 1440p IPS g-sync monitors out there but, as said, that's a bummer in terms of using it with the PS4 Pro.

I in the end, I decided to purchase an Acer S277HK: 4k, IPS, HDMI 2.0, and quite good reviews. And at a discount when I bought it (normally almost 700€, but discounted at 597€). No g-sync, but I'll just have to live without it, as I have done so far.

(In the end, g-sync has a lower limit of 30Hz, after which it just stops working and resorts to your normal screen-teared no-sync, or regular sync. Playing at 30Hz with a regular monitor is not all that bothersome to me, so I suppose I'll just have to be content with that, with the heavier games.)

So, does it look good?


It actually looks better than I expected, both on the PC and the PS4 Pro. In the latter, for instance, prior to this purchase, I was playing Titanfall 2. After I got the monitor I continued the game with it, and it looked really great. I don't know if this game in particular is using 4k natively, or that 2x1080p checkerboard-interpolation scheme, but it certainly looks like native 4k nevertheless. All edges are crisp and razor-sharp, and everything is full of tiny details.