I'm working on a map class consisting of tiles of particular terrains. I'm going to have a lot of said maps (loaded individually), and since the terrains will be shared between all of them, I'd like for the terrains to be references to external definitions, rather than shared resources or any other approach that includes the definition within the map.
I've inferred that the ExternalReference class in Content.Pipeline is (probably) intended for this very purpose, but I can't figure out the first thing about how to use it. Googling I can only find the class definitions and issues with using it (at a much more specific level than anything that helps me). The closest thing I've found to a tutorial is the demonstration of how IntermediateSerializer handles it on Shawn Hargreaves's blog.
So what I would like is some very basic questions about ExternalReference answered, like:
- Is it actually intended for this purpose? (and if not, is there another faculty that is?)
- Should I use it as a serialization helper property, as part of a ContentTypeSerializer/Writer/Reader, or store it directly in the class?
How do I obtain the Terrain object from the ExternalReference< Terrain> object?
of course, i'm considering loading each level in its own contentmanager, but it'll still help with hard drive size