So I was thinking of beginning to develop a multiplayer game. I have done it before, so it’s not the code I need help with. It’s UDP and TCP. My idea is to use both.
TCP, would take care of player commands, and important information. Such as; logging in, logging out, chat, and commands. With “commands” I mean things like order a unit to move, attack, defend, collect and so on.
UDP, would send where all the units are, updating the map, upgrades, and unit health.
For example:
Player 1 uses an ability to send a meteor strike. (TCP)
The server sends the meteor’s; Coordinates, velocity, and direction to all clients. (UDP, since it will be updated quite often.)
The meteor hit the ground, and the server send the terrain deformation to all clients (UDP, the map is updated regularly)
Player 2 get’s angry since he gets hit, and leaves the game (TCP)
Is that a good way to use TCP and UDP? or am I missing something?