Gallaecio Posted September 21, 2013 Report Share Posted September 21, 2013 Currently, unit template files have a translatable field called Tooltip. This field, as far as I’ve seen, may contain the following information:• Unit classes (recently prefixed by ‘Classes:’).• Units that this unit counters (prefixed by ‘Counters:’).• Units that counter this unit (prefixed by ‘Countered by:’).• Unit description.In the XML, these are differenciated by line breaks.What would you think about providing separated fields for each one of these?• DisplayClasses (as opposed to the class names used in the game logic)• Counters• CounteredBy• DescriptionPros would be:• Easier to keep consistency between tooltips.• Ability to use a different font or text style on different elements.• Ability to reorder the elements in the interface easily, without changing all XML files, nor affecting translations.• Ability to show a different combination of these bits of information in different contexts.• Easier for translator, as they would only need to translate the "Prefix: <data>" strings once, and the rest of the strings will have a decreased size.And I honestly cannot think of cons here.Also, if you agree, should I let you do this yourselves in master, or should I do this myself in my i18n branch? Or should I maybe write a patch against master only for this? Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted September 21, 2013 Report Share Posted September 21, 2013 Currently, unit template files have a translatable field called Tooltip. This field, as far as I've seen, may contain the following information:• Unit classes (recently prefixed by 'Classes:').• Units that this unit counters (prefixed by 'Counters:').• Units that counter this unit (prefixed by 'Countered by:').• Unit description.In the XML, these are differenciated by line breaks.What would you think about providing separated fields for each one of these?• DisplayClasses (as opposed to the class names used in the game logic)• Counters• CounteredBy• DescriptionPros would be:• Easier to keep consistency between tooltips.• Ability to use a different font or text style on different elements.• Ability to reorder the elements in the interface easily, without changing all XML files, nor affecting translations.• Ability to show a different combination of these bits of information in different contexts.• Easier for translator, as they would only need to translate the "Prefix: <data>" strings once, and the rest of the strings will have a decreased size.And I honestly cannot think of cons here.Also, if you agree, should I let you do this yourselves in master, or should I do this myself in my i18n branch? Or should I maybe write a patch against master only for this?Ideally, the "Counters" and "Countered by" lines would be pulled dynamically from the templates themselves, rather than hand typed (introducing typos and other problems). Though, it would then take some time to decide how it would be displayed in the tooltip. For instance, if you pull the Counters line from the parent template of the, e.g., Swordsmen, you'd probably get something like this:Counters: 2x Infantry Spear, 1.5x Infantry Javelin, 1.25x Elephant.That's acceptable to me, as long as we are constant across the board. That would come from the <Attack/Bonuses> element of the template.<?xml version="1.0" encoding="utf-8"?><Entity parent="template_unit_infantry_melee"> <Armour> <Hack>3</Hack> <Pierce>1</Pierce> <Crush>1</Crush> </Armour> <Attack> <Melee> <Hack>10.0</Hack> <Pierce>0.0</Pierce> <Bonuses> <BonusPrimary> <Classes>Infantry Spear</Classes> <Multiplier>2.0</Multiplier> </BonusPrimary> <BonusSecondary> <Classes>Infantry Javelin</Classes> <Multiplier>1.5</Multiplier> </BonusSecondary> <BonusTertiary> <Classes>Elephant</Classes> <Multiplier>1.25</Multiplier> </BonusTertiary> </Bonuses> </Melee> <Charge> <Hack>20.0</Hack> <Bonuses> <BonusPrimary> <Classes>Infantry Spear</Classes> <Multiplier>2.0</Multiplier> </BonusPrimary> <BonusSecondary> <Classes>Infantry Javelin</Classes> <Multiplier>1.5</Multiplier> </BonusSecondary> <BonusTertiary> <Classes>Elephant</Classes> <Multiplier>1.25</Multiplier> </BonusTertiary> </Bonuses> </Charge> </Attack> <Cost> <Resources> <metal>60</metal> </Resources> </Cost> <Identity> <Classes datatype="tokens">Sword</Classes> <GenericName>Swordsman</GenericName> <History>Weapon is basically a developed sickle. Probably from the club, to the axe, to the sickle to the sword. It was the Romans who used them to combat the long range of the sarissa. Their spears were so long they had to use two hands to wield them. In a formation they were almost impossible to maneouvre. If flanked, they were easily cut down by a sword as demonstrated by the Romans at the battle of Cynoscephalae. Generally swordsmen were well armoured, had shields, and tended to be nobles. A good sword was an expensive weapon.</History> <Tooltip>Classes: Melee Infantry Swordsman.Counters: 2x vs. Spearmen, 1.5x vs. Skirmishers, and 1.25x vs. Elephants.Countered by: Archers, Cavalry Spearmen, and Cavalry Archers.</Tooltip> </Identity> <Loot> <metal>5</metal> </Loot> <UnitMotion> <WalkSpeed>8.0</WalkSpeed> <Run> <Speed>16.0</Speed> </Run> </UnitMotion> <Vision> <Range>48</Range> </Vision></Entity>It might be a little more difficult to parse the "Countered by" information. Any idea on that?As far as "Classes" goes, we'll have to decide how "deep" we want to go to display the classes in the tooltip. How many parents deep do we want to go? For a Roman Swordsman, you have these templates and parents:template_entity_fulltemplate_unittemplate_unit_infantrytemplate_unit_infantry_meleetemplate_unit_infantry_melee_swordsmanunits/rome_infantry_swordsmanEach of these add to the classes list for that unit. We could just start the classes from template_unit_infantry in this case. Quote Link to comment Share on other sites More sharing options...
Gallaecio Posted September 21, 2013 Author Report Share Posted September 21, 2013 (edited) Ideally, the "Counters" and "Countered by" lines would be pulled dynamically from the templates themselves, rather than hand typed (introducing typos and other problems). Though, it would then take some time to decide how it would be displayed in the tooltip. For instance, if you pull the Counters line from the parent template of the, e.g., Swordsmen, you'd probably get something like this:Counters: 2x Infantry Spear, 1.5x Infantry Javelin, 1.25x Elephant.That's acceptable to me, as long as we are constant across the board. That would come from the <Attack/Bonuses> element of the template.That is acceptable to me as well, provided that we do not rely on the actual data for the display name. That is, "Infantry Spear" is a logical statement, "Entity with the Infantry and Spear classes", and we would need to have display strings for each possible combination of classes; in the case of English, for "Infantry Spear", "Spearmen" could be the display string, for example.It might be a little more difficult to parse the "Countered by" information. Any idea on that?I’ve not seen the current implementation yet, but if XML files are loaded all at once and not on demand, we could do this adding a second phase to the XML loading that adds this information in memory only, keeping the XML files as they are.As far as "Classes" goes, we'll have to decide how "deep" we want to go to display the classes in the tooltip. How many parents deep do we want to go? For a Roman Swordsman, you have these templates and parents:template_entity_fulltemplate_unittemplate_unit_infantrytemplate_unit_infantry_meleetemplate_unit_infantry_melee_swordsmanunits/rome_infantry_swordsmanEach of these add to the classes list for that unit. We could just start the classes from template_unit_infantry in this case.I’m OK with that, provided again that we do not rely on the actual data for the display name. In the case of classes, we can show them as a comma-separated list and translate each class on its own. Edited September 21, 2013 by Gallaecio Quote Link to comment Share on other sites More sharing options...
GunChleoc Posted September 21, 2013 Report Share Posted September 21, 2013 (edited) Is it possible to make counters/countered by gender specific? I just hit one of these strings in my translation and I will need to translate it to something like "He/She goes against" and "He/She will be gone against by" Edited September 21, 2013 by GunChleoc Quote Link to comment Share on other sites More sharing options...
Gallaecio Posted September 21, 2013 Author Report Share Posted September 21, 2013 There does not seem to be a concept of Gender in the entity XML files but, if added, it should be doable. I will look into it on my internationalization branch. Quote Link to comment Share on other sites More sharing options...
Gallaecio Posted September 21, 2013 Author Report Share Posted September 21, 2013 What about using icons for classes? (with localizable tooltips) Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted September 21, 2013 Report Share Posted September 21, 2013 What about using icons for classes? (with localizable tooltips)We're talking about listing the classes in the unit's training tooltip, so any icons can't have their own tooltip within the tooltip. Quote Link to comment Share on other sites More sharing options...
Gallaecio Posted September 21, 2013 Author Report Share Posted September 21, 2013 Ups, right. No icons then. Quote Link to comment Share on other sites More sharing options...
GunChleoc Posted September 21, 2013 Report Share Posted September 21, 2013 (edited) There does not seem to be a concept of Gender in the entity XML files but, if added, it should be doable. I will look into it on my internationalization branch.They use a female^ prefix in Wesnoth. If you go that route, you would need to create an English translation to get rid of the prefix, or write some code to filter it out. I once wrote something like this in C, maybe it can be adapted to C++:char *displaytooltip = _(text_grabbed_from_XML);char **splittooltip = g_strsplit (displaytooltip,"^",-1);if(g_strcmp0(splittooltip[0],"female")==0 && splittooltip[1] != NULL) displaytooltip = g_strdup(splittooltip[1]);g_strfreev(splittooltip);You could also have a look at the GNU Q_ macro, but I don't know how that would work with XML. Edited September 21, 2013 by GunChleoc Quote Link to comment Share on other sites More sharing options...
Gallaecio Posted September 22, 2013 Author Report Share Posted September 22, 2013 I’ve added context support to the internationalization branch (to solve another issue I had). It is certainly necessary for this feature, but it is not the issue I was referring to.The problem here is that, as far as the game goes, there is no logical distinction between a male entity, and female entity or a gender-neutral entity (e.g. a tree). I guess this could be added, though, with a Gender property in the templates — Lucky us, units of the same type are always of the same gender so far. Quote Link to comment Share on other sites More sharing options...
GunChleoc Posted September 22, 2013 Report Share Posted September 22, 2013 (edited) a gender-neutral entity (e.g. a tree).A tree is gender-neutral in English, masculine in German and feminine in Gaelic. As long as we always refer to specific types of entities, this shouldn't be a problem though; e.g. I expect one only harvests wood from a tree. We should keep this at the back of our heads but not worry too much about it at this stage. Edited September 22, 2013 by GunChleoc Quote Link to comment Share on other sites More sharing options...
Gallaecio Posted September 22, 2013 Author Report Share Posted September 22, 2013 Right, better to deal with it when we run into the issues Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.