Game developers have tried to fix this problem and come up with their best solution: multiple endings. Now, your actions in-game affect the story's outcome. This brings up some interesting ideas. In Castlevania: Dawn of Sorrow, there are three endings, the bad ending (not sad, just a really crappy ending), the good ending (an honest-to-goodness unhappy ending), and the best ending (the standard "everyone lived happily ever after" ending). In that middle ending, Soma loses himself to the chaos within and becomes the new embodiment of the dark lord, Dracula. This also opens up an interesting bonus game in which you must play as Julius Belmont and kill Soma. However, in order to get this ending, you must decide to forgo two more map areas, three more bosses, including series-favorite Death, a bunch of souls, and the very useful Chaos Ring. If you want to play the full game, however, you will be stuck with the "best" ending, which isn't nearly as cool.
The problem here is that the game developers intend for only one of the endings to be canon so as to avoid confusion if/when a sequel is released or just satisfy curious fans. The canon ending is almost always the happy ending where everything works out. While I'm fine with some
happy endings, making them canon always gets boring. Some developers have stated they liked an unhappy ending better, but if gamers want to play the game to its fullest and complete the game successfully, the game will give them the best, canon ending as a "reward." In the end, the game panders to gamers who, having spent at least 10 hours playing as a character, need to make sure that everything ends okay for that character, even if an unhappy ending would be more interesting. Or maybe it's the developers' reluctance to destroy a character they've built up over two or more games.
Whatever the reason is, developers should not be afraid of crafting a meaningful, sad ending to a game if it makes more sense. (I don't want to see Mario gunned down by alien gangsters at the end of Super Mario Galaxy.) The gamer has already played most of the game and the developers have their money; the ending should not have to pander to their self-gratifying dreamland where everything works itself out perfectly for the good guys.
Author's Note: I know that there are notable exceptions out there and many people probably want to tell me how wrong I am in my views, so feel free to state your mind. Just keep in mind that not every gamer has played every important game and label your ending spoilers appropriately.