RPGs are funny things sometimes. In fact, they can be downright frustrating at times. See, we all come together to tell a story, play a game, and have some fun. However, that isn't always what happens. Misperceptions can happen, lack of communication can happen, and a general feeling of uselessness or frustration can happen. This can be the most true when the GM is setting obstacles before the players, or otherwise determines that something the PCs want to do is going to be nigh on impossible to do. This can be frustrating for both the GM and the PCs, especially when you consider one of the big rules of GMing: the PCs should always have a chance at victory. Today, I want to talk about that.
Not Total Victory
The first thing I want to say, and technically already have with the topic, is that "a chance at victory" doesn't necessarily mean "a chance at total victory." The PCs should be able to win, they should be able to survive, but that doesn't mean that all of their goals should be accomplished. Failure is an important part of any story, and as the GM it is your job to sometimes place failure before the PCs. Now, this all comes with a whole ton of baggage of specific situations and when and when not to do it that I can't give you help with because a lot of those situations are group dependent. There is also the fact that even the best player, the one who understands that failure is important, will balk at failing in the heat of the moment. Oh sure, maybe later they'll like it and appreciate it, but in the heat of the moment when they're playing their character, they aren't looking big picture. Even still, just remember that you can have your PCs fail and still have some victory to hold onto.
A Matter of Perspective
What determines if something is a victory or not? A lot of that comes down to perception and worth evaluation. If the Fighter dies, but in doing so manages to save the rest of the party, then the player may feel like that was a victory. At the same time, if the PCs fail to prevent something from playing into the villains hands, but do manage to kill a hated enemy NPC they may - while still acknowledging their failure - take that as a victory that they can hold onto.
As the GM you can shape these perceptions as well. You can focus on the good and show the players what they've achieved. have them recognized for what they did, even if things do go sour for them briefly from the bigger perspective. How the world reacts to something can be a big part of how something is perceived, and you have the power to control that.
Player Victory Not Character Victory
The other way is to have the player win while the character fails. This is one of those things that really cements a "story focused" style of game play (even if running a campaign this is possible) and also requires communication between the GM and the players. Simply put, sometimes the characters can't succeed, but that is ok if the players aren't necessarily looking for that to happen. Take for example the Dark Heresy game that I am in. For whatever reason the PCs have gone rogue and are trying to get to Earth to save humanity. Anyone familiar with the 40k universe knows how impossible this task is to accomplish, and the GM was frustrated for a couple weeks with trying to make the character victory possible while keeping the feel of the world. Ultimately, he emailed everyone saying he wasn't sure what was going to happen and asked what folks wanted out of the end game. Within an hour 3/5 of the players had responded that they wanted to go out with a bang that ultimately had them failing, but failing in an action packed way.
Now, I don't know if that is how that game will end, but it is a clear case of the victory for the players is "an awesome ending" but that awesome ending could be coming in the form of defeat for the characters.
It Does Take Guts
All of this said, and I can talk theory with you all day (I have been for 2+ years now, actually) but there is more to this than just knowing/thinking about it. You also have to be able to do it in the middle of the action. You have to take the gamble for a better game by putting these hard obstacles, these big chances for failure that may seem unforgiving at times, in front of your players and hold fast to it despite the waves of frustration that are coming off. If it is going to be particularly brutal you can warn them before hand. If it didn't go over well you can discuss it afterwards. Still though, you sometimes just have to do it and then stick to your guns on a matter. If it doesn't work out, you learn for next time. Just ask your players to give it time and see how it plays out. Not everything will work out the way they want them to. Even their plans can, will, and should fail upon contact with the enemy/other characters.
this came out a bit more rambly than expected, and I'm sorry for that. This is a hard thing to discuss though, as everything in it is so situational. Still, how do you handle this? What would you add to the discussion? What kind of failures do you have no problems putting in front of your players? Which do you try to avoid them even having to face?