I am currently creating a game in need of networking i.e. server and clients. I have basic experience with socket programming and am able to transfer data between two machines via UDP sockets using sdl_net. Now I would like to start building a game server and client for one of my current projects. Ive taken a look at https://gafferongames.com to help with packet compression and emulating a connection, however i am stumped from there on.
Because my game will be a real-time game, it constantly needs to be sending packets back and forth (perhaps at a set interval) to exchange data and check for timeouts. How do I structure my server? Should I have a thread constantly listening for clients packets and another broadcasting game states every time interval? Or should I stick to a single thread (If so how do I approach it)?
Simply put, I'm a little lost on how to properly make a efficient game server. Any help and explanation would be great!