I was always curious about how some single-player games are turned into multiplayer ones. Some samples are SA-MP and MTA, that turn Grand Theft Auto: San Andreas into a multiplayer game.
In an infrastructure perspective, I know you might have a server that receives packets from a client and makes sure all the other clients receive these packets as well.
For example, whenever a player moves, the client sends a message to the server. The server then redirects the messages to each connected client. Each connected client updates the player's position.
However, how the engineers can "inject a code" into the game to make it send a network packet to a server whenever a player moves? How can they "inject a code" into the game, so it listens to a network packet to react over it?
The "inject a code" term is between quotes because I don't even know if a code is really injected into the game. That's exactly what I'm curious about. Which techniques are used? How can this be possible?
Do they hook into specific events to execute a custom code that performs networking communication? If so, could you guys elaborate that a bit further?
I'm not planning to do so, and I have no prior experience with Reverse Engineering. I couldn't find anything on the Internet. Due to that, feel free to explain any "basic concept" as well. :) I'd like to understand as much as possible about it, and different opinions and perspectives are more than welcome.