Opened 11 years ago
Last modified 5 years ago
#1973 new enhancement
[PATCH] Regenerative resources
Reported by: | alpha123 | Owned by: | Stan |
---|---|---|---|
Priority: | Should Have | Milestone: | Work In Progress |
Component: | Simulation | Keywords: | patch design |
Cc: | Patch: | Phab:D1718 |
Description (last modified by )
Some resources such as berries and fish should regenerate food so as to be more viable long-term food sources. This patch implements an extension to ResourceSupply.js to allow for regenerative resources and modifies the fish and berry templates.
A resource will start regenerating several seconds (controllable in the template) after its number of gatherers reaches 0. After that it regenerates at either a linear rate or using a population growth formula. Currently the way the formula works is that if you overfish and the amount of resources reaches 0, it will not regenerate. I couldn't tell if that was a bug or a feature, so I left it. ;P If it is a feature the fish should be removed from the map (currently regenerative resources are never removed).
Techs are supported, but in a rather unusual way: since the player is researching techs that apply to entities they don't own (gaia does) I had to implement it in a slightly roundabout way (thanks to leper on IRC). Basically, regenerative entities apply the techs of whatever player's territory they are currently in. This works fine for fruit, but not for fish since they won't usually be in anyone's territory. There are two tech modifiers: ResourceSupply/Regeneration/Rate and ResourceSupply/Regeneration/Delay.
Attachments (2)
Change History (14)
by , 11 years ago
Attachment: | regenerative-resources.patch added |
---|
comment:1 by , 11 years ago
Component: | Core engine → UI & Simulation |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
I turned the berry regen down a bit, I think it was very high from me testing it. :P
More importantly, I completely changed the formula for fish regrowth. It's now a simplified sigmoid curve. I can't claim credit for that though, thanks a bunch to scythetwirler on IRC for helping me out.
by , 11 years ago
Attachment: | regenerative-resources-v2.patch added |
---|
Change the formula for fish growth; clean some things up.
comment:4 by , 11 years ago
I just wonder, why all that juggling with timers?
You can simply take single setInterval timer. That also has a delay parameter. You simply start the timer (including delay) when the number of workers reaches zero. And each time the RegenerateResources function is executed, you check if the current number of gatherers is zero. If it isn't you stop that timer.
This would avoid subtile bugs with the timer.
Also, one timer every second would be sufficient (I think decimal amounts should be allowed, as long as they're rounded in the GUI). No reason to split it up between being integer or not. Just one call per second.
OTOH, I thought we discussed removing that delay timer (see http://irclogs.wildfiregames.com/2013-06-30-QuakeNet-%230ad-dev.log around 17:00) to avoid micromanagement, and just let regeneration start the moment some resources are taken, in which case the timer should be activated (if not existing yet) on every TakeResources call, and only cancelled when the amount equals maxAmount again
comment:5 by , 11 years ago
Milestone: | Alpha 14 → Alpha 15 |
---|
comment:6 by , 10 years ago
Keywords: | design added |
---|---|
Milestone: | Alpha 15 → Alpha 16 |
comment:7 by , 10 years ago
Keywords: | review removed |
---|
Removing review since this is mostly waiting on a design decision.
comment:8 by , 10 years ago
Milestone: | Alpha 16 → Alpha 17 |
---|
comment:9 by , 10 years ago
Milestone: | Alpha 17 → Backlog |
---|
comment:10 by , 9 years ago
Owner: | removed |
---|
comment:11 by , 5 years ago
Component: | UI & Simulation → Simulation |
---|---|
Description: | modified (diff) |
Milestone: | Backlog → Work In Progress |
Owner: | set to |
Patch: | → Phab:D1718 |
Looks nice, but the regen rate of the berry bushes is far too quick IMO.
10 women are not able to deplete 4 bushes. They regenerate faster than they can gather.
And about the fish, can't the exponential formula be applied by the amount of fish around in a certain range? So when you deplete some spot, but not another one nearby, fish will come back. If you deplete the entire ocean, fish won't come back. Of course, the regen rate should be slower when you check for more fish.