Author Topic: How does downloading add-ons work?  (Read 1585 times)

Alright so I just have a few questions about addons/mods that are downloaded when you select "Join a Server" and it downloads all of the files before you spawn in. If I have lets say Weapon_Machinegun that I downloaded manually and the server uses it also, will it download again because of how online mods work (they go in the cache.db file?). My other question is, how does Blockland know when there is a new version of that addon?

Thanks guys!

i'm definitely not an expert and i'll probably be corrected by kalphiter but i'm p sure it works by comparing file CRCs

I'm pretty sure that the server sends the file CRC values in the file manifest. And if the values for a specified file are the same as a file you have, the game will just copy the local file into the database instead of downloading it.

When the server starts it generates a "manifest" of all the shapes and resources it uses. It does that by taking a hash of the contents of the file (that's like a long string of numbers and letters) which it uses to refer to that particular file - it doesn't use filenames at all.

So when you join, the server just makes sure you have a file that matches the same contents as the file it uses as the model for Gun A, for example. The important bit is that files are identified/referenced by their contents and not their name.

When the server starts it generates a "manifest" of all the shapes and resources it uses. It does that by taking a hash of the contents of the file (that's like a long string of numbers and letters) which it uses to refer to that particular file - it doesn't use filenames at all.

So when you join, the server just makes sure you have a file that matches the same contents as the file it uses as the model for Gun A, for example. The important bit is that files are identified/referenced by their contents and not their name.
Alright sounds cool but I am a little confused. By "the server just makes sure you have a file that matches the same contents as the file it uses as the model for Gun A" does it only check in the cache.db file or also locally too (add-ons folder)? (I dont think it checks locally because then it would require that all of  those addons generate a manifest?) Sorry if this takes me a while to understand.

Oh wow, so if I edit something and the person joining already has the default version, it doesn't mess up? TIL.

Assuming that these hashes are actually just a reference to their CRC values, the game's built-in file manager has already enumerated and calculated the values of the local files and created a directory for easily finding each file. Checking these files takes a very short amount of time. The only issue with this is that if a file changes while the game is running, the game may attempt to handle the file incorrectly, and will then usually crash.

Assuming that these hashes are actually just a reference to their CRC values, the game's built-in file manager has already enumerated and calculated the values of the local files and created a directory for easily finding each file. Checking these files takes a very short amount of time. The only issue with this is that if a file changes while the game is running, the game may attempt to handle the file incorrectly, and will then usually crash.
Okay, thanks for answering I understand now!