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.27k stars 55 forks source link

Allow images to be imported as table paint. #101

Open drwhut opened 1 year ago

drwhut commented 1 year ago

Is your feature request related to a problem? Please describe. If I have an image that I want to re-create as paint on the table, then currently the only way to do so is to manually paint the image by hand.

Describe the solution you'd like Add a menu that allows the player to select any image on their file system, and use that image to paint the table. When loaded, the image should be automatically scaled to fit the internal texture the paint plane uses, as well as converted to the same format.

Describe alternatives you've considered This issue is specifically for the paint feature: if one wants to import the image as-is, then it is possible in the following ways:

Additional context This was an idea given to me by a friend of mine - while it may have some very niche applications, I would like to implement it since a. it shouldn't be too difficult to implement, and b. it would be a very big QoL feature for those that like to use the paint tool.

drwhut commented 1 year ago

I switched the milestone for this issue back, since I discovered an underlying flaw with the net-code while implementing it.

While I had gotten this to work for relatively simple images that could be compressed easily, most images hit the 64KB buffer limit for WebRTC. This means that the image data would have to be sent across the network in multiple packets - transitively, this also applies to full room states that are sent over the network, and saved to save files, since they contain the texture used to represent the paint on the table.

So for v0.2.0, I plan to make a generic "data transfer" node that will be able to transfer large byte arrays, both into memory (for room states and table paint), and into files (for syncing with the host's AssetDB). And as a note-to-self, I need to do some more testing with Image.compress to see if it is worth using alongside, or instead of, PoolByteArray.compress.