This question already has an answer here:
I'm tying to dive into multiplayer game programming.
The game is quite simple, it's a 2D scroller mobile game, the player need to touch the screen in order to move 1 step and it could contain up to 4 players at max. 1 of the player could create a room for other players to join.
I was thinking that I would use TCP for this and will only send packets when 1 of the player trigger an event like moving or exiting the game. Is my approach is correct? Since from what I've read, many games are created in UDP instead of TCP.
In case of UDP, what is sent between the clients and the server? The position of each entity in the game at a fix time interval?
I'm really new multiplayer programming. I'd appreciate if someone would share their story.