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

Possibility of using the same model for multiple pieces #269

Open GrimPixel opened 1 year ago

GrimPixel commented 1 year ago

Is your feature request related to a problem? Please describe. In Janggi and Shōgi, pieces are regular octagons and tablets. I wonder if it is possible to use the same model for multiple pieces.

drwhut commented 1 year ago

Currently the only way to re-use the same custom 3D model for multiple pieces is if an object defines another as its parent, but that only allows the color to be changed. For example:

[3D Model.gltf]

desc = "This is the 3D model in the asset pack folder."

[New Model] ; A new object, without having to add a new file to the folder.

parent = "3D Model"
color = "#ff0000"

The only other thing I can think of is that if you export the 3D model as a separated glTF format (that is, one .bin file, one .gltf file, and potentially some textures), you can then have multiple .gltf files all pointing to the same .bin file, which can potentially save a lot of disk space depending on how big the mesh is.

In the 0.2-rewrite branch I've made the metadata for assets a little bit more "loose" when it comes to defining in-engine scenes for pieces, so there may be a way to not only change the color of a parent object like in the first example, but also to override certain textures within the model.