Tech Interview: Metro 2033
Oles Shishkovstov on engine development, platform strengths and 4A's design philosophy.
I don't think we do anything unusual here. On 360 we first render the traditional depth from light point of view, then convert it into a ESM (exponential shadow map) representation while gauss-blurring it at the same time. Later during the lighting we do one bilinear lookup to get percentage in shadow.
The end result is that we avoid any jittering, noise, stipple-patterns or many costly lookups to filter shadow to get something that at least remotely looks like a shadow. Of course the 10MB EDRAM on 360 slightly limits the resolution of shadow maps, which can be noticed sometimes when the light source moves... We use that space for shadow-mapping only twice during a frame.
PS3 has different bottlenecks, that is why we use classic depth-based, multi-sampled shadow-mapping on it. We'll consider utilising SPUs for exponential filtering in the future to unify implementation and visual quality.
Each AI character in the game has feelings: vision, hearing and hit reaction. The vision model is pretty much close to reality: NPCs have a 120-degrees visibility cone and see those in the centre of the cone more clearly, also illumination and speed of the target is taken into account.
For instance, a moving object is seen more clearly in the darkness than standing one. Also a "look closely" effect is implemented. There are different levels of alertness: light disturbance, light alert, alert, uber-alert, danger.
Hearing is just the way to notify NPCs that something is happening nearby. Usually it's a sound, but it can be anything with similar nature - similar in this context means that it is constrained by walls and distance. So that's why we call inaudible "sound events" a smell. Each sound in the game has its own "AI mark" - it is interesting for AI, like shooting sounds have mark "combat.shot". For this mark, hearing distance is, for example 50 metres, which is quite a lot.
But using the renderer's portals/sectors the system hearing handler determines "virtual distance", taking into account walls, corridors. So an NPC on the other side of the wall will never hear what's going on here, because while the "straight line" distance is only five metres, the "virtual distance" using a sound path along the wall results in a 60-metre distance. There are also different levels of hearing - the same as in vision, actually.
Hit reaction is the information about hits taken by NPCs. Since friends can't take hits from each other, all hits are from enemies. The feelings layer provides only "basic" information - object, position, level. Objects can be friend or enemy NPCs, grenades or weapons.
The next layer is used to sort out this basic information and decide, what is the most important for NPC right now. Different levels of feeling are connected to different types of behaviour. For instance typical behavior for a "light disturbance" is saying something like "who's there?" and looking closer, whereas for the "uber-alert" it’s going out for a full search.
And of course, designers have full control over everything, so they can still make NPCs stand still or play funny animations even when a nuclear bomb is dropped nearby if it suits the scene.
The most important thing for stealth is a proper feeling system. If each NPC just knows where its enemy is, nobody can do a perfect stealth. For us, the goal was Thief's sensory system.
It is described in many articles. For instance "virtual distance" thing is similar to what they described in white papers. The next thing is behavior. Any stealth game needs additional "seek" and "patrol" behaviors. And of course, the sound system is really important. A player doesn't care what's happening inside NPCs while they aren't expressing it externally.
So, yes, our NPCs are 100 per cent stealth ready, but you are right, stealth also depends a lot on level design.
The PC side definitely became more and more optimised as a side effect. For example we don't need as much system memory as other PC-only games. Anything above 512MB RAM with DX10/DX11 code-path on Windows 7 would be enough. DirectX9 uses system memory backing store for almost all GPU resources, so you should add around 256MB to avoid page-file swapping.
The CPU side is slightly more problematic. Because the system is heavily multi-threaded, we need at least two hardware threads for "smooth" gameplay. The CPU performance doesn't matter that much, except on a few selected scenes during the whole game as long as it is relatively modern architecture (not Intel Atom!) and has more than one core.
As for the GPU, the console brothers have very little influence on the PC version, if any. The shaders are very different. The pipeline is very different as well. I mean they are very different - they just look similar and utilise the same art content.