Author Topic: [done] XML option to hide a resource from the HUD  (Read 1043 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
[done] XML option to hide a resource from the HUD
« on: 31 March 2012, 21:36:49 »
Resources, with an icon and current amount, are always displayed at the top of the screen. This is, of course, very useful for most resources, but if we were to use, say a "hero" resource, to ensure the player can only have one of a specific kind of unit (out of multiple choices; for example, you have three choices for hero units, but can only have one at a time, so we'd want to use a static resource that is recuperated upon the death of that unit).

Using a resource is the easiest way to do that, however, we don't really need it to be shown in the top HUD. The best approach would be to simply hide that resource in the HUD, toggled via an option XML tag, <display value="true|false"/>. If true, the resource is displayed as normal, if false, the resource is hidden from the top HUD. If the tag is omitted, the default is true.

The tag in question already exists in GAE as the above code, and is further documented here.
« Last Edit: 18 June 2016, 16:31:50 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: XML option to hide a resource from the HUD
« Reply #1 on: 31 March 2012, 22:36:43 »
I think this feature is not so good. We have max-unit-count for it. The problem with not displaying the resource is that you cannot see how many ressources you have ( you don't know if you can build 1 or 2 or 3 heros for example ). So all advantages of the ressource based hero logic are lost.

max-unit-count also disables the button to produce one more of these units if you reached the max count.

Convince me that this is a good feature :). And what in detail does mean "hidden from the GUI" ? Only the resource display on top of the screen? Or display of it in general, like in unit requirements. ( is there more ? )
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: XML option to hide a resource from the HUD
« Reply #2 on: 1 April 2012, 07:18:52 »
The principal advantage is best explained with this example:

Suppose tech has two "hero" units, "spiderpig" and "cow of doom". You can have either spiderpig or the cow of doom at once time, but not both. Max unit count can't do that. Only a resource can. And in the case of hidden resources, they're only meant for such cases like this, where there is only one of the specific resource available.

And an example of actual use was in the development of FPM, the priestess unit required a shrine to be produced. One shrine = one priestess, and a resource was used for that. This resource was hidden because it was unnecessary clutter in the HUD and the logic of "one shrine; one priestess" is simple enough that a displayed count is unnecessary.

As for what hidden refers to, it means just the HUD at the top of the screen.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: XML option to hide a resource from the HUD
« Reply #3 on: 1 April 2012, 19:43:05 »
done
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: XML option to hide a resource from the HUD
« Reply #4 on: 1 April 2012, 20:15:56 »
done

Would you mind to tell us how to use it? Which element? Which attributes? Which parent-element?

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: XML option to hide a resource from the HUD
« Reply #5 on: 1 April 2012, 23:37:24 »
As Omega said, in the resource xml write <display value="false"/> and the resource is no longer displayed.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: XML option to hide a resource from the HUD
« Reply #6 on: 2 April 2012, 01:57:23 »
« Last Edit: 18 June 2016, 13:37:45 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert