shadowscion / Prop2Mesh

Garry's Mod Addon - Convert a group of props into a single clientside mesh
14 stars 9 forks source link

File caching #56

Closed wrefgtzweve closed 4 months ago

wrefgtzweve commented 4 months ago

Caches p2m data on the client so clients wont have to redownload data every time they rejoin, this significantly reduces the amount of networking p2m needs to do as people often use the same p2m model anyways. The cached data is stored in the clients datafolder and stored up to a week, each time a mesh is loaded it'll refresh this timer so we don't redownload often used models. The client can configure this cache time with the convar prop2mesh_cache_time. I've been using this for my 40+ players server for a good while and it makes p2m a lot more manageable.

Also properly sets resource.AddWorkshop so it autodownloads with the git version.

brandonsturgeon commented 4 months ago

Maybe you could re-write the file when you successfully load it from cache, meaning only unused cache entries are being deleted.

Good change 👍

wrefgtzweve commented 4 months ago

I already do that and its described in the description that i do that.

shadowscion commented 4 months ago

I see no reason not to add this feature so I'm going to accept it and trust your judgement on the benefits, I have no servers to test it on.

What does resource.AddWorkshop even do if you have the git version?

shadowscion commented 4 months ago

Is the data that gets written the compressed format?

brandonsturgeon commented 4 months ago

I see no reason not to add this feature so I'm going to accept it and trust your judgement on the benefits, I have no servers to test it on.

What does resource.AddWorkshop even do if you have the git version?

@wrefgtzweve has been using it on NPCZ for awhile, seeing a huge amount of players without any issues. We started using it on CFC today and haven't heard any issues either.

What does resource.AddWorkshop even do if you have the git version?

It makes sure clients download the cube stuff in materials/p2m, models/p2m 👍

wrefgtzweve commented 4 months ago

I see no reason not to add this feature so I'm going to accept it and trust your judgement on the benefits, I have no servers to test it on.

What does resource.AddWorkshop even do if you have the git version?

Git stuff isn't automatically downloaded for clients, neither is workshop stuff. It has to be manually added through resource.AddWorkshop, this just makes it work "nicer" so servers don't have to manually add it.

wrefgtzweve commented 4 months ago

Is the data that gets written the compressed format?

Yes