[Reg] 3% Losses despite having sufficient funds?

Started by Shoot, June 11, 2013, 05:55:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shoot

In Reg, while building I encountered a strange bug. While clearly having adequate cash to spend a few turns, the game said I have enough cash for 0 turns so i shouldn't build more than 3 buildings. Knowing that I was certainly fine (or so I thought), i ignored the warning and proceeded to build.

Cash: $659,229,161

Due to lack of Cash, 3% of your Army has left! (x34 times)

Turns Included: 34
Economic Status
Income:    $5,562,491
Expenses:    $100,151,498
War Tax:    $0
Loan Pay:    $501
Net:    -$94,589,508

Having 600+ million cash at the start of that building run while having expenses for those turns totalling 100 million for the batch, I obviously should not have taken any 3% losses, let alone a 3% loss for all 34 turns spent building. My guess is some sort of bug resulted in me having either income or one of the expense fields become "NaN"  (not a number) on the first turn, resulting in my cash being wiped out and causing 3% losses on all of the other turns as I was running turns in the red. After this incident, turn use did function as normal.

Not sure if it helps narrow anything down since I couldn't get any other information that might help, and don't think I'd be able to reproduce this, but the actions taken leading up to this incident:
-Prepared Raiders
-Attacked land farm a few times
-Built all newly acquired land into huts (warning appeared indicating having cash for 0 turns)
-Spent 34 turns building, received 34 3% losses due to lack of cash despite having sufficient funds.

windhound

Owch.

Keep in mind that structures cost money to build, and if you spent 34 turns building it was a decently large amount of land.  I haven't looked at the build code in a while, but I suspect it calculates how much its going to cost to build and goes ahead and subtracts it from your total cash, then runs the turn calculations.  So that's one way it could happen, it burnt all your cash in build fees then had nothing left for turn costs.

Burning 660 mil is a lot though...
Can you tell me how much it cost for you to build? 
Barring that, how much land you had at the time and how much you were trying to build on in one go?

The build calculations should be entirely independent from your previous actions, should be.
I'll look over it tonight and see if I can figure it out.
A Goldfish has an attention span of 3 seconds...  so do I
~ In the beginning there was nothing, which exploded ~
There are only 10 types of people in the world: Those who understand binary, and those who don't

taekwondokid42

It sorta makes sense if you had somewhere near 100k land and a fast build rate. As a wolf on 71k land, if I spent 34 turns building it would cost me somewhere near $318m. A wolf spending 34 turns building is going to spend the least amount of money by a fair margin. if you were a stoat on 120k land, then 34 turns would probably cost a full $600m

What [probably] happened is you had more free land than buildings you were able to build (did you finish building with free land left?). You could only "afford" X buildings (X being somewhere between 40k and 100k) but you had X+Y free land.

So you didn't realize this, and you built X buildings. The way the programming works is that all the money gets spent before the first turn is ever used. So you built 34 turns worth of buildings all at once, spent 100% of your cash, and then spent 34 turns at $0. (the first turn you probably had a few thousand, but spent a million or so - so there was deserting anyway).

As a ballpark: if you build ~50k buildings on ~100k land, it's going to cost ~$650m.

Shoot

Sorry for getting back to this so late (on vacation atm), but to clarify a few things:

1) I forgot to make note of building cost, but I do remember having enough cash to build my land completely (leaving 0 free acres), but it may have been barely enough to cover the buildings but not the subsequent turn use, so that may have been user error. I think it was around 55k buildings on 120k land which would cost somewhere around 800m (assuming land / 10 + 2500 is the building cost)

2) The fact that it said I had enough cash for 0 turns so i should build no more than 3 buildings when I went to build is still erroneous. I built anyway after seeing it because I knew that was inaccurate, so I didn't think I had anything to worry about. If the scenario in #1 is correct, i should have been able to build for a few turns without worry.

Shadow

#4
ill see if I can replicate this on the test server, but I suspect windy and tkd are right. I wouldn't be surprised if the turn calculation is always slightly wrong since it is linear and doesn't take changing costs over time into account, which is particularly bad for indies, for example.

we had this problem when coding the npcs, our solution was to only use the turn predictor for small numbers of turns (it seems reasonably accurate for cashers over <20 turns, less for indies).
<=holbs-.. ..-holbs=> <=holbs-..