Page MenuHomeWildfire Games

Add Upkeep component.
Needs ReviewPublic

Authored by Freagarach on Feb 23 2018, 4:04 PM.


Group Reviewers
Restricted Owners Package(Owns No Changed Paths)

Adds a new component Upkeep similar to ResourceTrickle but to allow for entities costing resources instead of providing them.
A separate component because:

  • ResourceTrickle is not suited for negative rates and the adaptation thereof would make it unnecessary complex.
  • "We" may want to introduce effects to happen when upkeep cannot be paid.

This is semi-WIP since there is no penalty for not having the needed amount of resources besides being spammed by "Insufficient resources"-messages. That message should be altered (more specific to upkeep) or at least improve UX for that.

Ideas for penalties of not being able to provide the necessary resources include:

  • Decline of HP.
  • Conversion of CP to GAIA.
  • Reduced effectiveness of the entity (e.g. workrate, attackpower, productionrate).
  • Uncontrollability.
Test Plan

Verify that:

  • Correct amount of resources are deduced every interval.
  • Values are correctly affected by modifications.
  • The amount of resources owned by a player does not go negative.

Event Timeline

Nescio created this revision.Feb 23 2018, 4:04 PM
Stan added a subscriber: Stan.Feb 23 2018, 4:23 PM

Won't it cause stuff like negative resources ?

Won't it cause stuff like negative resources ?

Yes, it does; negative resources actually behave quite nicely. (E.g. if you have −100 food, the game informs you you'll need 150 more food before you can train a female with a food cost of 50.)

Angen added a subscriber: Angen.Feb 23 2018, 4:35 PM

You cannot go to negative resources. That means you use something you do not have.

Negative resources could represent debts and famine. And you still need a positive amount of resources in order to actively spend it on something.
I've been happily using it for several weeks in my 0abc mod, and I figure others might want to try it out in future mods. This patch is not terribly important, just a nice to have for modders.

Stan added a comment.Feb 23 2018, 5:25 PM

Okay so it's not that bad. I was worried allowing this would break the game in the sense of having negative resources make you have unlimited ones.

Vulcan added a subscriber: Vulcan.Feb 23 2018, 5:47 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...

|  17| ·»   cmpTimer.SetInterval(this.entity,·IID_ResourceTrickle,·"Trickle",·this.GetTimer(),·this.GetTimer(),·undefined);
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

Link to build:

wraitii added a reviewer: Restricted Owners Package.May 14 2018, 12:08 PM
smiley added a subscriber: smiley.Dec 21 2018, 6:52 AM
smiley added inline comments.

Math.max(0, ...) would solve the negative resource problem (which should not happen).

Math.max(0, ...) would solve the negative resource problem (which should not happen).

The idea of this patch is to allow for negative resource trickle rate to represent upkeep etc. Negative resource *amounts* are probably undesirable, however, your suggestion would prevent the *rate* from being negative.

Nescio updated this revision to Diff 9512.Aug 25 2019, 8:25 PM
Nescio edited the summary of this revision. (Show Details)
Nescio edited the test plan for this revision. (Show Details)

Updated ( this forum post reminded me).

Successful build - Chance fights ever on the side of the prudent.

Link to build:

A, IMHO, nicer approach would be an Upkeep component. It is on my ToDo-list to make a diff that you may use it, but there are many things on that list :(

Freagarach retitled this revision from allow negative resource trickle rate to Add Upkeep component..
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
Freagarach removed a subscriber: Vulcan.


Owners added subscribers: Restricted Owners Package, Restricted Owners Package.Sep 18 2020, 10:58 AM
Stan added a comment.EditedSep 18 2020, 12:26 PM

Maybe we should allow specific resources to go negative, eg if one wants to use coin. Out of scope though.

@Freagarach, since this patch now is completely different from the initial version, you should just commandeer.

Freagarach commandeered this revision.Sep 18 2020, 1:36 PM
Freagarach added a reviewer: Nescio.