Max Loan amount not sending over to other clients during multiplayer

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
djsider
Engineer
Engineer
Posts: 14
Joined: 09 Jan 2009 03:27

Max Loan amount not sending over to other clients during multiplayer

Post by djsider »

Hi all,

I'm wondering if this is a bug or not with the way this setting is handled during multiplayer. We run with some pretty expensive trainset (2cc) and a pretty advanced start (1975) so the default max loan is not enough to get a good foundation going. It would take a few years of basically watching 1 train go back n forth.

I run the server and we decided we would set the max loan to be 3 times what is currently available. Changed the setting.ini MAX from 500000 to 1500000. Started a new game, and when the other client connects, they are unable to take out up to the max loan to start building up their empire. Is this considered a bug? Where can I look to see how the settings.ini values and the game settings are supposed to be passed over to other clients?

User avatar
jfs
Tycoon
Tycoon
Posts: 1245
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Max Loan amount not sending over to other clients during multiplayer

Post by jfs »

The maximum value for max_loan is defined to be 500k in the settings template (table definition):

Code: Select all

[SDT_VAR]
base     = GameSettings
var      = difficulty.max_loan
type     = SLE_UINT32
from     = SLV_97
guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO | SGF_CURRENCY
def      = 300000
min      = 100000
max      = 500000
interval = 50000
str      = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN
strhelp  = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT
strval   = STR_JUST_CURRENCY_LONG
cat      = SC_BASIC
If you set it to a value outside the valid range, the value just gets clamped to the valid range. So even though you wrote 1500000 in settings.ini, when the game loads the settings it sees the out-of-range value and changes it back to the allowed maximum of 500000, and that's what gets used during the game.

djsider
Engineer
Engineer
Posts: 14
Joined: 09 Jan 2009 03:27

Re: Max Loan amount not sending over to other clients during multiplayer

Post by djsider »

I think you’re thinking about the value in OpenTTD.cfg which is what the current in game settings will modify.

First, I changed the settings.ini version and then went in game to set the max loan to the max defined in settings.ini. This works fine and as expected. I’m able to take out the big loan at the beginning of game.

The only issue was that clients joining my multiplayer game did not have the same max loan amount. I had to ship them the compiled exe and then they were able to take that loan amount out.

Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Max Loan amount not sending over to other clients during multiplayer

Post by Yexo »

djsider wrote:
29 May 2020 15:56
I had to ship them the compiled exe and then they were able to take that loan amount out.
That's working as intended. Unless you're very careful with the changes you make, most source-code changes will make the server incompatible with clients unless they have exactly the same changes applied. In this case the effect was luckily quickly visible, other times you might simply get desyncs.

djsider
Engineer
Engineer
Posts: 14
Joined: 09 Jan 2009 03:27

Re: Max Loan amount not sending over to other clients during multiplayer

Post by djsider »

So the checks for loan and possibly other settings are not sent to server for checking? I was surprised that the save game that was transferred to other clients did not get the same ‘in-game’ settings. Or was it just double checking against the client’s own version of settings.ini and not trusting the one from game save?

User avatar
jfs
Tycoon
Tycoon
Posts: 1245
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Max Loan amount not sending over to other clients during multiplayer

Post by jfs »

Server and client need to be running the exact same game logic for multiplayer to possibly work, and this includes all limits for game settings. Every client also cross-checking settings changes when receiving a command for them is just common sense to avoid potential loopholes for cheating/hacking.

djsider
Engineer
Engineer
Posts: 14
Joined: 09 Jan 2009 03:27

Re: Max Loan amount not sending over to other clients during multiplayer

Post by djsider »

I'm not sure this is considered cheating or hacking. This is the server trying to change the max limit on a setting. If you were a client joining this server, shouldn't it just take the server and game settings as the truth? Everyone would be running the exact same settings in this case.

Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Max Loan amount not sending over to other clients during multiplayer

Post by Yexo »

djsider wrote:
31 May 2020 20:35
I'm not sure this is considered cheating or hacking. This is the server trying to change the max limit on a setting. If you were a client joining this server, shouldn't it just take the server and game settings as the truth? Everyone would be running the exact same settings in this case.
And it does exactly that. Clients that call settings from the savegame it gets from the server upon joining.

Limits however are not settings. Limits are mostly hardcoded into the gamecode itself. There is no reason to send such hardcoded values over the network at all, since a basic assumption for OpenTTD networking is that both the server and all clients have been built from the same source code, and as such have the same limits.

Eddi
Tycoon
Tycoon
Posts: 7506
Joined: 17 Jan 2007 00:14

Re: Max Loan amount not sending over to other clients during multiplayer

Post by Eddi »

djsider wrote:
31 May 2020 20:35
I'm not sure this is considered cheating or hacking.
yes, it definitely is.

if you change any code (including settings.ini) you must mark your version as modified (by the license requirements) and give this changed version to all other players that want to play on the server.
You might not exactly be interested in Ferion, but if you are, have fun :)

djsider
Engineer
Engineer
Posts: 14
Joined: 09 Jan 2009 03:27

Re: Max Loan amount not sending over to other clients during multiplayer

Post by djsider »

Please keep in mind it’s not cheating because all the players in my game want to have bigger seed money. We just want the option to change the setting on the server and see it as a bug that other clients don’t get the server values.

So what we are saying is that limits superceed settings, even if the save game will give the same option for all players in that game. I personally find this weird since it should only be server choice. The limits should only be applied when starting the game.

Is there a reason it checks limits during the game when the setting itself should be sufficient?

djsider
Engineer
Engineer
Posts: 14
Joined: 09 Jan 2009 03:27

Re: Max Loan amount not sending over to other clients during multiplayer

Post by djsider »

Also want to get my terminology checked. This seems like what they should be but some of you are telling me limits has more to do than just controlling the values settings can be during there settings page.

Limit: values that dictate what the per game settings can be set to. Ex: min-200 max-1000

Settings: what is actually being used in the save game. Every player will share the same settings in the game.

Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: Google [Bot] and 14 guests