Jump to content

Units Fattening / Decaying


Recommended Posts

I started working on a feature that allows sheep to gain more food over time, and make animal's food decay over time, when being left out (rotting) I was wondering if that's something you guys would like to see in the game which would have a positive impact, or if you think that's better for a mod. @borg- @wowgetoffyourcellphone @Nescio @Hannibal_Barca

 

https://code.wildfiregames.com/D1718

 

  • Like 9
  • Thanks 5
Link to post
Share on other sites
7 minutes ago, stanislas69 said:

I started working on a feature that allows sheep to gain more food over time, and make animal's food decay over time, when being left out (rotting) I was wondering if that's something you guys would like to see in the game which would have a positive impact, or if you think that's better for a mod. @borg- @wowgetoffyourcellphone @Nescio @Hannibal_Barca

 

https://code.wildfiregames.com/D1718

 

I remember asking Elexis for this a long time ago.

I really think it adds a bit more realism and depth to the game. I would like to see this part of the game.

When you tell sheep, are you telling the animals created by stable?

  • Like 3
Link to post
Share on other sites
1 hour ago, stanislas69 said:

I started working on a feature that allows sheep to gain more food over time, and make animal's food decay over time, when being left out (rotting) I was wondering if that's something you guys would like to see in the game which would have a positive impact, or if you think that's better for a mod. @borg- @wowgetoffyourcellphone @Nescio @Hannibal_Barca

 

https://code.wildfiregames.com/D1718

 

Would apply for farms too ?

  • Like 1
Link to post
Share on other sites
29 minutes ago, borg- said:

When you tell sheep, are you telling the animals created by stable?

Anything, for now just sheep cause I'm testing it but it could apply to literally anything.

3 minutes ago, Alexandermb said:

Would apply for farms too ?

Could work, What do you have in mind.

Link to post
Share on other sites
1 hour ago, stanislas69 said:

Basically, fauna starts at 0 food, gradually fattens to max when alive, and decays back to 0 after it's killed? Yes, that's something I like to see, not just in mods, but in 0 A.D.'s default distribution, for all fauna.

While at it, could you also implement the following? Right now resource suppliers always start at the max by default; so each metal mine contains exactly 5000. Instead, I think the game would be far more interesting if such entities would simply be spawned with a random amount between max and min (e.g. a sheep starts with between 10 and 100 food, a stone quarry with between 3000 and 6000 stone).

Link to post
Share on other sites
1 hour ago, stanislas69 said:

I started working on a feature that allows sheep to gain more food over time, and make animal's food decay over time, when being left out (rotting) I was wondering if that's something you guys would like to see in the game which would have a positive impact, or if you think that's better for a mod. @borg- @wowgetoffyourcellphone @Nescio @Hannibal_Barca

 

https://code.wildfiregames.com/D1718

 

I think it's a little detail that Age players would like, indeed. 

How does the template schema look for this in your patch? 

Link to post
Share on other sites
21 minutes ago, Nescio said:

Basically, fauna starts at 0 food, gradually fattens to max when alive, and decays back to 0 after it's killed? Yes, that's something I like to see, not just in mods, but in 0 A.D.'s default distribution, for all fauna.

You could do that with that patch. For now I was thinking making it start at one third or half, so you can hunt a bit at the begginning of the games.

Quote

While at it, could you also implement the following? Right now resource suppliers always start at the max by default; so each metal mine contains exactly 5000. Instead, I think the game would be far more interesting if such entities would simply be spawned with a random amount between max and min (e.g. a sheep starts with between 10 and 100 food, a stone quarry with between 3000 and 6000 stone).

Could be done in a separate patch :) Pretty easy to do.

 

16 minutes ago, wowgetoffyourcellphone said:

I think it's a little detail that Age players would like, indeed. 

How does the template schema look for this in your patch? 

I might not have thought of all the cases so it might break :)

But currently

 

	<a:example> 
		<Amount>1000</Amount> 
		<Type>food.meat</Type> 
		<KillBeforeGather>false</KillBeforeGather> 
		<MaxGatherers>25</MaxGatherers> 
		<DiminishingReturns>0.8</DiminishingReturns> 
		<Regeneration> 
			<Fattening> 
				<GrowsWhenAliveOnly /> 
				<Rate>0.5</Rate> 
				<MaxAmount>500</MaxAmount> 
			</Fattening> 
			<Decaying> 
				<DecaysWhenDeadOnly /> 
				<Rate>0.5</Rate> 
			</Decaying> 
			<RegenInterval>500</RegenInterval> 
		</Regeneration> 
	</a:example> 

 

 

Link to post
Share on other sites
7 minutes ago, wowgetoffyourcellphone said:

So is <Amount> the starting amount when the unit is trained and <MaxAmount> is the maximum amount of food added to <Amount>? And with <Rate> and <RegenInterval> you'rer looking at precisely 1 Food per second of fattening?

Right !

Link to post
Share on other sites
1 hour ago, stanislas69 said:

But currently

Seems unnecessarily complicated. How about the following?

  <ResourceSupply>
    <KillBeforeGather>false</KillBeforeGather>
    <Amount>200</Amount>
    <Max>300</Max>
    <Type>food.fruit</Type>
    <MaxGatherers>8</MaxGatherers>
    <Growth>
      <Interval>1000</Interval>
      <Rate>1.0</Rate>
    </Growth>
    <Decay>
      <Interval>1000</Interval>
      <Rate>0.5</Rate>
    </Decay>      
  </ResourceSupply>

With growth active when the entity (animal, tree, something else) is “alive” and decay when it's “dead”; both rates can be negative.

Link to post
Share on other sites
6 hours ago, Nescio said:

Seems unnecessarily complicated. How about the following?


  <ResourceSupply>
    <KillBeforeGather>false</KillBeforeGather>
    <Amount>200</Amount>
    <Max>300</Max>
    <Type>food.fruit</Type>
    <MaxGatherers>8</MaxGatherers>
    <Growth>
      <Interval>1000</Interval>
      <Rate>1.0</Rate>
    </Growth>
    <Decay>
      <Interval>1000</Interval>
      <Rate>0.5</Rate>
    </Decay>      
  </ResourceSupply>

With growth active when the entity (animal, tree, something else) is “alive” and decay when it's “dead”; both rates can be negative.

See the first iteration of the patch. I recall doing it like this.

Link to post
Share on other sites
8 hours ago, Nescio said:

Seems unnecessarily complicated. How about the following?


  <ResourceSupply>
    <KillBeforeGather>false</KillBeforeGather>
    <Amount>200</Amount>
    <Max>300</Max>
    <Type>food.fruit</Type>
    <MaxGatherers>8</MaxGatherers>
    <Growth>
      <Interval>1000</Interval>
      <Rate>1.0</Rate>
    </Growth>
    <Decay>
      <Interval>1000</Interval>
      <Rate>0.5</Rate>
    </Decay>      
  </ResourceSupply>

With growth active when the entity (animal, tree, something else) is “alive” and decay when it's “dead”; both rates can be negative.

Could work as well. I just didn't want to have two timers. :) Also trees are not alive. Their health bar is the resource bar.

Link to post
Share on other sites
5 hours ago, (-_-) said:

See the first iteration of the patch. I recall doing it like this.

Then why was it changed?

2 hours ago, stanislas69 said:

I just didn't want to have two timers. :)

Why not? Different attack types also work at different intervals. I'd say give maximum flexibility.

2 hours ago, stanislas69 said:

Also trees are not alive.

One might as well say they are always alive and cannot be dead; I suppose it depends on how one interpretes <KillBeforeGather>false</KillBeforeGather>.

Anyway, I think this feature would be useful not only for ordinary meat animals, but also for fish and for fruit trees and bushes.

Link to post
Share on other sites
1 hour ago, Nescio said:

Why not? Different attack types also work at different intervals. I'd say give maximum flexibility.

Yeah, but that means more things running in the background, and so potentially more lag if there are a lot of units abusing it :D I'll update the diff when I have some time. Also I like to avoid memory access collision, two timers writing in the same variable at the same time might cause issues.

1 hour ago, Nescio said:

One might as well say they are always alive and cannot be dead; I suppose it depends on how one interpretes <KillBeforeGather>false</KillBeforeGather>.

Anyway, I think this feature would be useful not only for ordinary meat animals, but also for fish and for fruit trees and bushes.

I meant on a code standpoint

if you print the health on the deer while it's alive:

var cmpHealth = Engine.QueryInterface(this.entity, IID_HEALTH);
if (cmpHealth)
	warn(cmpHealth.GetHitpoints) // will print 50 (Current Deer Health)

While it's dead

var cmpHealth = Engine.QueryInterface(this.entity, IID_HEALTH);
if (cmpHealth)
	warn(cmpHealth.GetHitpoints) // will print 100 (Current Deer food amount inherited from the Hunt template)

 

Link to post
Share on other sites

Update. This should fix the bug of units not decaying again. The schema changed a little bit to allow for less duplication.

<a:example> 
    <Amount>1000</Amount> 
    <MaxAmount>1500</MaxAmount> 
    <Type>food.meat</Type> 
    <KillBeforeGather>false</KillBeforeGather> 
    <MaxGatherers>25</MaxGatherers> 
    <DiminishingReturns>0.8</DiminishingReturns> 
    <RegenBonus> 
        <Growth> 
            <Constraint>Alive</Constraint> 
            <Rate>2</Rate> 
            <Interval>1000</Interval> 
        </Growth> 
        <Decay> 
            <Constraint>Dead</Constraint> 
            <Rate>-1</Rate> 
            <Interval>1000</Interval> 
        </Decay> 
    </RegenBonus> 
</a:example> 

Constraints 'Dead', 'Alive', 'Both', none (just don't add the line)

The tag name defines the technology that will be able to affect the decay regen etc. When this is accepted, I will need to add an example tech.

 

  • Like 2
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...