Skip to content

Add the ability to download maps #46

Description

@billyb2

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.

  • Sends metadata
  • Sends map objects
  • Checks CRC32 + map corruption
  • Works consistently

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    HARDThis is difficult, and will require a lot of time and effortenhancementNew feature or requestnetNetworking code stuff

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions