There are a lot of examples of morality systems in games. Games where there is a light or dark, good or bad choice. Often the choices are explicitly highlighted for you, and you will receive rewards based on how good or bad the game thinks you are acting.
While this construct feels artificial and "gamey", I have a suspicion that most developers feel that is just the best, most transparent way to present that facet of their particular game experience. Presenting numbers to the player so that they know, when the numbers go up, they “done good”. Of course we accept it as just one of many game systems. Being a good guy or a bad guy in most games is no different than choosing a vehicle or sports team. This one has 15 more horsepower and that one is strong on defense. Minor tradeoffs, that when accounted for lead to exactly the same victories and defeats. It’s just one of many variables to keep track of.
In our lives, morality isn't binary, or a guideposts to a known end. Acting "good", or "bad" doesn't guarantee that good or bad things will happen to you. We learn that very, very young. We smile and try to pet the dog that nips at us, or we lie to an adult and escape punishment. The world doesn't react to us based on our intent. But, over time, people do.
People will treat us differently, based on the way we have acted in the past. Of course there are outliers and sometimes people are just dicks for no reason, but the majority of people will adapt their behaviour to deal with ours, as we do with them. Usually in a complementary way. When a person is nice to you, you will likely reciprocate. When a person is confrontational, you will likely avoid them until you can’t and then, as before, reciprocate.
When we think of morality in this way, peoples behaviour can break down into a few simple states. To people accustomed to solving problems that you can break down into a few simple states, like game developers, human behaviour, and human morality, has the makings of a good, solid game mechanic.
The problem here is, we have no idea what other people are thinking or why they are thinking it.
There is no omniscient arbiter of good or bad. Just people. Just a bunch of people, all thinking different things, for different reasons. Each one as inscrutable as the next. This is the sort of mire that great characters and great narrative are built on. If we could instantly suss out the motivations and intent of a character in a narrative, a character that isn’t us or our avatar, what’s left? That character, or possibly the whole construct, will start to feel artificial. Flimsy. Gamey.
Lets say a companion character, who has followed the player for weeks in a game, gradually became more quiet and sullen, before leaving the group altogether. As a human being, I will be required by my biological and social programming to wonder what he was thinking, was it something I did, or was there something I could do to get them to come back. Or maybe I think about it and decide that it was that guy’s problem, not mine, and our group is better off without him. Probably, I oscillate between the two, and that character's decision to leave eats at me for the next few hours. At least.
This character leaving the group may not be a dynamic event arising from a complex simulation. It could be an authorial choice. There may not have been anything I could do, as a player, to prevent it. If this character lived in a novel or movie, it most certainly would be a predetermined choice. But I don’t need to know that. I don’t want to know that. The story is better for me not knowing.
Not knowing the mind of these characters, is precisely what makes them characters. The problem with morality systems in most games, is not how the system is set up. It’s not the calculations under the hood. It’s the presentation.
If the game system is silently keeping score of my triumphs and transgressions, the worst thing it could do to me is tell me. Just like a character seems more real if his motivations and intent are not transparent, the way the world reacts to the player should be left up to interpretation. What was it that made that character leave the group? Was it when I stole food from the camp rations? When I kicked his dog and seduced his mother? What did the game system consider morally wrong? I think I would rather not know. The story I create will be better for not knowing.