Patch: Maximum Subsidy Distance

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

wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Maximum Subsidy Distance

Post by wleader »

Oh, I know how to do a square root the hard way, but I am pretty sure that this is not 1957; I should not have to write my own math functions, and even if that was appropriate, its a task better handled by a computer scientist. I am certain that I could not make as good a square root function as one that already exists.

I suspect that there is another function that does square roots that belugas would be happy with, but I just don't know what it is. Google only seems to tell me to use cmath. I was hoping belugas or someone else infinitely more familiar with C++ and the openttd code would just say use the square root function in foo.h and be done with it.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Patch: Maximum Subsidy Distance

Post by Rubidium »

Instead of using sqrt(MapSize) you could average MapSizeX and MapSizeY (maybe weighted); doesn't give the exact same result but should give something reasonably close I reckon.

As Belugas tried to mention earlier: floats (can) cause desyncs, thus no chance they'll get included in the main logic used in network games.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Maximum Subsidy Distance

Post by DaleStan »

Or square the distance instead of square-rooting the map area.
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
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Maximum Subsidy Distance

Post by wleader »

Rubidium wrote: As Belugas tried to mention earlier: floats (can) cause desyncs, thus no chance they'll get included in the main logic used in network games.
This is the piece of information I was missing.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Maximum Subsidy Distance

Post by Terkhen »

2007Alain2007 list of patches brought this patch to my knowledge, and it is something I felt as needed for a long time. I have downloaded the latest version of the patch and updated it to current trunk. To solve the possible desyncs problem I made a quick-and-dirty integer square root function and changed all floats to integer divisions, but maybe there's a better solution. Also, I don't know where to put the IntegerSquareRoot function.

Here is the patch and the win32 binary: [DELETED, SEE MY NEXT POST]
Last edited by Terkhen on 14 Apr 2009 09:48, edited 1 time in total.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Maximum Subsidy Distance

Post by 2007Alain2007 »

thank you very much and great work there i add it in to my patch pack in a sec keep them comeing please
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 314
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: Patch: Maximum Subsidy Distance

Post by ColdIce »

can someone update this please? is very usefull for large maps
The rest is confetti!
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Maximum Subsidy Distance

Post by Terkhen »

After playing a few games with this patch in big maps, I see that subsidies between very distant places are too common. I think that it would be better that the probability of a subsidy decreased with the distance between two industries / towns. I can do it if there's more people who think the same as me.

Here's a version updated to trunk, with both a diff and a win32 binary:
Attachments
max-subsidy-distance-r16049.diff
(4.7 KiB) Downloaded 107 times
max-subsidy-distance-r16049.rar
(2.9 MiB) Downloaded 102 times
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Maximum Subsidy Distance

Post by 2007Alain2007 »

Hi Terkhen

would that make it less common for long distance

Becuse at the start of game you want only a short Subsidy but as your money grows you can go for longer Subsidy

Also with network games were have more of a mix for new players joining and players that have been on the game for some years

Is that what this will
For Community Integrated Version http://code.google.com/p/civopenttd/
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Maximum Subsidy Distance

Post by Terkhen »

I don't understand completely what you are suggesting / asking, 2007Alain2007. Anyways subsidy distance should't change as the game progresses. IMO subsidies are meant to be a way to help new companies, and they shouldn't change to help established companies.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Maximum Subsidy Distance

Post by 2007Alain2007 »

I know but on big maps a mix of long and short not just all long or all short

with this patch they seem all long

with out this patch there all short
For Community Integrated Version http://code.google.com/p/civopenttd/
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: Maximum Subsidy Distance

Post by Terkhen »

That's the problem I explained when I posted the last version. Anyways after playing a long time without this patch I think that normal distance is enough for young companies to start making money, even in really big maps. Long subsidies are only useful to companies that have the cash to make them, and they prefer to do routes that are more profitable in the long run anyways.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Patch: Maximum Subsidy Distance

Post by 2007Alain2007 »

thats what i like to see so there are some subs big companies as well
For Community Integrated Version http://code.google.com/p/civopenttd/
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest