What I want to achieve is an efficient way of communicating buffers created from clients that are sent to the server to be then sent back to various clients, and/or to know if my current method is okay.
I noticed that there is a size limit on communicating to the server from the client- of which I was able to meet when I tried to send many buffers at the same time to the server. What ended up happening was a client-sided disconnection, but I have since fixed and capped off the sending amount (I originally didn’t know that it could be met as easily with buffers) and now it only sends a few to the server (4 total with 512x512 pixels of image data). Is this too much to send from the client like every 5.5 seconds average, never below 5 (and up to 18 players at a time doing it)?
But anyways - since I think that the client to server is taken care of, now It’s the problem of displaying each image sent in to the clients.
I initially thought it was too much to send to each client (or too much requests to be sending from the server to each client ?) through a RemoteEvent, sending each client (16-18 players max) a total view of 8 buffer images EACH. So instead I opted to set attributes of each ImageLabel instead so that way the client can detect the change and then align themselves manually using attributes set by the server (set only once).
Well, this didn’t work out. This method was supposed to work by turning each of the server’s buffer data into strings, breaking down the string into sections with <= 100,000 characters (for any attribute limits) then setting an attribute from 1-to however many sections there would be divided to handle all the buffer’s string characters.
math.floor(#bufferdata/100000)+1 --usually around 10-13, then I use a for loop to string.sub out of the string version of the buffer from 1 to 10-13 and set an attribute for each...
When the client receives the changes, it confirms the total count of sections for each ImageLabel. It then combines each section of string using a for loop (like legos) and then taking that complete new string and using buffer.fromString() to turn it back into a buffer but I kept getting the error of “EditableImage:WritePixelsBuffer expects buffer length to equal size.X * size.Y * 4 bytes”.
When I check to make sure that all data is present when the client receives it, I make the server print how many sections of string there are and how many characters are in each section. When the client combines each string and totals the entire buffer length, it’s the same exact count printed out.
So instead (at-least right now) I just decided to have the client ask the server to return a Fire of each specific buffer needed (do not wanna use RemoteFunctions for this, so I use a RemoteEvent) and this happens for each of the 8 ImageLabels. This also happens very quickly from a loop at one time collecting for all 1-8 images, and there’s anywhere from 1-18 players in any given server.
Is this too much for the server to handle? Will it crash the server? Will it disconnect clients? Will it just error? I have so many questions. This is why the attribute way is perfect because the server doesn’t need to keep getting bothered and returning fire, and the clients can read and write at their own pace their own buffers from what the server has already provided ONCE.
On a side note, does breaking down the buffer into a string + into sections cause it to lose it’s data? Or become corrupted? What happens to make it not be able to be put back into a buffer having been broken down into sections of string?
Sorry if this is too long, but I really have no idea what to do.