Add the ability to download maps #46
Labels
enhancement
New feature or request
HARD
This is difficult, and will require a lot of time and effort
net
Networking code stuff
Currently, two players need to both have the same map that the host requests for the game to work, if not, it'll crash (probably should be its own TODO to handle error cases).
The ability to download a mpa that a client or host doesn't have would make the playability of the game much easier, and would allow for a much easier use of custom maps.
How could this work?
What I'm currently thinking is making it so bevy_networking_turbulence first sends the metadata of the map (obviously), then it sends the length of the MapObjects vector. Then, iti sends every map object as a byte aray, with a u32 to show the index of each map object. Why do this? Map objects, currently, need to be in a very exact order for the CRC32 to properly identify them, and even one change to the order can change the CRC32 significantly. (A way of fixing that would be to first sort the map objects by their coords, then do the crc32, so that no matter what order the map objects are in it'll be exactly the same, but I don't care enough to do that). Anyways, so the client receiving the maps keeps telling the host who's sending the maps what map objects are missing, until the length of the map_objects vectors match up on both sides, then, the client sends a "finished" message to tell the host to stop sending map objects.
The text was updated successfully, but these errors were encountered: