- Home /
Inserting specific words into descriptions stored in XML
I am trying to develop a system where large blocks of text can have portions of it substituted. For instance (this is psuedocode),
<SampleEncounter>
<Name = John> drove up to the <Place = Cathedral>. Inside, <GenderPronoun = he> found a <CharDescript = angry> looking <CharType = beaver>.
</SampleEncounter>
This would then read in game on some Unity Text object as:
John drove up to the Cathedral. Inside, he found a angry looking beaver.
At the moment, I am storing the descriptive text in XML while I'm using a binary formatter for the character class (since I don't want the player editing themselves, but am ok with them modding out the descriptions). So it seems this would necessitate some way of storing the two types of data and finding a way for them to interact and form the descriptions. It seems like it might be easier if all the information was stored in XML, so I wouldn't need to reference the particular character class variables (which are stored elsewhere).
In my project, I am trying to build encounters where the player's character interacts with other, procedurally generated characters (NPCs). The NPCs have various enums assigned to them to describe their traits, such as professions or physical characteristics such as race, height, etc. When the player encounters these NPCs, I'm hoping to create a block description detailing their encounter, where the player class' variables and the NPC class' variables modify the description. Since there will be many encounters, I'm hoping to simply be able to type up these encounters by embedding character variables into the descriptions as I write them.
I've tried looking into a few of the dialogue systems on the Unity Store, but they all seem focused on the traditional player picks response A, B, C in a larger dialogue tree. I'm also unsure of what to search for, as almost all of my results have been the above mentioned dialogue types. If there's been an answer to this problem before, I'd greatly appreciate a reference to it!