MegaGlest Forum

Archives (read only) => Glest Advanced Engine => Feature requests => Topic started by: John.d.h on 22 October 2010, 00:52:33

Title: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: John.d.h on 22 October 2010, 00:52:33
This has been mentioned but I can't find a ticket, so I figured I'd give it is own thread, lest it be lost.  Simply put, when the user hovers over a command, a short tool-tip/blurb will be displays along with the usual information, such as cost and requirements.

(http://img177.imageshack.us/img177/6650/guardtooltip.png) (http://img177.imageshack.us/i/guardtooltip.png/)

I figure there would be two ways to specify it in XML: either in the producing unit's command, or the produced unit itself.

1:
Code: [Select]
<command>
<type value="produce"/>
<name value="train_guard"/>
<image path="../guard/images/guard.bmp"/>
<tool-tip value="Heavy melee warrior. Slow speed, highly resistant, and good attack to ground units."/>
</command>
2:
Code: [Select]
<parameters>
...
<tool-tip value="Heavy melee warrior. Slow speed, highly resistant, and good attack to ground units."/>
</parameters>

The benefit for the first one (in the command) is that you can have different values for morph and produce, and it could also be made more generic (for other commands), e.g.:
Code: [Select]
<!-- produce command-->
<tool-tip value="Heavy melee warrior. Slow speed, highly resistant, and good attack to ground units."/>
Code: [Select]
<!-- morph command-->
<tool-tip value="With advanced training and heavy armor, a Swordman gains strength and resilience at the cost of speed."/>
Code: [Select]
<!-- attack command with a superfluous description-->
<tool-tip value="A heavy sword attack for massive damage to ground units."/>
...and if we want to get a little crazy...
Code: [Select]
<!-- effect description-->
<tool-tip value="The poison coursing through this unit's veins reduces speed and causes damage over time."/>
Code: [Select]
<!-- armor type-->
<tool-tip value="Teflon armor is highly resistant to sticky damage, but more susceptible to abrasion attacks."/>
... and the benefit of the second (specified in parameters) would be that you don't have to specify it in multiple places if your unit has more than one way of coming into existence.

Would it be better to read it from a text file somewhere?  Would it be possible to make it multilingual?

My thoughts for that would be that you'd have multiple text files, and the engine would look for a language abbreviation in the file name.  For example:

Quote from: guard_morph_tooltip.en.txt
Heavy melee warrior. Slow speed, highly resistant, and good attack to ground units.
Quote from: guard_morph_tooltip.es.txt
Combatiente pesado mano a mano. Baja velocidad pero alta resistencia y buen ataque contra unidades terrestres.
This might get rather cluttered, in which case a /units/guard/text folder would come in handy (but of course that's up to the modder).
Title: Re: Descriptions/tool-tips/blurbs
Post by: ChupaReaper on 22 October 2010, 08:23:35
I'd like to see this, it should be defined in unit parameters but then overwritten by commands if present, then overwritten again using language. I'd use this a lot it is very useful for new players or new factions that people don't know how to fully use yet.
Title: Re: Descriptions/tool-tips/blurbs
Post by: silnarm on 22 October 2010, 13:33:19
I'd really like to compact the display panel using tooltips instead of what is most of the time empty space. I've been trying to resist changing too much in what is meant to be a bug fix branch, but such a system may very well be provided in 0.3.2
Title: Re: Descriptions/tool-tips/blurbs
Post by: Omega on 22 October 2010, 18:54:30
I hope so Silnarm! I would really love this, after all, there's no real way to know what a unit is until you produce it...

Best done from the command XML, so we can specify this for individual attacks, etc; Besides, even if there's two ways to make a unit, we might want the text different (ie: if a unit is morphed, we might start by saying "Promote this unit into a .... which can...and.....").

I think this should be from ONE language file (if language files are used. Not sure if we need that, since even unit names can't be translated). Having multiple language files would be a pain. Most likely one language file for all the faction's custom strings.
Title: Re: Descriptions/tool-tips/blurbs
Post by: John.d.h on 22 October 2010, 19:03:53
Heh... no rush, though I can see 0.4 is already pretty crowded, so putting it in 0.3.2 could be good if it's relatively easy and unlikely to break anything.
Having multiple language files would be a pain. Most likely one language file for all the faction's custom strings.
I guess that would be more consistent with what we already have, language-wise.  I'm about a third of the way through putting the descriptions into text files as I type this, but it's going to be in name/text/name.en.txt and /name.es.txt, since that's what I've already started on.  If somebody wants to do the tedious task of compiling them into language files once I upload, be my guest.

Edit: Magic's done.

Edit again: So is tech.

Mediafire isn't working for me, so here's the current version on Ubuntu One: http://ubuntuone.com/p/Lgb/ (http://ubuntuone.com/p/Lgb/)
Title: Re: Descriptions/tool-tips/blurbs
Post by: Omega on 22 October 2010, 23:01:07
Looks good John. Not very imaginative, but it strictly serves its purpose  ;).

Of course, that's also a heck of a lot of files...
Title: Re: Descriptions/tool-tips/blurbs
Post by: silnarm on 22 October 2010, 23:15:37
Thanks John.  I think I prefer Omegas idea of one file per faction, but I'll just churn a little bit of code to extract them from your directories and put them in one.

Also... you may have inadvertently just volunteered to maintain the Spanish translation... :P
Title: Re: Descriptions/tool-tips/blurbs
Post by: Omega on 23 October 2010, 00:29:07
Also... you may have inadvertently just volunteered to maintain the Spanish translation... :P

Heheheh... I noticed that. Surprised me that he had all those spanish ones too...
Title: Re: Descriptions/tool-tips/blurbs
Post by: John.d.h on 23 October 2010, 00:30:41
Also... you may have inadvertently just volunteered to maintain the Spanish translation... :P

Heheheh... I noticed that. Surprised me that he had all those spanish ones too...
Don't give me too much credit, now. :P
http://glest.org/es/techtree.php (http://glest.org/es/techtree.php)
Title: Re: Descriptions/tool-tips/blurbs
Post by: ChupaReaper on 25 October 2010, 19:22:01
I'd love to see this and would get working on descriptions for my project straight away. It'll add a lot more depth to the game and for faction like mine with a ton of units, it will be nice to have some info on them in game.
Title: Re: Descriptions/tool-tips/blurbs
Post by: silnarm on 29 October 2010, 02:45:31
Done.

(http://i687.photobucket.com/albums/vv231/silnarm/glest/magic_tooltip.jpg)

In the process I made it so that tech-trees can be translated too. An old problem that never got sorted out...

There is now one lang file for the tech-tree, it has the names of the factions, attack & armour type names and resource names.

Then each faction also has one, things looked up in the faction lang are unit/command/level names and 'tips'.

In the XML, a commands name node may have a 'tip' attribute, pointing to an entry in the faction lang file. Multi-tier commands (traditionally build, but possible with produce & morph now too) will use the tip in their name for the 'top level' button, and can then include a tip with each <unit> (or <upgrade> or ...)

eg, here (https://sourceforge.net/apps/trac/glestae/changeset/912/branches/0.3.x/data/game/techs/magitech/factions/magic/units/initiate/initiate.xml) is a diff of the changes I made to initiate.xml, and here (https://sourceforge.net/apps/trac/glestae/browser/branches/0.3.x/data/game/techs/magitech/factions/magic/magic_en.lng?rev=912) is the new magic_en.lng file.

Title: Re: Descriptions/tool-tips/blurbs
Post by: John.d.h on 29 October 2010, 03:49:42
SCORE! :thumbup: About The Text Being Capitalized Like This, Is That Something That Can Change?
Title: Re: Descriptions/tool-tips/blurbs
Post by: Omega on 29 October 2010, 05:54:42
SCORE! :thumbup: About The Text Being Capitalized Like This, Is That Something That Can Change?
I agree with John. That not only looks bad, but is grammatically incorrect. I propose full control to the language files, meaning that the language file itself controls all the case.
Title: Re: Descriptions/tool-tips/blurbs
Post by: Psychedelic_hands on 29 October 2010, 06:02:30
That's really cool, nice work Silnarm!
Title: Re: Descriptions/tool-tips/blurbs
Post by: hailstone on 10 November 2010, 09:15:45
Can the topic be changed to add [Implemented v0.3.2]? I'd do it but I don't have moderator access to the subboard.
Title: Re: Descriptions/tool-tips/blurbs
Post by: silnarm on 10 November 2010, 11:47:42
Can the topic be changed to add [Implemented v0.3.2]? I'd do it but I don't have moderator access to the subboard.

Hadn't noticed 'til now, but neither do I  :-\

SCORE! :thumbup: About The Text Being Capitalized Like This, Is That Something That Can Change?
I agree with John. That not only looks bad, but is grammatically incorrect. I propose full control to the language files, meaning that the language file itself controls all the case.

Done and done.
Title: Re: Descriptions/tool-tips/blurbs
Post by: John.d.h on 10 November 2010, 21:04:42
Can the topic be changed to add [Implemented v0.3.2]? I'd do it but I don't have moderator access to the subboard.
Done.
Done and done.
Cool.  Is there any documentation for how to use this yet, or should I just wait to see how it's done when 0.3.2 comes out?
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: silnarm on 19 November 2010, 04:53:54
Done and done.
Cool.  Is there any documentation for how to use this yet, or should I just wait to see how it's done when 0.3.2 comes out?

Where I put the tech & faction lang files was not ideal, so they will be moved to techs/a_tech/lang and techs/a_tech/factions/a_faction/lang.

The 'tip' attribute is added to a commands 'name' node,

Code: [Select]
<command>
    <type value='some_type' />
    <name value='my_command' tip='my_command_tip' />
    ...

In this case 'my_command_tip' is looked up in the faction lang file.

For two-tier commands, you can also put tips on the the individual produced units...

Code: [Select]
<command>
    <type value='build' />
    <name value='my_build' tip='my_build_tip' />
    ...
    <buildings>
        <building name='a_building' tip='a_building_tip' />
        <building name='building2' tip='building2_tip' />
        ...

Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: Omega on 19 November 2010, 23:33:35
Where I put the tech & faction lang files was not ideal, so they will be moved to techs/a_tech/lang and techs/a_tech/factions/a_faction/lang.
So, that's
Code: [Select]
%GLEST_FOLDER%/techs/%TECHTREE_NAME%/langs and techs/%TECHTREE_NAME%/factions/%FACTION_NAME%/lang...

That seems a bit complex... And the techtree name is there twice...

Alternative path proposals:
Code: [Select]
%GLEST_FOLDER%/techs/%TECHTREE_NAME%/lang/%FACTION_NAME%A folder in the techtree which has subfolders for each faction.
Code: [Select]
%GLEST_FOLDER%/techs/%TECHTREE_NAME%/langOne folder in the tech tree folder for ALL the factions.
Code: [Select]
%GLEST_FOLDER%/techs/%TECHTREE_NAME%/factions/%FACTION_NAME%/langOne folder in the faction's folder directly. (my preferred setting)

I don't think having spaces in "langs and techs" is a good idea... At the very least, simply calling it "lang" would be simpler.
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: silnarm on 20 November 2010, 13:15:28
That seems a bit complex... And the techtree name is there twice...

Perhaps a misunderstanding, there is one lang file for the tech-tree, containing translations for the faction, resource, attack and armour types, and each faction has one as well, for unit, upgrade and command names as well as the tips.

So, for magitech there is now (actually currently there is no 'lang' dir on the ends of these, this is what I am proposing to change),

%DATA_DIR%/techs/magitech/lang/magitech_en.lng
%DATA_DIR%/techs/magitech/factions/magic/lang/magic_en.lng
%DATA_DIR%/techs/magitech/factions/tech/lang/tech_en.lng

I just had them in the tech or faction's 'root' dir initially, which I think is fine if we were only going to have English there, but that of course is not the idea, so a lang sub-dir is I think a good idea.
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: Omega on 21 November 2010, 06:46:55
%DATA_DIR%/techs/magitech/lang/magitech_en.lng
%DATA_DIR%/techs/magitech/factions/magic/lang/magic_en.lng
%DATA_DIR%/techs/magitech/factions/tech/lang/tech_en.lng
Ah, I see...

But, then, what did you mean by:
Quote
they will be moved to techs/a_tech/lang and techs/a_tech/factions/a_faction/lang.

Regardless, sounds great! Although, what's the language file for the techtree for?
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: ChupaReaper on 22 November 2010, 09:48:43
I'm guessing the language for the techtree covers armour types and resources, etc.
My project's just about all ready for this feature now (I hope), can't wait for 0.3.2.
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: silnarm on 22 November 2010, 12:10:55
But, then, what did you mean by:
Quote
they will be moved to techs/a_tech/lang and techs/a_tech/factions/a_faction/lang.

Additional misunderstanding... sorry, I should have realised what you meant earlier. That is two paths, not one. It was intended to show where the tech lang file goes,
Code: [Select]
techs/magitech/lang/magitech_en.lng
and where each factions lang goes,
Code: [Select]
techs/magitech/factions/magic/lang/magic_en.lng
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: Omega on 22 November 2010, 18:51:59
 :O
Now I see it! How'd I miss that was two separate paths? :|

I'll start gearing up Military for this too... I have waited a long time for this... *eViL lAuGhTeR*
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: ChupaReaper on 23 November 2010, 15:01:58
Could you have it so you can change the name of the tech tree in the language file that's inside the techtree, so in my mod:
glestae/techs/mrise/lang/mrise_en.lng --> "mrise=Malevolent Rising"
Title: Re: Descriptions/tool-tips/blurbs [Implemented v0.3.2]
Post by: silnarm on 27 November 2010, 01:29:39
Could you have it so you can change the name of the tech tree in the language file that's inside the techtree, so in my mod:
glestae/techs/mrise/lang/mrise_en.lng --> "mrise=Malevolent Rising"

Will do  :angel: