Almkaz wrote:
I like the meta data route - no need to create an explosion of classes.
I also like sending down the string IDs to the client to compose the text.
The only gray area for me is how to send down the relevant link data. It we send an array of strings, would the client then lookup that name for planet "Foo" to determine it's ID so that it can build the link tag? Or should we send down the plant ID value instead of the planet name?
Using your example, we would write:
"PLANET_MAX_POP_MSGX"
"1"
"PLANET_MAX_POP_MSGY"
"34"
"PLANET_MAX_POP_MSGZ"
Where 1 is the planet ID and 34 is the system ID. The client decoding the message would look for the above sequence of strings and know that the 2nd represents a planet ID and the 4th represents a system ID for this particular SitRep type. It could then compose the string as well as the link information from the IDs.
One thought - What about using XML for this language? Is there any advantage, besides maybe readability for debugging? I'll put it out there for any discussion...
The XML language could contain all the possible variables that SitRep reports need as elements.
For example:
XML Elements: <sit_rep>, <string_id>, <system_id>, < planet_id >,<tech_id>,<empire_id>, etc
The XML for the Foo Bar example could look like:
<sit_rep type="max_pop_reached">
<string_id value="PLANET_MAX_POPX">
<planet_id value="1">
<string_id value="PLANET_MAX_POPY">
<system_id value="5">
<string_id value="PLANET_MAX_POPX">
</sit_rep>
The client knows that for a sitrep of type "max_pop_reached" has it's XML document in a given order: string_id element, planet_id, string_id, system_id and a final string_id element. It would walk the tree looking for this sequence. Other events would expect the document in other ways.
Since it's using hte IDs it can fomulate the link tags.
I guess, basically it's the same idea but using XML as the meta data instead of an array of strings...
Andrew
No matter what, XML will be used to move this across the network, since that is used for everything. Since the order will be implicit for each SitRep type, I think we can get away with just providing the SitRep type and the strings that make up the message in order. You're right about making the lookups easier by passing the ID numbers instead of the actual names of the subject(s); we should do that.