View topic - decaying nanoframes give back too much resources?



All times are UTC + 1 hour


Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 10 Nov 2011, 14:12 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
When canceling a construction in my game, the player gets back too much resources. (metal)
Seems like the payback is the whole unitcost even if the unit was just started a few percent.
How to reproduce:
1) download game (its zipped .sdd)
2) use up some resources so the storage is not filled anymore
(eg build 5 of the 1st unit in buildlist -> you now have 500 metal)
3) make an "Erector" construction vehicle -> you now have 0 metal
4) wait and notice how the resources do not fill up because nothing produces metal
5) start making a factory with the con vehicle, with no metal it will stay at 0% build progress
6) cancel the construction with the stop button -> omg 800 instant metal for canceling a construction only costs 200 metal to make.

How to fix that?
It does not seem to happen in other mods.
Also canceling units in the factory does not have that effect.
self-d the unit during construction does not give back metal.

modrules.lua looks like this:
Code:
return {construction = {
    constructionDecay      = true; -- defaults to true
    constructionDecayTime  = 5;  -- defaults to 6.66
    constructionDecaySpeed = 0.01;  -- defaults to 0.03
  },
}

https://github.com/spring/spring/blob/d ... t.cpp#L911
can't notice anything funny here either.


Image

things that do not solve it:
-adding energycost
-putting negative constructionDecaySpeed (makes autocompleting nanoframes with endless growing health. cool.)


Attachments:
File comment: zipped .sdd!
springtutorialgame_decyaytest.sdd.7z [299.48 KiB]
Downloaded 21 times
Top
 Offline Profile  
 
PostPosted: 10 Nov 2011, 19:29 
Spring Developer

Joined: 08 Oct 2006, 15:58
You have:

Code:
simplefactory.lua
    buildTime=25
    buildCostMetal=200
modrules.lua
   constructionDecaySpeed=0.01


When a structure starts decaying, it generates

Code:
metalCost * buildDecay


worth of metal every SlowUpdate tick that its health is still > 0, where

Code:
buildDecay = 1.0f / (buildTime * constructionDecaySpeed);


so in your case buildDecay = (1 / (25 * 0.01)) = 4 --> lots of free metal because all nanoframes start life with 0.1 health.

there was also a minor engine bug wrt. metal refunding, details hardly worth mentioning


Top
 Offline Profile  
 
PostPosted: 10 Nov 2011, 20:06 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
hm ok, but why does it work in say, xta?
Or does it happen there too but is just more hidden because units also cost energy?


Top
 Offline Profile  
 
PostPosted: 10 Nov 2011, 22:08 
Spring Developer

Joined: 08 Oct 2006, 15:58
It does happen elsewhere, but XTA units have much larger buildtimes so 1.0 / (buildTime * constructionDecaySpeed) is << 1 (even with the default constructionDecaySpeed value of 0.03) and you do not get game-breaking amounts of free metal from them.


Top
 Offline Profile  
 
PostPosted: 10 Nov 2011, 22:10 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
i see. just to make sure, with the change in next spring version player will only get as much metal as they have invested into the construction?


Top
 Offline Profile  
 
PostPosted: 23 Nov 2011, 03:13 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
fedjohn wrote:
Oh I see,
With the change in next spring version player will only get a metal as they have invested into the construction?
Yes, dear spammer, that is correct.
Just tested in 84.0 and it works. Thanks Kloot!


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.