The first task is to investigate how server and client communicates.
This requires knowledge about:
- networking and protocols
- protocols for serialization. For example, CSGO uses Protocol Buffers from google.
- packet analyzing, make assumptions about the meaning of the packets
The second task is, to replicate what the server is doing.
This requires understanding how to write a server which can handle more than one connection at the time.
You can use for example already existing documentation.
The a2s protocol for Source Dedicated Engine is described here:
https://developer.valvesoftware.com/wiki/Server_queries
But it's not the communication between server <-> client. This is just to query information about a game server. The server browser uses it. So implementing a csgo-emulator-server requires to implement a2s, rcon and the unknown protocol between server <-> client.
In addition, a game server has state about the current world, positions of players, health, etc.
The communication follows often the concept of Key-Frames and Delta-Frames. Key-Frames holds all information about current state and the Delta-Frames have only information about state changes, which relies on the server state.
If you want to write a game server emulator, then choose a simple game server.
Otherwise, you can make your own gameserver (not emulator) with Pygame. You'll also find some examples if you google.