I want to know if there are developers who have also experienced this and maybe someone can give me some good advice.
Every single ones of them. Even professional writers that sell tons of books still experience feeling this time to time.
With time and experience, you'll learn how to do most of this in one go, but for start it's better to split it step by step. So, what you need first is to know how the scene insert in your story, this will give you the feeling of the scene, and so its tone. By example, you don't write a filler scene like you write a romance one. And you don't write the said filler scene in the same way, depending if it will be followed by a sex scene or a scene full of mystery.
Then, you write the full dialogs, without caring if it feel right or not. It's your draft, it's only role is to tell you what will be said during the scene.
Once it's done, you proceed character by character. Each one have its own personality, its own motive and goal, this mean that each one have also its own way to say something.
By example the same dialog between MC and a girl secretly in love with him:
[Note: It's still raw dialogs, they are an example of the difference between the two more than effectively thought dialogs]
- Firstly the shy princess:
MC "But, I'm just a guy like any other you know. I have nothing special."
girl "Don't say this, you're smart, and also handsome... I'm sure that all girls are secretly in love with you. How could they not ?"
MC "Oh, you think I'm handsome ?"
girl [blushing] "Hihihi..."
- Secondly the independent rebel:
MC "But, I'm just a guy like any other you know. I have nothing special."
girl "Yeah, of course. Mister smart and handsome play the normal card. And you believe someone will believe you ?"
MC "Oh, you think I'm handsome ?"
girl "In my dream I think it. In *your* dream, I meant in *your* dream !"
- Thirdly the motherly figure:
MC "But, I'm just a guy like any other you know. I have nothing special."
girl "Don't be like this, those sad thoughts don't suit you. You're a smart and handsome young man, I'm sure you'll realize it one day."
MC "Oh, you think I'm handsome ?"
girl "Of course you are sweety."
And so on, each girl say the same, but each one say it accordingly to her personality, mood, as well as accordingly to what they want to achieve by doing it. In real life we don't pass our time weighting our words, but it's what you've to do as writer.
Also don't try hard to have dialogs that would totally fit the reality, because this is not reality. You don't have an actor playing the line, therefore you can't rely on the vocal tone, facial expression and global gesture to carry the whole meaning of the dialog ; therefore everything rely on the words you'll use.
Once you've rewrote all the dialog lines for each character, it's time to make them fall together.
By example, when writing the dialog lines for the independent rebel girl, you'll probably tend to be more harsh than it should. This mean that her lines and MC's ones will not really match and that you'll have to soften a bit the tone of her dialog to not make the scene looks like they were having two different discussion.
For this, like
fyl3toys said the best way is always to play the dialog out loud. Side note, this also help to find when it's not anymore a dialog, but a suit of monologues ; therefore to have a better pace for the scene. Unless told to stay shut the whole time, it's really exceptional in real life to pass two minutes silently listening to someone ; you at least agree, or disagree, punctually with what is said.
It's the difference between that:
girl "Listen, since you'll left for college in three days, there's something I have to tell you. Do you remember our first encounter ? I was going home from school with all my books, and you helped me pick them after I felt on the ground. This day, I carried all of them because I wanted to go home and kill myself. It's probably stupid, but I wanted to keep everything in order, to not be a burden for my family even once after my death. This day, your smile, the fact that you helped me, that you was the first person to help me since years, it changed my life. Not only you helped me to carry my books, but before you left you said that you were hoping to see me the next day. It's why I didn't killed myself that day. I had no real hope, I've been betrayed so many times in my life, but you were so nice that I wanted to give this a chance... And the next day you were here, coming to me once you saw me, talking with this smile that never left your face [...]"
and this:
girl "Listen, since you'll left for college in three days, there's something I have to tell you."
mc "I don't left forever you know, I'll come back often."
girl "I know, but it's something that I want to tell you since so long... Do you remember our first encounter ?'
mc "Of course, you felt on the ground, and I helped you pick up your books."
girl "And you also helped me carry them to my dorm room. You see, if I had all my books with me that day, it's because I wanted to kill myself once at home."
mc "Oh..."
girl "It's probably stupid, but I wanted to keep everything in order, to not be a burden for my family even once after my death."
mc "I had no clue, I'm sorry, really."
girl "Why ? Why are you sorry ?"
mc "Would have I known, I would have done more. I don't know, invite you for a coffee, a movie, anything to ease your mind."
girl "Don't worry, it's what you did. You were the first person to help me since years, don't you think that by itself this wasn't enough to ease my mind ? And what you said before you left..."
mc "I hope to see you tomorrow"
girl "Exactly. And you said it with this smile that never quit your face. I didn't gave too much hope to this, I've been betrayed so many times in my life, but I wanted to give this a chance."
mc "And the next day I ran to you once I saw you."
girl "You ran ?"
mc "Well, you know, I didn't had friend in high school at this time."
girl "didn't knew."
[...]
Both examples say exactly the same thing (well except MC loneliness), but the second one is way more natural.
A dialog is a ping-pong game between all the protagonists. But not in the way that each line said by one of them imply a line by another one. A dialog isn't split by lines, but by information carried. Each time someone give a new information, someone respond to it, giving or not an information by itself.
When there's more than two persons involved, you can decide that one of them will be the referee, either in the strict meaning of the word, or in that way that he punctuate the dialog, staying shut most of the time, and talking only to introduce a change in the discussion (tone or topic), or to conclude it.
In this case it will be either a "one against many" game, or a "many against many" one. In the first case, you'll have one character that do most of the discussion, while changing time to time the character that will talk back. In the second, the character will change anytime the information is relevant to him ; therefore the discussion will not be led by a person, but by its topic.
As final note, like
Winterfire implied, you are not a comedian in some dark room trying to make laugh the fee people still awake so late in the night, so don't over do it with the joke. In fact, unless the character itself have a joke to say
and it's relevant to the scene (it's almost never), do not tell joke at all.
You can want to make the player smile, even laugh if really you want, but it's not by telling joke that you'll achieve this. Look at the comedy movies/shows that are successful. They rarely have joke, it's a comic of situation.
By example, put a shy girl (that own a cat) in the middle of a discussion full of involuntary innuendo:
MC "Well, you can show me where you live."
girl "Why not ?"
mc "and this way I could also see your pussy."
girl "Er... You want to see my pussy ?"
mc "Of course, I'm a pussy lover you know."
girl "Well..."
mc "Don't worry, I'll be gentle, promised."
girl "It's not that I don't want..."
mc "I'm sure he want me to pet him."
girl "Oh yes he want but I'm not sure if I'm ready for this."
mc "Ready for this ? What are you talking about ?"
girl "what are *you* talking about ?"
mc "Your cat of course. You always talk about him, but I've never seen him."
girl "My cat... I also talk about my cat... of course I talk about my cat, what could I have been talking about except my cat..."