So I've studied some reverse engineering lately and I'd really like to have a more better idea about how things like sa-mp and mafia 2 multiplayer are actually made. When I connect to a server in sa-mp and it starts the game. Does it inject a dll or something at this point to control the flow of the game and remove all the npcs from the cities etc? I am not really asking anything really specific but just the idea. I looked at the source codes of a few similar projects but didn't really get how it all starts. I would appreciate that someone who has knowledge about these things could enlighten me.
This is really something that has interested me since I discovered these mods so I look forward to hearing from you.