[Patch] More realistic loans system [Update: r14536]

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

[Patch] More realistic loans system [Update: r14536]

Post by PhilSophus » 09 Feb 2008 23:45

This patch makes the handling of loans and the interest payed for them a bit more realistic. It makes your maximum loan dependent on company value and makes the interest rate you pay depending on how much of your credit line you have utilized.

The patch is controlled by three difficulty settings:
  1. The initial interest setting is changed to a minimum interest setting. This interest is applied if your loan is low compared to your maximum loan. The default is the same as before. The maximum was raised to 5%.
  2. The maximum interest setting controls how much interest you pay if you have your maximum loan taken. For loans between 0 and max. loan the interest rate is calculated linearly between minimum and maximum. The default value is the same as the minimum value. The maximum value is 15%.
  3. The maximum loan in percentage of company value allows you to take a higher loan if your company value is high. However, if your company value is low you can always at least take the loan based on the traditional initial loan setting plus inflation (i.e. your maximum loan is at least as much as it was without the patch). The default value is 0%. The maximum value is 90%.
Notes:
  • The default values are selected so, that the patch does not have any effect unless you change them.
  • Minimum and maximum interest rate settings are coupled in a way to enforce that the maximum is never lower than the minimum. Thus, setting one of the two settings may change the other one (this is visible in the GUI).
  • The maximum loan is updated quarterly.
  • The settings are locked during game play and can only be selected in the difficulty settings before starting a game.
I hope, you will find this patch useful.

Example:

Relevant difficulty settings:

Initial loan: €400,000
Minimum interest: 5%
Maximum interest: 15%
Maximum loan: 50% of company value

Your current state:

Company value: €2 (you just started).
Current loan: €200,000
Maximum loan; €400,000 (patch does not take effect as your company value is low)
Current rate: 10% (as you have 50% of your credit line exhausted)

Later state:

Company value: €19,999,200
Current loan: €200,000
Maximum loan; €9,900,000 (i.e. 50% of company value rounded down)
Current rate: 5% (you have only used 2% of your credit line, so you pay the minimum interest)

Updates:
  • r12098: Now includes Gonozal_VIII's resizing of the difficulty settings dialog.
  • r12104: <SHIFT>-click on increase or decrease loan button now changes amount (*10)
  • r12149: Now borrow/pay-back maximum amount possible if selected value is too high and savegame bump in trunk
  • r12164: Another savegame bump in trunk
  • r12187:
    • The changing of loan amount is now done by buttons (<SHIFT>-click no longer works)
    • The amounts for borrow and repay can now changed separately.
    • The amounts can be changed to max. which has the same effect as <CTRL>-click
  • r12364: Some savegame bumps have gone by
  • r12795: Update to current trunk
  • r12841:
    • Changed language files to match english.txt
    • Insert some casts which hopefully avoids a bug in VC++ Express 2005
    • And a savegame bump again
  • r14536: Update to current trunk
Attachments
improved_loans_r14536M.patch
(85.02 KiB) Downloaded 290 times
Last edited by PhilSophus on 26 Oct 2008 11:47, edited 14 times in total.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

Gonozal_VIII
Traffic Manager
Traffic Manager
Posts: 165
Joined: 03 Dec 2007 15:06

Re: [Patch] More realistic loans system

Post by Gonozal_VIII » 10 Feb 2008 01:10

nice idea, difficulty settings window is a bit too small, i resized it :-)
Attachments
improved_loans_r12096.patch
(20.06 KiB) Downloaded 222 times

User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: [Patch] More realistic loans system

Post by Bilbo » 10 Feb 2008 03:07

Very good idea, now even relatively wealthy companies could still loan some money for large constructions, so the loan would be more than just help with start. This will help a bit the economics (and help to bankrupt bad players that carelessly make huge debts sooner :)

Just one note: currently you can repay or borrow by small steps (10K pounds) or with ctrl do "borrow/repay max at once". But once you have some wealthy company (say, 500M pounds value), allowing to borrow 250M pounds and you want, say, borrow 60M. But - if you click ctrl + borrow, then borrowing 50% is too much, especially with high interests. And borrowing by ordinary clicks ... you need 6000 clicks. You'll need some automated clicking program or otherwise you end up with RSI :)

I guess the GUI would need a bit tweaking too, as with the new system you will much more often want to borrow some value "in the middle of the range".

One possible solution: Add some two extra (small) buttons to the finance windows that will increase/decrease the amount. You click the "plus" button and the amount increase 10s times (from load/repay 10K to loan/repay 100K), and then second button which will decrease 10 times. This way you set reasonable step (like 10M) and then borrow what you want with just a few clicks (3 clicks to change magnitude and 6 click to get money in the above example)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: [Patch] More realistic loans system

Post by DaleStan » 10 Feb 2008 05:24

Bilbo wrote:Just one note: currently you can repay or borrow by small steps (10K pounds) or with ctrl do "borrow/repay max at once". But once you have some wealthy company (say, 500M pounds value), allowing to borrow 250M pounds and you want, say, borrow 60M. But - if you click ctrl + borrow, then borrowing 50% is too much, especially with high interests. And borrowing by ordinary clicks ... you need 6000 clicks.
Then borrow max, spend what you need, and repay the rest; you shouldn't lose more than 100k that way, and if you're borrowing 60M, you can afford 100k.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system

Post by PhilSophus » 10 Feb 2008 12:23

Gonozal_VIII wrote:nice idea, difficulty settings window is a bit too small, i resized it :-)
Thanks. I noticed it also, but was too lazy to care for it, as it was still in the window :) I put your version (updated to 12098) into the first post to avoid confusion.
Bilbo wrote:Just one note: currently you can repay or borrow by small steps (10K pounds) or with ctrl do "borrow/repay max at once". But once you have some wealthy company (say, 500M pounds value), allowing to borrow 250M pounds and you want, say, borrow 60M. But - if you click ctrl + borrow, then borrowing 50% is too much, especially with high interests. And borrowing by ordinary clicks ... you need 6000 clicks. You'll need some automated clicking program or otherwise you end up with RSI :)

I guess the GUI would need a bit tweaking too, as with the new system you will much more often want to borrow some value "in the middle of the range".

One possible solution: Add some two extra (small) buttons to the finance windows that will increase/decrease the amount. You click the "plus" button and the amount increase 10s times (from load/repay 10K to loan/repay 100K), and then second button which will decrease 10 times. This way you set reasonable step (like 10M) and then borrow what you want with just a few clicks (3 clicks to change magnitude and 6 click to get money in the above example)
DaleStan wrote:Then borrow max, spend what you need, and repay the rest; you shouldn't lose more than 100k that way, and if you're borrowing 60M, you can afford 100k.
Well, even without the patch I did it this way, as the steps were to small, but I agree with Bilbo that this is sub-optimal. The best solution would be to have separate buttons for different powers of 10, like 100k, 1M, etc. An easier solution would be to just define <Ctrl>-<Click> as 1M. Or one could scale it according to the maximum loan, so that it is at most 10% of it for higher value (so max(1M, 10% of max.loan)).

On the other hand, I don't expect anyone having above 60M to still need loans. For me the patch should bridge the relatively early part (maybe after 10 years), where you already have made some money and can't be called poor anymore, but are still struggling because of expensive vehicles form NewGRF sets, etc. So, I think steps of 1M just might be enough.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

User avatar
FooBar
Tycoon
Tycoon
Posts: 6559
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [Patch] More realistic loans system

Post by FooBar » 10 Feb 2008 12:46

Nice patch!

I have an idea for the ctrl loan issue: how about a window which allows you to type in the amount you want to loan, similar to the windows that allow you to type in a numeric value in the patch settings.

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system

Post by PhilSophus » 10 Feb 2008 12:59

FooBar wrote:Nice patch!

I have an idea for the ctrl loan issue: how about a window which allows you to type in the amount you want to loan, similar to the windows that allow you to type in a numeric value in the patch settings.
Or maybe just make it a (client-side) patch setting, so that you can increase it in later game. I'll think it over a bit, while I'm taking a long walk. Great weather here in Berlin :D
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

AndiK
Engineer
Engineer
Posts: 53
Joined: 07 Dec 2004 18:34
Location: Grafing bei München (Munich)
Contact:

Re: [Patch] More realistic loans system

Post by AndiK » 10 Feb 2008 16:15

I've got another idea:
Maybe some of you know the more recent SimCity games and their loan system.
For those who don't:
You take on a certain amout of loan and automatically pay it back in fixed monthly rates including interest. If you need more money, you take out another loan that works completely independent from the other.
The player's choice would then be how much he wants to loan and how long it should take to pay it back. Interest could be calculated like above.

For me, this would make the game more interesting, because you have to think twice before taking out a loan.

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system

Post by PhilSophus » 10 Feb 2008 16:54

AndiK wrote:You take on a certain amout of loan and automatically pay it back in fixed monthly rates including interest. If you need more money, you take out another loan that works completely independent from the other.
The player's choice would then be how much he wants to loan and how long it should take to pay it back. Interest could be calculated like above.

For me, this would make the game more interesting, because you have to think twice before taking out a loan.
I didn't think about this system. However, what I considered was the system used in Railroad Tycoon 2. You issue individual bonds with a fixed amount and a fixed duration (you pay back the whole bond at once). Interest is fixed depending on creditworthiness (obviously based on company value and outstanding bonds) and prime rate at the time of issue. If you repay earlier you will pay a fee of 1% or 2%. The fixed interest is payed quarterly.

This system is quite interesting. However for OpenTTD being a transport game and not an economy simulation I considered it overly complicated and decided to follow the KISS principle (Keep it simple, stupid). Implementing such a system would be a lot more complicated than this patch, while not giving you that much more (so for me: too much work for too less gain).
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

AndiK
Engineer
Engineer
Posts: 53
Joined: 07 Dec 2004 18:34
Location: Grafing bei München (Munich)
Contact:

Re: [Patch] More realistic loans system

Post by AndiK » 10 Feb 2008 18:44

so for me: too much work for too less gain
Yeah, you're probably right. After some time, money becomes irrelevant, anyway. So, keep the patch the way it is and we're all content. 8)

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system [Update: r12104]

Post by PhilSophus » 10 Feb 2008 19:07

A little update: Pressing <SHIFT> while pushing the increase or repay loan button now changes the amount you can get/repay. Each click multiplies the amount by 10 until it would exceed both the loan you can take and you can repay. In this case it is reset to the default (GBP 10,000 or €20,000).
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] More realistic loans system [Update: r12104]

Post by Roujin » 10 Feb 2008 19:33

shift should be reserved for telling the user what he would do if not holding shift...
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system [Update: r12104]

Post by PhilSophus » 10 Feb 2008 19:55

Roujin wrote:shift should be reserved for telling the user what he would do if not holding shift...
No, tool-tips are right-click. Normally, shift is used for cost estimation when building, but this isn't needed in dialogs.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] More realistic loans system [Update: r12104]

Post by Roujin » 11 Feb 2008 10:48

whoops, i didn't read your post properly (nor download and apply your patch..)

sorry for that
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system [Update: r12149]

Post by PhilSophus » 15 Feb 2008 19:33

Uploaded new version:
- Adopted to current trunk (savegame bump)
- If you have set a higher borrow/pay-back amount than the default but can't borrow/pay-back that much: Do not give an error message but instead borrow/pay-back the maximal amount possible. Only if nothing can be borrowed/payed-back give an error message.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: [Patch] More realistic loans system

Post by Bilbo » 16 Feb 2008 22:24

DaleStan wrote:Then borrow max, spend what you need, and repay the rest; you shouldn't lose more than 100k that way, and if you're borrowing 60M, you can afford 100k.
If you want to build large expensive complicated construction (kind of "trans-siberian railway"), then you'll lose much more than 100k during the construction, as the construction may perhaps take several game years ...
PhilSophus wrote: Well, even without the patch I did it this way, as the steps were to small, but I agree with Bilbo that this is sub-optimal. The best solution would be to have separate buttons for different powers of 10, like 100k, 1M, etc.
This will just delay the problem by few orders but will not solve it

PhilSophus wrote: On the other hand, I don't expect anyone having above 60M to still need loans.
Building industries is VERY expensive. Plus, with inflation and enough time and company entering networked game quite late, 60M will be the initial loan and barely enough to start a small route. Then even with 1G money you could still benefit from taking some loan ...
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system [Update: r12149]

Post by PhilSophus » 16 Feb 2008 23:00

Bilbo wrote:
DaleStan wrote:Then borrow max, spend what you need, and repay the rest; you shouldn't lose more than 100k that way, and if you're borrowing 60M, you can afford 100k.
If you want to build large expensive complicated construction (kind of "trans-siberian railway"), then you'll lose much more than 100k during the construction, as the construction may perhaps take several game years ...
PhilSophus wrote: Well, even without the patch I did it this way, as the steps were to small, but I agree with Bilbo that this is sub-optimal. The best solution would be to have separate buttons for different powers of 10, like 100k, 1M, etc.
This will just delay the problem by few orders but will not solve it

PhilSophus wrote: On the other hand, I don't expect anyone having above 60M to still need loans.
Building industries is VERY expensive. Plus, with inflation and enough time and company entering networked game quite late, 60M will be the initial loan and barely enough to start a small route. Then even with 1G money you could still benefit from taking some loan ...
Well, I guess you have missed several posts. The current version already addresses this issue: <SHIFT>-click cycles through different values by multiples of 10 until the maximum currently possible is reached and then back to the minimum.

What do you think of the currently implemented solution?
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: [Patch] More realistic loans system [Update: r12149]

Post by Bilbo » 17 Feb 2008 15:36

PhilSophus wrote: Well, I guess you have missed several posts. The current version already addresses this issue: <SHIFT>-click cycles through different values by multiples of 10 until the maximum currently possible is reached and then back to the minimum.

What do you think of the currently implemented solution?
Wel, it handles the issue, though slight disadvantage is that it uses yet another keyboard modifier, which could confuse newbie players (some of them even don't know that if they press CTRL they will make something bit different)
I guess most would not guess shift to do anything, especially if it is used almost exclusively for checking cost ..
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] More realistic loans system [Update: r12164]

Post by PhilSophus » 18 Feb 2008 18:12

Bilbo wrote:Wel, it handles the issue, though slight disadvantage is that it uses yet another keyboard modifier, which could confuse newbie players (some of them even don't know that if they press CTRL they will make something bit different)
I guess most would not guess shift to do anything, especially if it is used almost exclusively for checking cost ..
The only other solution I can see is to provide small - and + buttons around the take loan and repay loan buttons, but I guess that wouldn't look very good.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

nexsis
Engineer
Engineer
Posts: 12
Joined: 13 Feb 2008 20:25
Location: Terra, Mars basicly the same "takin' over TTD"

Re: [Patch] More realistic loans system [Update: r12164]

Post by nexsis » 18 Feb 2008 23:02

is there like a tax like deduction on the patch?
tha' block

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests