Author Topic: Question about debt  (Read 6545 times)

Offline gaben

  • Squaddie
  • *
  • Posts: 1
    • View Profile
Question about debt
« on: November 08, 2016, 12:42:07 pm »

From the ufopedia wiki:

"If you are in debt over $1 million at the end of any month, after funding and maintenance has been calculated, the council will give you a warning. The warning they give about not going over $2 million in debt should presumably read $1 million. The 2nd time you are over $1 million in debt, the project is cancelled. "


Is is it 1 or 2 million in OpenXcom? Also does it have to be consecutive months?

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Question about debt
« Reply #1 on: November 08, 2016, 03:41:32 pm »
From looking at old screenshots, the OpenXcom message is (already) about 1 million
The "game over" condition involves two consecutive months.
However, the message doesn't say anything about why you lose the game, I really don't like it :
https://openxcom.org/forum/index.php/topic,1994.msg18916.html#msg18916

Offline Hobbes

  • Commander
  • *****
  • Posts: 2101
  • Infiltration subroutine in progress
    • View Profile
Re: Question about debt
« Reply #2 on: November 08, 2016, 03:46:44 pm »
Is is it 1 or 2 million in OpenXcom? Also does it have to be consecutive months?

It is 1 million like vanilla. It does not need to be consecutive months.

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Question about debt
« Reply #3 on: November 08, 2016, 05:10:09 pm »
Sorry to disagree, but I checked the source and the "warn" flag gets reset if you end a month without debt.
https://github.com/SupSuper/OpenXcom/blob/master/src/Geoscape/MonthlyReportState.cpp
Code: [Select]
_game->getSavedGame()->setWarned(false);
For the curious, the debt threshold is in difficulty.rul, "defeatFunds". The translated message STR_COUNCIL_REDUCE_DEBTS should always be synchronized to refer to the same amount.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8615
    • View Profile
Re: Question about debt
« Reply #4 on: November 08, 2016, 05:23:10 pm »
It is 1 million like vanilla. It does not need to be consecutive months.

We have been through this question twice already. It DOES need to be 2 consecutive moths.

https://openxcom.org/forum/index.php/topic,4865.msg70553.html#msg70553

Offline Hobbes

  • Commander
  • *****
  • Posts: 2101
  • Infiltration subroutine in progress
    • View Profile
Re: Question about debt
« Reply #5 on: November 08, 2016, 05:48:19 pm »
We have been through this question twice already. It DOES need to be 2 consecutive moths.

https://openxcom.org/forum/index.php/topic,4865.msg70553.html#msg70553

This is incorrect - check the attached save game that shows that it does not need to be 2 consecutive months, originally posted on this thread.

On this campaign the first debt default happens at the end of April, and the 2nd default, which causes the game loss, happens at the end of June, where the game was saved. So both defaults were not in consecutive months.
« Last Edit: November 08, 2016, 05:53:22 pm by Hobbes »

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Question about debt
« Reply #6 on: November 08, 2016, 06:47:02 pm »
Well, I don't have an explanation. This savegame has the flag warned:true, which should only be set if "the previous month had a warning". The piece of code which resets the warning was already there in sources 1.0, so it doesn't seem to be a rule which has changed recently.
Maybe there WAS a warning in the previous month, and we don't see it because the graph data from the save game doesn't faithfully represent the start-of-month funds ? Or the way of storing or interpreting graphs and funds has changed ?

In fact I don't even understand the screenshot with the circled numbers :
Income 9 973 000
Maintenance 13 003 000
Balance -3 812 698
--> I would assume Balance is Previous funds + Income - Maintenance. But this way I get previous funds -782698. The only way I know to get negative funds is to begin a month with a debt, and if you played an entire month with negative money, you would notice.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8615
    • View Profile
Re: Question about debt
« Reply #7 on: November 08, 2016, 07:05:00 pm »
Either somebody messed with the save, or the warning did come and they don't remember it.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Question about debt
« Reply #8 on: November 08, 2016, 08:07:52 pm »
Well, I don't have an explanation. This savegame has the flag warned:true, which should only be set if "the previous month had a warning". The piece of code which resets the warning was already there in sources 1.0, so it doesn't seem to be a rule which has changed recently.
Maybe there WAS a warning in the previous month, and we don't see it because the graph data from the save game doesn't faithfully represent the start-of-month funds ? Or the way of storing or interpreting graphs and funds has changed ?

In fact I don't even understand the screenshot with the circled numbers :
Income 9 973 000
Maintenance 13 003 000
Balance -3 812 698
--> I would assume Balance is Previous funds + Income - Maintenance. But this way I get previous funds -782698. The only way I know to get negative funds is to begin a month with a debt, and if you played an entire month with negative money, you would notice.

The end of month page is super confusing. It shows:
- Income (Income Change): The income you will make next month and in parenthesis is how much more/less income that number is compared to how much you made this month
- Maintenance: The maintenance cost you are paying right now
- Balance: How much money you are left with right after doing the money calculation

Where
Balance = Current Funds (at 11:59:59 999 pm) + This Month's Income - This Month's Maintenance
Balance = Current Funds + Next Month's Income - This Month's Income Change - This Month's Maintenance

Indeed, going by the screenshot, you get:
Balance = - 3 812 698
 = Current Funds (from save): 467 802
 + Next Month's Income: 9 973 000
 - This Month's change: 1 175 000
 - This Month's Maintenance: 13 003 000
 = 467 802 + 9 973 000 - 1 175 000 - 13 003 000
 = 3 737 198

Which is off by 75 500, likely the impact of manufacturing on his current funds between the time the save was written and the actual end of month.

It would be MUCH more informative to get:
- Income (Income Change): How much money you made NOW, with how much more you will make next month in parenthesis
- Maintenance: How much you are spending now
- Balance: How much money you are left with right now

Which is essentially the same information (next month income is simply the income displayed + the income change, rather than doing it backwards and having to calculate current income from next month's income - the income change), but presented in such a way that all the numbers are about right now: Income you just made, Income change you just got awarded, Maintenance you just paid, Balance you currently have; instead of having the one odd income number that's about next month.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2101
  • Infiltration subroutine in progress
    • View Profile
Re: Question about debt
« Reply #9 on: November 08, 2016, 09:35:08 pm »
Well, I don't have an explanation. This savegame has the flag warned:true, which should only be set if "the previous month had a warning". The piece of code which resets the warning was already there in sources 1.0, so it doesn't seem to be a rule which has changed recently.
Maybe there WAS a warning in the previous month, and we don't see it because the graph data from the save game doesn't faithfully represent the start-of-month funds ? Or the way of storing or interpreting graphs and funds has changed ?

Either somebody messed with the save, or the warning did come and they don't remember it.

Doesn't matter if the save game file was edited. What matters is what the engine does with the existing data present on the file regarding funding and warnings:

Code: [Select]
funds:
  - 2381916
  - 2338670
  - 2483233
  - 491021
  - -1139208
  - 467802

Where -1139208 is the credits balance on May 1st after April was processed and where the player got the debt warning. On June 1st, the balance was positive, or 467802, so the game continues. On July 1st the credits balance is negative again like May 1st, and the engine checks that the player has been already warned so it decides it is game over, just like vanilla. 

This is empirical evidence guys so maybe you're both misinterpreting the code :)
« Last Edit: November 08, 2016, 09:53:24 pm by Hobbes »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Question about debt
« Reply #10 on: November 08, 2016, 10:16:38 pm »
This is empirical evidence guys so maybe you're both misinterpreting the code :)

Actually, I think you're misinterpreting the save... Having "empirical evidence" is not a guarantee of having reached the right conclusions. What is shown are:

Code: [Select]
funds:
  - 2381916 <- Total at the beginning of 2nd Month
  - 2338670 <- Total at the beginning of 3rd Month
  - 2483233 <- Total at the beginning of 4th Month
  - 491021 <- Total at the beginning of 5th Month
  - -1139208 <- Total at the beginning of 6th Month
  - 467802 <- Current Funds

The last entry is current funds and the previous (the negative one) is the total at the beginning of this month. If you end this month with a negative value, that's two in a row with negative money, you're out. See the saves attached for more details (missing #6 because you can only have 5 attachments, but that's not really needed any ways). Here I did a quick run where:

1 - Start a new game, build your base and save. Look for "funds" and you'll see just the one number: The current funds
2 - Buy whatever, save. Look for "funds", still just the one number: The current funds
3 - Fast forward to the month review screen, save. Now you have two numbers and they're the same: both your current funds. First number is "total at the start of Month 2", 2nd is current funds.
4 - Buy whatever, save. Two numbers: First number is "total at the start of Month 2" (same as before), 2nd is current funds (now much lower).
5 - Fast forward to the month 3 screen, save. 3 Numbers: "total at the start of Month 2" (still same as in #3 and #4), "total at the start of Month 3" and current funds. The last two are the same, obviously
6 - Buy whatever, save. 3 Numbers, the totals after months 2 and 3 and your current funds.

From that, we see that there was indeed a negative total last month, -1139208, and that the current funds are 467802. This works with the end of month recalculation that I did above.

So the "game ends on 2 consecutive negative months" argument is indeed right in this case. Move the negative number a few lines higher (not sure if you have to change the "warning: true" to "warning: false" as well, probably) to make the game continue.
« Last Edit: November 08, 2016, 10:22:43 pm by Arthanor »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2101
  • Infiltration subroutine in progress
    • View Profile
Re: Question about debt
« Reply #11 on: November 08, 2016, 10:56:45 pm »
I stand corrected, OXC is different from vanilla:

Quote
[20:52] <Hobbes__> Warboy, so OXC works as vanilla in that regard?
[20:52] <@Warboy> hell no
[20:52] <@Warboy> we reset the flag
[20:53] <@Warboy> if you have a month without debt

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2159
    • View Profile
Re: Question about debt
« Reply #12 on: November 10, 2016, 10:29:22 pm »
It would be MUCH more informative to get:
- Income (Income Change): How much money you made NOW, with how much more you will make next month in parenthesis
- Maintenance: How much you are spending now
- Balance: How much money you are left with right now

Which is essentially the same information (next month income is simply the income displayed + the income change, rather than doing it backwards and having to calculate current income from next month's income - the income change), but presented in such a way that all the numbers are about right now: Income you just made, Income change you just got awarded, Maintenance you just paid, Balance you currently have; instead of having the one odd income number that's about next month.
I disagree, I think it's more important for the numbers to be consistent between screens than trying to give you a spreadsheet breakdown of all the math. After all it's the game's job to do the math, which might not even be accurately reproducible since vanilla fudges the numbers (not sure if we do that in OpenXcom).
The point of showing you the numbers is just so you can tell "balance negative = bad. maintenance > income = bad". I'll probably change the message for funding game over as well. If people still get confused after 2.0 I will add a big loud flashing siren when you're on course for losing on the last week of the month. :P

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Question about debt
« Reply #13 on: November 11, 2016, 02:32:53 am »
Fair enough, the current way is better in the "Next month income will be X, my maintenance is Y, so I better make sure to have at least Y-X money at the end of next month", so it's good for planning, it's just confusing as a diagnosis: why is balance not equal to current money + income - maintenance?!

I guess the easy fix would be to find the string that says income there, and change it to say "Next income".. then that page works as a basis to make your financial plan for the next month.