Reverse engineering, packet sniffing, programming.
You first reverse engineer the game's client to 1. modify the client to connect to unofficial server (e.g. your emulator) and 2. figure out packet encryption (you look for how the client decrypts the packets).
Once you have the structure, you...