Repository navigation
Conversation
Goes with the model pack change in open.mp, which lets a server hand out all of its custom models as a few compressed files instead of one request per .dff/.txd. Before the game starts with the open.mp client, the launcher asks the server's game ip and port for /modelpack/v1/index.json. If there's no index (old server, artwork.port changed, artwork.model_pack set to false on the server, or the server is still compressing its models) nothing happens and the game downloads models like it did before. Otherwise it checks which files are missing from the model cache (name, size and CRC32 all have to match) and only downloads the segments that have them, with a progress box in the launcher window. Each file's CRC32 is checked before it goes in the cache, so a download that gets cut off or a bad file leaves nothing broken, and the game fetches whatever is still missing the usual way. If the server is busy with other downloads it waits and asks again a few times. Players who already have most of the models only get the segments that changed. There's no limit on how big the models can be. The code is src-tauri/src/model_pack.rs, called from the inject command, plus a few lines in game.ts for the progress box. Adds three crates: ureq (plain http only), flate2 and crc32fast.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goes with the model pack change in open.mp, which lets a server hand out all of its custom models as a few compressed files instead of one request per .dff/.txd.
Before the game starts with the open.mp client, the launcher asks the server's game ip and port for /modelpack/v1/index.json. If there's no index (old server, artwork.port changed, artwork.model_pack set to false on the server, or the server is still compressing its models) nothing happens and the game downloads models like it did before.
Otherwise it checks which files are missing from the model cache (name, size and CRC32 all have to match) and only downloads the segments that have them, with a progress box in the launcher window. Each file's CRC32 is checked before it goes in the cache, so a download that gets cut off or a bad file leaves nothing broken, and the game fetches whatever is still missing the usual way. If the server is busy with other downloads it waits and asks again a few times. Players who already have most of the models only get the segments that changed. There's no limit on how big the models can be.
The code is src-tauri/src/model_pack.rs, called from the inject command, plus a few lines in game.ts for the progress box.
Adds three crates: ureq (plain http only), flate2 and crc32fast.