• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML How to send large amounts of data over network at start of connection?

A

Arthrax

Guest
I'm developing a multiplayer game in which the map changes frequently during the course of the match.

To be more specific, I have a ds_list server-side that contains all the values of map objects that need to be destroyed.

Everything so far is working, as the objects can be transferred to other connected clients easily. However I have yet to find a way to be able to load the initial conditions of the map (aka the server side ds_list) when a client connects.

I tried sending it through a single buffer but the amount of data is simply too large for it, and causes a memory dump when the list of objects gets a certain size.

I know it has something to do involving a loading bar / sequence or sending the data in bursts, the functions ds_list_read(); and ds_list_write(); and potentially using .ini files, but I'm not sure how to go about doing this and I would love to learn.

And by the way, the list can end up being a LOT of objects so I'd need to be able to scale for potentially vast quantities of data. I don't mind if the client upon joining has to wait for it to load.

Any help is appreciated, and if you need me to be more specific I can.
 

The-any-Key

Member
I would use ds write and split up the string into 750byte pieces if you use up (50bytes if you use tcp). Send them one by one in each step. You also need to send the games ordinary map updates. So the client need to save these and apply them when the map is fully transferred. Else the connecting players will miss the latest updates.
 
A

Arthrax

Guest
All set, it actually was much easier than I initially thought.

I just set a state client side to "Loading" which activates upon joining the lobby. When the player joins, the server will create a ds_queue that is essentially a copy of the ds_list that the server has of the destroyed instances. The server will then send 10 values of the instances every frame, making sure that the client has recieved the data (meaning the next frame is not called unless the client gives a message that the data has been recieved) until there is no more values left in the ds_queue, in which case it will send a message that the transfer of map data is over, and the client-side will end the loading state.

Additionally this is unnoticeable by all users and loading happens extremely quickly even with this large amount of data.
 
Top