Edit: My current system is going to be to send constant player updates every 1/20th of a second, each containing the player's status and position. I will also send another packet (or as many needed) every 1/20th of a second with the information of all the bullets, using this format to save space (the number representing the space in a packet):
1: Owner's ID
1: Type
1: Amount of bullets (so I don't have to include this info each time)
3: X coord
3: Y coord
I am currently writing a co op game to play at LANs, and have run into the issue of dealing with many entities and game updates. I only have implemented player movement, and the packets sent include the player's position for 3 ticks (as packets are sent and received every 3 ticks).
I have also implemented a system to keep track of the delay between client and server (sending the tick the server/client is at and comparing it to with the receiver's local tick).
This has worked thus far, however I have run into trouble with sending bullet information. It would be unfeasible to send the position of the bullet every update, as I would only have room for ~160 bullets + players per packet.
I thought of just sending the information that a bullet has been created and enough information for the client to simulate the bullet flying, such as velocity, angle, lifetime, and owner, and sending information when the bullet has been destroyed (via impact, lifetime, or otherwise). This got me thinking if it is possible to only send the keystates of a client to other clients via the server, to reduce the space required for co-ordinates and to increase smoothness of movement(floats will be used in this case instead of the current ints, as I have found difficulty transmitting floats).
This raises the concern of packet loss, and that with it the game could easily go out of sync. I have read of sending acks, however I am unsure if this will give me the wanted result. I have also read about sending a full game state ever so often, and this seems to me to be the best solution. What should I do to fix the issue of space and to reduce the space required for transmitting movement? And if it's the full game state solution, how often should I resync the clients? 5 seconds? 10 seconds? How do other games do it? I have read that the steam engine almost never does this, however it has many systems set in place to prevent packet loss and resending lost packets and I feel that I am unable to code all that.