Author Topic: Resource Requirements; Need Lots of Help  (Read 5463 times)

modman

  • Guest
Resource Requirements; Need Lots of Help
« on: 27 September 2008, 16:42:43 »
Could someone change the engine to allow for resource requirements for commands?

@kukac@

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #1 on: 27 September 2008, 16:56:41 »
As I know, it's already done by the basic Glest.

gameboy

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #2 on: 28 September 2008, 14:10:40 »
It is, How?

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #3 on: 28 September 2008, 14:37:01 »
Here I'll tell you guys why this would be important to have.  This way, you can definately trade resources by, say making it cost 25 gold for 20 wood.  Also, you could have some units cost moey to attack or to move, ect.  Or, like in a post I saw earlier, have the unit cost oil to move. Found it here.
« Last Edit: 31 October 2008, 17:43:33 by modman »

@kukac@

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #4 on: 28 September 2008, 17:19:50 »
Ok, I thought the summon commands has the resource requirements, but it is in the summoned units xml.

Maybe it works with <resource-requirement>?

mictes

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #5 on: 28 September 2008, 17:44:10 »
The summoner produces units and morph into, there is no requirement for the command.

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #6 on: 5 October 2008, 18:05:42 »
No, you can't just do <resource-requirements> in the XML; I wish I could.  The real solution is going to be in the source code, but I just can't find out where; if I could I couldn't even compile it.

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #7 on: 9 October 2008, 01:34:42 »
Oh yea...I can't write C++ very well either.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Resource Requirements; Need Lots of Help
« Reply #8 on: 10 October 2008, 12:58:25 »
The algorithm is:

When the player tries to use a command
Get the resource value from the xml
If they have enough resources then
execute command and reduce the appropriate resource/s
otherwise
notify the user they don't have enough resources

The resource value might be stored instead of getting it from the file each time.

Then it's a matter of finding the parts in the code that relate to the algorithm. I'll give out more hints if I get time.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #9 on: 13 October 2008, 21:02:35 »
I have no idea where in the whole code to find this.  (there are tons of source files!)

daniel.santos

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #10 on: 22 October 2008, 08:06:21 »
I can see a lot of good in this.  On some RTS's, repairing existing units costs a small portion of their originally required resources per repair "tick".  It could be reasonable to have "gunpowder" as a global resource (like gold, wood, etc.) and that be used when a cannon is fired, for instance (or a tank moving).  It's a question of the mod's designer as to rather or not it's a resource that the individual unit has (like energy or health) or that's shared by the entire faction.

It would seem to me that the most appropriate mechanism for handling this may be to extend the flexibility of resources.  I would say leave hp and ep like they are (probably) because there's a lot of code is wrapped around those, but add extensible resources and mechanisms to manipulate those from the skills.  This would create an additional mechanism to "store" resources as well.  Currently, when a unit stores resources, they store them in a global (faction-side) pool.  What I'm proposing would add the mechanism for a unit to store them locally, on their person.  It would make a lot more sense for a tank to store it's own fuel and run out unless they return to a fuel depot for instance.

This flexible mechanism could solve a multitude of uses.  Resources would still be defined where they are now, but would not appear at the top of the screen unless a unit declared that it stored them as a global resources (as they do now).  I propose adding the optional parameter of local, with a boolean value to the unit.xml under /unit/parameters/resources-stored/resource with the default being false (i.e., a global resource).  Then, under unit/skills/skill, add a "resource-cost" node containing the same resource nodes as under resources-stored.  We should probably also add a hp-cost node (like ep-cost) to allow skills to consume hps as this is not terribly uncommon either.

For the FPM tree, this would probably adequately support my earlier prospect that the Grove would automatically generate wood, it could just be added to it's stop skill.  I'm still reorienting myself to the project, so I'm not sure where a good place (time & version-wise) is to insert this.  Also, I need more time to reflect on it and get input from others, especially if it should support features similar to using a portion of the resources required to make a unit, a unit doing repairing and consuming global resources for that repair would have to key off of the cost of the unit being repaired, and the above specification wouldn't cover that.

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #11 on: 28 October 2008, 00:40:50 »
Another thing where resource requirements for commands would be helpful: morphing to a unit and back.  Like, say, a Summoner morphing to Drake and back to Summoner.

One more: Say i want the Mage tower to produce Initiates AND Battlemages.  If you make it in the Mage Tower, it's 75 gold, but morphed from an Initiate is a total of 150 gold.  If the problem with this is not already obvious, it would really screw up the CPU.

Please, could someone please program this into the glest engine soon?

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #12 on: 31 October 2008, 17:49:22 »
About each individual unit storing resources, it's more logical, yet it would sometimes make gameplay less fun.  For instance, there would no longer be much of a reason to build a Summoner's Guild next to wood, because it would not be able to store very much and your Initiates would end up bringing the wood to the Mage Tower anyways.

Plus, how would the engine compute seperate usage of resources when you spend them.  Say you research "ancient summoning".  The Summoners Guild does not store stone, so where does the engine take it from?  What building?

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Resource Requirements; Need Lots of Help
« Reply #13 on: 1 November 2008, 00:06:13 »
I have played Stronghold (an RTS game) that stores base resources on platforms next to a keep. There is only one keep allowed per team. You are able to see the wood, and stone etc. Then resources are taken from there to build weapons or food which are then taken to a storage building. You can having multiple of these anywhere. When you recruit a villager the chosen weapon vanishes from the storage. I haven't played any other RTS where the workers need to gather materials from a storage location before building.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #14 on: 1 November 2008, 08:35:05 »
Quote from: "modman"
About each individual unit storing resources, it's more logical, yet it would sometimes make gameplay less fun.  For instance, there would no longer be much of a reason to build a Summoner's Guild next to wood, because it would not be able to store very much and your Initiates would end up bringing the wood to the Mage Tower anyways.

Plus, how would the engine compute seperate usage of resources when you spend them.  Say you research "ancient summoning".  The Summoners Guild does not store stone, so where does the engine take it from?  What building?
No, you're missing the point.  The "ability to have locally stored resources" doesn't mean that summoner guilds start storing resources locally, it's an *option* for when it makes sense.

Second, you're thinking inside the box.  When I say "resources" I mean a generic pool of some type of resource, I don't necessarily mean wood, stone, gold, etc.  A resource may be sofa cushions and I might have a special skill called "create sofa" that consumes 3 "sofa cushion" resources.  Or maybe I have a "run very fast" skill that consumes "stamina points", a resource that each unit stores locally and regenerates, just like energy and hit points.  So think of energy points and hit points as "locally stored resources" as well.  But a "locally stored resource" may indeed be wood, stone or rock, as I'm considering with the mobile storage unit -- a unit that wciow has already created a model for and that would be able to follow around harvesters and then make trips back to the castle every now and then, but overall, make harvesting faster for path of reason.

Finally, locally stored resources would appear in the ring around the unit when selected (just as hp & ep are now) and also as a line on the unit's portrait (as hp and ep will be soon), that way, you don't have to look for a number to know where they are at and the color would be specified in the <resource> node or some such.

modman

  • Guest
Re: Resource Requirements; Need Lots of Help
« Reply #15 on: 17 November 2008, 01:52:35 »
I think this could work like the thing I think you did with the upgrades; in the skill you either add or subtract resource requirements from what was already required.

I know there was also a multiplier there too, but we don't need that.