There's a fine line between tasteful and gratuitous.
Tasteful is the act occurring to accentuate the narrative, while gratuitous is to focus primarily on the act; be it sex or violence.
If you've ever heard the saying "less is more" that can apply to these situations, especially if you're working at a PG-13 vs R rating. That doesn't mean to not have it in your game--but not take focus away from the overall point of the game--only to accentuate it.
However--if your game's point is gratuitous sex or violence--then you'll already know what kind of game you're making.
If two characters are going to have sex; you can have as much fun with that as you want--but the moment nudity is shown, you've passed into an R or 18 rating. If--more sexy things happen and it's shown on screen with imagery, video or sound, then you've crossed into A/O.
With violence--killing a character is enough, but including copious amounts of gore imagery and sounds would put you closer to an R/18 rating.
Another thing to consider--cursing, alcohol, drugs, gambling, and certain crimes can also put you at an 18 rating; depending on the situations.
I think manga like Berserk did add violence and sex (and not consensual sex...) just for the sake of it, and it does so to a "gratuitous" degree. And yet the story is so good, and the violence is so awesome, that everyone loves it anyway - perhaps the R18 nature of it is what got them hooked in the first place.
If you're gonna add violence and sex, just make it badass, and not gross... unless it's a horror, in which case, make it as gross as possible. Also, do not add lighthearted comedy scenes right after some disgusting violence occurs, either; many anime do this and it really turns me off from the story.
It also depends on a person's preference, of course. Some people are more sensitive to this kind of thing. Keep your target audience in mind. So if you want your mother to play your game, then perhaps don't go to Berserk levels of violence, and keep it more along the likes of PG13 Hollywood (think Jurassic Park or even Harry Potter).
It all depends for me, and most of it comes down to why?
Is it sex and violence for the sake of shock factor? I don't like that. There's also plenty of sexual themes I just wouldn't write in certain things. Rape for example, is something I'd never make light of, but a game that highlights the way rape affects people I think is totally fine. It just has to be respectful and it has to tell me something about the subject.