(if I refer to data as ,,packet", I mean a group of data you want to send. Not a packet in ISO OSI)
let's consider players, bullets and zombies. Sending one big data packet is possible, but not good, because as game gets bigger, you will send more and more data. You will also discover that sometimes, you send position data but not weapon data (because weapon did not change, so why...) and etc.
Therefore that will result in checking: Is the data packet containing this? and this?
That is feasible for small projects, but not for a perspective game.
Considering that you send one big data packet, sockets divide it anyway to small frames / iso osi packets (depends on iso osi layer you consider).
Sending small chunks
Lets say, that you send one small chunk C1. But it is too small, that socket will not send it. Instead, it waits for more data. That is possible, but depends on technology you use, and how the networking is implemented there.
Definitelly I can imagine, that the system might wait a bit to see if more chuks are about to be send, that then sends it all together.
So when you send one big data chunk
- You will in fact be sending small chunks over network anyway
- Code will be big and difficult to read, having huge packet class
- You will have to check on client side: Is there weapon data? If so, call this function to draw that...is there zombie animation state...? etc.
Therefore, I vote for individual packets, consider zombie game as example
- send packet for weapon - sent to individual players
- packet containing user, zombie, bullet positions - sent to all players
- packet containing user information - health
Lastly, I will add here something I have learned...
Never care about performance in first place
Now alot of people will say: well that is bad attitude.
But, if you write a game, which is very difficult task, and it will ALWAYS be complex, get the code done. No matter how memory or gpu is wasted. You can optimize when the code is done. (I am talking about code chunks, developing iterations, like every week try to optimize something....not all at the very end)
Why? It happened to me many times. I overthink: Well, how this can be efficient? Do this and this, and it results in such a complex task that you will not make it work.
Therefore: write simple code towards functionality, but keep some space for futurer optimalizations
example: Develop a game, where you send position every frame to all. Then, modify it to send position to all only when it changes. Then, modify it to send position to selective players, if needed. Then, you can compress the sent data...etc.