drwhut / tabletop-club

An open-source platform for playing tabletop games in a physics-based 3D environment for Windows, macOS, and Linux! Made with the Godot Engine.
https://tabletopclub.net
MIT License
1.28k stars 55 forks source link

Remove unused files from the user directory. #232

Closed GrimPixel closed 1 year ago

GrimPixel commented 1 year ago

Is your feature request related to a problem? Please describe. I found old assets in /home/user/.local/share/Tabletop Club/, which means that the old assets undeleted. And I see that this is also the reason why each time I import new assets, it takes much time.

Describe the solution you'd like Change the documentation to make user place their assets directly in /home/user/.local/share/Tabletop Club/assets. As well as clearing /home/user/.local/share/Tabletop Club/.import

drwhut commented 1 year ago

Deleting asset files that are no longer used would be a good addition, for sure.

And I see that this is also the reason why each time I import new assets, it takes much time.

The number of existing files under user:// should not affect the speed at which new files are imported. The determining factor is how many files are scanned in. Once a new file has been imported, the raw data is cached under .import/, and the next time you run the game, if the file has not changed or it has not moved location, it should just use the cached data.

If you mean the copying of the files, this will vary depending on hardware, but even on high-end SSDs the files need to be imported by Godot, which will always take some time. There is no shortcut around this, as I mentioned in #213. Plus, Godot will only reliably load imported resources from either res:// (which are the internal resources that are packed into the .pck file), or user://, which is where files are copied to.

Change the documentation to make user place their assets directly in /home/user/.local/share/Tabletop Club/assets.

I don't think this is user-friendly. Not everyone is going to know how to get to "AppData" or "~/.local" (on macOS it's even worse since you cannot access the ~/Library folder by default) - which is why I made the decision to have the game scan multiple user-level folders for assets (e.g. Documents, Desktop, etc.) since the majority of users will be able to easily navigate to those folders. Maybe in the future when there is an asset CDN the external folders can be skipped and assets can be placed directly into user://, but for now I think this is the best way to go.

As well as clearing /home/user/.local/share/Tabletop Club/.import

Just to be clear, only files that are no longer used should be removed from that folder. The cached files are necessary for Godot to import resources like textures and 3D models.