Experienced Points: The 200th Column – You Asked For This

By Shamus
on Dec 23, 2014
Filed under:
Column

Yes, I have written 200 Experienced Points columns. Here is number 200, where I answer reader questions. At an average length of 1,200 words, that’s about a quarter of a million words. If gathered into a book, it would be awkward and heavy. For comparison, Fellowship of the Ring is around 180k, and that thing is a pain in the ass to carry around.

I really enjoyed doing this. One of the things I dislike about this job is the search for topics worthy of doing a column. Will people care? Does this matter? Is this story going to be irrelevant, or fundamentally different, by the time this column goes live? I’ve scrapped a lot of columns and wasted a lot of hours digging for the “right” topic. Reader questions gives me a way to latch onto stuff that people care about, and it lets me cover smaller topics that might not be enough to fill an entire column.

So I hope this goes over well. My plan is that when I have one of those weeks where there doesn’t seem to be a worthy news topic, I can just dive into reader questions.

Of course, this was a terrible week to do this one. Christmas week is odd, traffic-wise. People change their browsing habits. So a tepid response might mean people are just busy Christmas-ing. I dunno. Maybe I’m over-thinking this.

Enjoyed this post? Please share!


201434 comments. Hurry up and add yours before it becomes passé.

From the Archives:

  1. Daemian Lucifer says:

    I didnt ask for this!

  2. Daemian Lucifer says:

    An addendum to your mirror question:
    Im not 100% sure if its just my memory playing tricks,but 3rd person games do have reflective surfaces reflect your character.Is the doofiness tied to the 1st person camera then?

    • Kian says:

      It would stand to reason, if Shamus’ explanation holds, that once all the work to see your character in third person is done, the reflection of that model is trivial.

      • guy says:

        Well, there are still issues, which is probably why Deus Ex HR doesn’t have them even though it’s already got a Jensen model that’s rigged for animations. I haven’t done mirrors, but I can’t imagine that the performance issue is trivial; the mirror needs to only reflect objects that are visible to the mirror and then the camera needs to only show reflections in the mirror that are visible to the player. That’s certainly possible, but not exactly easy, and it’s almost certain to require rendering objects that would normally be culled.

        I would bet that in most third-person games the mirrors are sited so that they’re in relatively simple areas and it’s hard to bring a large number of characters into the area, or the game is, say, Pokemon X and not exactly burdening the graphics system. I have seen reflective floors more frequently, but I imagine most of those cheat by just dropping a reflection at a character’s feet without checking to see if something is blocking the reflection, since it’s likely that anything which blocks the reflection will also stop the player from seeing the part of the mirror that would be doing the reflecting.

        • Phill says:

          Like most things in graphics, the performance hit for rendering mirrors is very, very variable (ignoring the whole first person game issue of not actually having a character model that can show up in the mirror).

          Mirrors can be a big hit, or a relatively trivial one, depending on where the bottleneck in your render pipeline is. Which depends on the game, the graphics card and other hardware fun.

          There are some inevitable overheads involved in fully rendering the scene again for each mirror, such as doing another cull pass (generally culling is pretty damn fast on modern GPUs) and having to keep extra stuff in render buffers for this that can be seen in the mirror but not directly (which can range from trivial to pretty serious, depending on the scene geometry).

          But the actual render pipeline, your frame rate may be limited by geometry, vertex shaders (innaccurately speaking, the number of polys visible), fragment shaders (number of pixels to render) or GPU data bandwidth (e.g. total size of textures to be used).

          If, for example, you are heavily fill rate limited (i.e. the large majority of your time is spent in fragment shaders) then mirrors are actually pretty cheap; firstly the mirror is mostly going to be a small fraction of the screen area, so not that many pixels, and more importantly, every pixel you render in the mirror is a pixel you don’t render in the main pass, since it gets z-culled before you call the fragment shader on it in the main pass.

          Conversely, if you are heavily vertex shader limited, then mirrors can get pretty expensive; you can readily have more vertices in a mirror than in the main pass, and you have to be able to handle the worst case of having a lot of stuff in the mirror (unless you are very careful to only put mirrors in places where they can never reflect very many objects). A simple approach to a single mirror in a general geometry can easily double the load on the GPU in this case, and again, possibly for a mirror that is quite small on-screen.

          Ideally (in general) the render pipeline is fairly well balanced between the burder placed on various shaders etc, so that there isn’t one that is a stand out bottleneck. But that does rather rule out the best case scenario for mirrors in a well optimised game. Which tends to make them fairly expensive, which is why various kludgy tricks that work just as well in 99% of cases are often used, and you just try and avoid letting the player see the cases where it illusion falls down.

          • guy says:

            I feel like you’d need a raytracing pass or something to really decide what it should show and get the perspectives right. Particularly if the player is looking at it from an angle. Though if the area is mostly static you could duplicate the static geometry and only raytrace dynamic stuff.

        • rofltehcat says:

          Deus Ex HR has both first person and third person camera available. Animations for 1st and 3rd person are normally very different. So if you’d stand in front of a mirror and reload your weapon or whatever, chances are those animations would not sync up nicely.

          Deus Ex 1 had mirrors, iirc.

      • HiEv says:

        What math to do is trivial. However the amount of math that may be needed, and hence the CPU hit, may not be trivial at all. Especially if, heaven forbid, you have two or more mirrors reflecting each other.

        It’ll almost certainly be decades before we see a game that shows the inside of a circus funhouse with a mirror-maze that isn’t done with some mathematical sleight of hand, rather than a true rendering of the scene.

  3. DaMage says:

    The mirror question is interesting, but I think you forgot the biggest point. Mirrors require the entire scene to be drawn twice, meaning they often come with a huge performance hit. Since most games are always pushing the edge in terms of how much they have on screen, true mirrors are simply too performance intensive.

    It can also play havok with how the scene is rendered, if there are object behind the player that are being unloaded, suddenly it all has to be back in memory as everything in front and behind the player must now be rendered. This is less of an issue, but I’ve seen some games do this *cough* Rage *cough*.

    • Grenaid says:

      I seem to remember he wrote a whole blog post about that very topic.

    • Eric says:

      True. Another thing you typically see in games is that the mirror is rendered at half, one quarter, or less resolution than the game scene itself. This reduced rendering resolution for specific effects is actually very common for some stuff (like explosions, where it’s not noticeable), but it looks pretty bad in mirrors.

      Fake reflections like cubemaps are very common even today. For instance, instead of rendering the entire scene over, the game renders a texture of the scene that doesn’t actually change (but might move to simulate the reflection changing). Generally, this is pretty effective and you really have to look for it to notice it a lot of the time. One example you might be able to pick up on – if you play Half-Life 2 and walk between rooms, you’ll notice the reflections on certain guns, scopes etc. change to a different texture. Again, does the job so long as you aren’t paying attention for it.

      Some older games literally used a second, full-resolution camera viewport to do reflections. This was pretty common in Deus Ex and other Unreal Engine games where you would see the entire scene duplicated on a shiny floor, or in a bathroom mirror, as well as any characters in the scene. But this has the obvious drawback of rendering the scene twice over, which incurs a significant performance hit.

      Today, this hit is nonexistent because our computers are so much more powerful, but now imagine say, a PS4 trying to run an Uncharted 4 scene two times over. Unless you specifically limit what can be “reflected” in the mirror (which goes back into “fake reflection” territory), or design a scene’s budget with that in mind (i.e. a simple small bathroom is easier to do reflections for than a huge open city), you are probably going to run into serious performance issues.

      • Geebs says:

        Mirrors are pretty easy to do, geometrically speaking, because they’re a generally flat surface and usually oriented to at least one of your scene’s major axes. Water is much, much, harder, especially if you render ripples or waves as real geometry (ever wonder why reflective water surfaces in games are always big flat polygons with waves added through bump or parallax mapping? This is why). It’s even more complicated when you do waves using transforms in the video card, because the CPU (which is usually responsible for the camera frustum) doesn’t even know where the surface of the water is! I’ve had some limited success with reading the depth buffer back to work out roughly where the camera was looking, and then using that point to figure where I should put the camera rendering the reflection, but it’s a real kludge and can screw up very easily, while reading back from the GPU to system memory is prohibitively expensive.

  4. Good point about Steam Shamus.

    But I think advisory requirement check would be best.
    Such that one can filter to “Will most likely run fine” to “May have issues running” “Will most likely not run” to “Will not run on Windows XP and older” the latter is not advisory in this case though, the developer stated or check and it did not run.

    The other advisory ones however are based on a performance profile/benchmark/info, and here’s the cool bit to solve one issue you pointed out Shamus.
    Machine profiles, you can add these and name them that way you can filter to:
    “Requirement filter: Off”
    “Requirement filter: All (Default)”
    “Requirement filter: Living Room”
    “Requirement filter: Mancave”
    “Requirement filter: Bedroom”
    “Requirement filter: Laptop Dad”

    Off and All are not changeable, but the rest are user added.
    In case of “Laptop Dad” games are listed and filtered such that it’s easy to see which games will most likely run well on it.

    If “All” is the filter then the user will see which games are most likely to run on which machine (with best machine listed first).

    Valve also has a lot of computer specs through Steam, and they could even do some semi-auto curation, if a lot of people has issues with a game on certain systems or systems with certain hardware combos then this could be taken into account on the advisory, and if a patch fixes the issue then the requirement advisory can be updated to reflect this, there is huge potential here.

    I’m over simplifying things a bit as the layout and filtering and grouping etc needs someone that is able to do nice design to lay it out properly.

    But as a “problem” this is easily solvable, after all I came up with his idea just now so I can only imagine that the Steam team at Valve will be able to do even better. Assuming they ever get this idea. (feel free to steal it Valve)

    • Peter H. Coffin says:

      Or (more simply) “This/these machines meet manufacturer’s minimum/recommended specs”. Pushes the ENTIRE issue of whether it will run or not back onto the manufacturer, which means fast closes on support tickets.

  5. AR+ says:

    Regarding which programming language to learn first, Google’s Peter Norvig ends up recommending either Python or Scheme in his article, Teach Yourself Programming in Ten Years.

    Regarding lurchy movement, there IS an alternative which allows for both precision and depiction of momentum, which is for the character to actively come to an immediate stop instead of just switching to the idle animation. Like, if you abruptly release the movement control from a full sprint, the character object immediately stops moving but is animated as forcefully planting a foot into the ground in front of them, and there is a brief scraping gravel sound or whatever. I’m pretty sure this is how Metal Gear Rising: Revengeance did it, though the last time I played was a year ago.

    • Sleeping Dragon says:

      Assassin’s Creed games have both the “sudden stop” animations as well as the actual feeling of inertia to the character. Not surprising with games that focus on freerunning as core mechanics. At the same time, because of said inertia, the characters would probably feel really unresponsive in a more shootery game.

  6. Bropocalypse says:

    Vampire the Masquerade: Bloodlines had mirrors but no reflections.

    • Tam O'Connor says:

      If only there was some sort of explanation for that! :D

      The obvious answer, of course, is that the Lasombra are to blame. They’ve stolen everyone’s reflections, Kindred and Kine alike, for a doppleganger army for the Final Nights.

      The less obvious answer is that no one in the World of Darkness can bear to actually look at themselves, so they never clean their mirrors.

      And a third answer – there is one person with a reflection: the taxi driver, in the rearview mirror. Oooooooh, implications.

    • Decius says:

      Duke3D had mirror with reflections, and they had the same graphical fidelity as the rest of the game. Get with it people! ;)

      That said, Portal handled the issue pretty well.

      I also think that low-cost rendering should be easy to mask so long as the writer doesn’t include a clean, high-quality mirror. Throw a dirty texture on the mirror, give it a low-quality reflection under that, and call it a day.

  7. Duffy says:

    Since this particular entry is about a question based article I don’t feel too weird asking a random question, are you using a plugin to do your little inline side note things or did you homebrew some html/CSS for those? I really like them and would like to use them for a project but after poking around your site source and Googling I have failed to produce anything useful besides a few examples on how to write something similar by hand.

  8. Eruanno says:

    On the topic of Steam system requirements: I suppose they could do a little checkbox in front of the requirements you fulfill/don’t fulfill or throw a warning message or whatever, but in the end that might not be accurate to how the game actually runs.
    I bought Dishonored back when it came out and it said I needed a 3 ghz processor (everything else was somewhere between minimum and recommended). Well, I only had a 2.4 ghz processor, but once I turned down a few of the more advanced options the game ran at 40-60 fps with zero issues. On the flipside, I was slightly above the recommended specs for Hitman Absolution and that game ran like crap. So the game that ran well would have warned me that it may not while the game that ran like butts wouldn’t have warned me.

    Not to mention this system would have no idea of knowing if this particular developer had a burning hatred for, say, AMD graphics cards *cough* Brink *cough*

  9. Thomas says:

    I hadn’t thought about first-person animation problems with reflections, that’s fun

  10. Zekiel says:

    Interesting column! I call it a success.

    One question I have (for the community) about recommended system specs – I have always assumed that the recommended graphic cards spec would actually be affected by your monitor size (and therefore screen resolution).

    I have a mid-range GPU but a relatively small monitor (19″) so I always assume that I will actually be better able to run games than my GPU type would indicate.

    Am I correct in my assumption?

    • guy says:

      That seriously depends. There are a lot of steps in the render pipeline, and only the very last one cares about monitor size, because it converts the results of the previous steps into actual pixels. The resolution you set the game to may alter what it does in earlier steps, though.

      • guy says:

        To expand on this, most graphics work is done with a 3d model of the scene. At some point in the process it’s likely to be moved to a coordinate system with every visible point fitting in a cube of fixed size because that’s easy to work with. Once all the lighting calculations and the like are done, it’ll get projected to a fixed-size square that will subsequently be converted to the actual display resolution. At some point (exactly when can vary and usually occurs at separate points; occluded objects might be handled apart from objects out of the draw distance, for instance) things that won’t be displayed for various reasons will be culled. The screen size only matters once all of that is done, but it is possible the game resolution may alter what assets get loaded. I think usually that’s decided by the other graphics settings, though. The resolution may also determine the size of the plane the cube is cast to, but that would make programming inconvenient and I’m not sure it’s better than casting to a (-1,-1)-(1,1) plane and later rescaling that. Might handle different ratios differently, though.

  11. Peter H. Coffin says:

    Re: Reflections

    So, what do you think the Portal games are doing? The use of two portals allows what behave like arbitrary reflections (obviously with even weirder rules about what math is done over the axises to account for that it’s not a reflection per se but rather redirected line of sight), but does more character animation than pretty much existed anywhere else in the game. (Honestly, I think the fact that you can LOOK THROUGH portals is the most interesting programming in the series — the physics involved is pretty run-of-the-mill otherwise.)

    • guy says:

      I’m guessing that it’s just that the games are relatively simple graphically and they can eat the performance hit no matter how you site portals. And they spent all the animation budget on Chell becauses she’s the only human character.

    • Muspel says:

      It’s worth noting that the first Portal game had a setting where you could determine whether or not you could see through portals (and if so, how many iterations it would let you see through before it just starting displaying orange/blue ovals). On lower-end computers, the framerate would drop drastically if you had that setting higher than 0 and you were looking at a portal.

      • Sleeping Dragon says:

        This. I remember when Portal came out I, and I imagine a lot of players, I did the “look into one of two opposing portals” thing as soon as I was able. The fps drop was immediate and I could pretty much hear my PC struggle.

  12. Darren Matthews says:

    For a first programming language I would suggest using http://scratch.mit.edu/

    It provides a drag and drop interface for programming. You have access to a whole community of projects for examples which you can copy and modify. It’s perfect for learning programming concepts and get immediate graphical feedback.

  13. I care less about the mirrors thing and more about why no other game utilizes the real-time computer interface like Doom3 had. God knows that game didn’t need it, but so many recent games really do.

Leave a Reply

Comments are moderated and may not be posted immediately. Required fields are marked *

*
*

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun.

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>