One thing I am struggling with in my custom planet simulator/game engine is how do I get assets into the procedural generator in a generic way that supports everything I need to do. For instance, I need to load a library of textures that should be applied to different types of terrain, or a library of meshes to spawn on the planet surface.
I currently have a fairly sophisticated asset serialization system that can pack all assets into one or more container files, where each asset is uniquely identified by a 128-bit UUID. This works really well for maintaining references between assets within the editor. To load one of these assets by UUID from code, I would have to hard-code the UUID for whatever is needed into the C++ code, which doesn't seem that maintainable to me, since the UUIDs are automatically generated and not really exposed in the editor. I can also reference assets by a human-readable name or URL, but this has problems with name collisions, and strings are much slower than fixed-length UUIDs, so I would like to avoid it.
There has got to be a better way. In Unity, they have the luxury of a scripting language which can automatically map assets to component member variables (via GUID I believe), but this is not really possible in C++.
The best thing I can think of is to have some layer of indirection between the code and data, i.e. rather than referencing assets directly, some other configuration data is loaded that says which assets are needed by a particular piece of code. This way the code doesn't need to know exactly about what assets it needs, it only needs to know about the fields in the config file which provide the UUIDs of the actual assets. Then I can make a GUI to edit the configuration file, which could handle mapping UUIDs to the asset slots in a nice maintainable way.
Does anyone have any ideas for how to solve this problem in a better way?