My patches

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

User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

My patches

Post by MagicBuzz »

I'm working on a few small patches.
Here is the list.
Last trunk sync version : r8565

French town names patch :
When playing on a huge map, there is not enougth cities. This is due to a simple limitation in the game : it doesn't know enougth cities names !
This patch will add more than 30,000 real french town names.
This patch won't alter your saved games.

http://magicsite.manga-torii.com/files/ ... cities.zip (162 KB)


Belgium town names patch :
There were no Belgium town names. It's fixed with this patch. It adds more than 2700 Belgium town names.
This patch won't alter your saved games.

http://magicsite.manga-torii.com/files/ ... cities.zip (14 KB)


Subsidies range patch :
This patch allows the player to change the range of subsidies. By default it's 70 tiles length. On huge maps, it's just not enougth, as subsidies won't never award you for longer routes. The patch allows values from 70 to 4000. Default is 70, so it just don't have to be disabled if you don't use it : just use minimum value.
It also compute dynamic subsidies duration. The more the route is long, the more the duration is big. It is up to 48 months for > 1500 length routes. It doesn't impact duration for range default value, so again, it doesn't need to be disabled.
At last, this patch fix a problem you can see with the french cities patch or any other patch that allows you to build thousands cities : you won't see any subsidies. This is due to an hardcoded limitation of tries to find a new subsidies between 2 cities or industries. This patch fix it by using a town count based value for this test : the more you have cities, the more it will try to find a route for subsidies. You shouldn't see any impact on a default game. This fix just allow the subsidies routine to work everytime. It should also slightly increase game speed on small maps (less than 100 cities) but decrease game speed for huge maps, as it could make up to 80,000 tries instead of 1,000 if you use 4000 cities by exemple.
Also, the subsidies have 50% chances to be located in a unique city (local subsidy).
If range is greater than 70 (so patch is activated) a passenger subsidy have 25% chances to be replaced by a mail subsidy.
Now, it also displays correct duration in the subsidy awarded message.
At last, for huge maps and hight range value, the game should create only passengers/mail subsidies. So I added a fix to get more change to create an industry subsidy.
This patch WILL alter you saved games because the subsidies duration must be stored in the saved game.
Thus you'll get an error message when launching the game : because of the format change, it can't load the opening screnery. So it won't load it. Ignore this problem, it doesn't impact anything on the game.

http://magicsite.manga-torii.com/files/ ... _range.zip (6 KB)


Disable accidents patch :
This patch will be usefull for people who don't want any vehicule crash anymore. It will avoid planes to crash when landing, trucks to be exploded by trains, and even safe train collisions.
This patch won't alter your saved games.

http://magicsite.manga-torii.com/files/ ... idents.zip (3 KB)


Fast aircrafts can use only big airports :
This patch prevent you giving order to a fast aircraft to land on a small airport. Take care : when using auto-replacement, the patch won't check the existing route. So if the old aircraft had a small airport in its orders and you change it to a fast aircraft, the patch won't affect the plane orders.
This patch won't alter your saved games.

http://magicsite.manga-torii.com/files/ ... rports.zip (2 KB)


Display economic changes news only for industries located in cities where player have ratings :
Included in "improved smooth economy" patch since rev 2.8 : http://www.tt-forums.net/viewtopic.php?t=14819
This patch will be usefull for people playing with big maps. As smooth economy patch generates A LOT of news messages, this patch won't display these message unless the player is rated in the city the industry belongs to. Keep in mind a city will rate a player as soon as he creates a station near a industry that belong to the city, or in the city.
By this way, you'll get warned only for economic changes that are interresting yourself.
This patch won't alter your saved games.
This patch can't be enabled of disabled. It will be always activated as I think it's a bug fix and not really an addon.

http://magicsite.manga-torii.com/files/ ... cities.zip (1 KB)


Depot not transparent :
This patch will be usefull for people who have difficults to locate their road depots in big cities. When turning building transparent, depots will remain visible.
This patch won't alter your saved games.

http://magicsite.manga-torii.com/files/ ... parent.zip (2 KB)


Always replace vehicule when it gets old :
I detected a bug in the main trunk : if you enable auto-renew vehicules when they get old, but you disable servicing nor send vehicules in depots in their orders, then they won't be replaced when getting old.
This patch will fix it.
This patch won't alter your saved games.
This patch can't be disabled as I think it's a bug fix.

http://magicsite.manga-torii.com/files/ ... if_old.zip (2 KB)


Canal buoys won't flood is built on sea leavel :
This patch fix a bug with buoys built over a canal on sea level. It won't flood the surroundy area anymore.
This patch won't alter you saved games.
This patch can't be disabled as it is a bug fix.

http://magicsite.manga-torii.com/files/ ... od_fix.zip (1 KB)


New payment system :
Currently, the game justs pay a few if the transport takes a long time, even when the distance was very long. In this case, it won't take speed in account during income computation.
Because of this, playing on a huge map is just unusefull, as you'll need to build short distance routes if you want to get some money.
That's why I'm designed this patch that changes the calculation system, but using the same rates.
For long distances and perishable goods (food, goods, livestock, mail, passengers, valuables and equivalents for each game mode), the game will calculate the income for a 20 tiles long route portion, then multiply it to fit the real route distance.
I mean, currently, we have (exemple, not real values at all) :
1 days transportation = 10 $ per unit and per tile
2 days transportation = 5 $ per unit and per tile
3 days transportation = 1 $ per unit and per tile

If the duration is more than 3 days, then it is changed to 3.
Then it multiplies this value by distance and transported quantity.
So if you send some goods at 300 km/h for a 200 days transport, you'll get less money than some goods at 80 km/h for 10 days... I think it's just not realistic for perishable goods.

When activated the patch will change rules only for some merchandises, while using the old system for others (let say : wood, coal, irons, steel, etc. won't need fast transportation, so player should not be awarded for fast transportation. but livestock, grain, passengers, mails, valuabes and goods would use the new system as speed is really important).
This patch won't alter you saved games.

http://magicsite.manga-torii.com/files/ ... system.zip (3 KB)




For people who can't compile the game, I'll try to maintain a ready to use binary version.
Here is the lastest version. Install lastest Nightly Build version, then add this patch contents according the right directories.

You'll get an error message at the opening screen because it can't load a file. It's not a bug, it's just because the savegame format changed, so the opntitle.dat file is out of date. It don't have any impact on the game.
I tried to distribute one that was up to date, but lastly, trunk changed again the savegame format, so I give up.
You can create a new one by copying a saved game in /data folder, then renaming it to "opntitle.dat".

http://magicsite.manga-torii.com/files/patch.zip (982 KB) (rev8565)
Last edited by MagicBuzz on 03 Feb 2007 22:34, edited 40 times in total.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Know issues :

Subsidies range patch :
This patch need to store a new value for subsidy struct in the savegame. I can't find out how to set up a flag allowing to load an old savegame. As a result, the opening screen is stuck because it can't load opentitle.dat.
This could be fixed by removing the savegame format modification, the re-calculate subsidy duration after loading. But I can't find how to launch a "SubsidyAfterLoading()" function.

Image

Image

Things than should be improved :

French town names & Belgium town names :

I don't like the way the town names are hardcoded in the source code.
Thus it changes binary size (more than 600 KB bigger when installing both patches). Is there a way to provide these lists as a GRF ?

Canal buoys won't flood is built on sea leavel :

The only problem with this patch is that it applies to any buoy, even for a buoy built in the middle of the water.
So you can draw a square with buoys, then clear the land, you'll get a flat island.
With the current map structure, I'm affraid there is no way to do better.

Image


New payment system :
This patch is in alpha release. It's hard to test and tune, so you may turn it off if you expercience any problem.
Last edited by MagicBuzz on 03 Feb 2007 22:35, edited 8 times in total.
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Post by athanasios »

I prefer subsidies to favor more industries belonging to the same city, than from one industry of city A to industry of city B.
Very good to allow longer range, this will be usefull especially in large maps with a few cities.
Hope to see it compiled soon and not only as diff...
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
User avatar
Expresso
Tycoon
Tycoon
Posts: 1760
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Post by Expresso »

Two things about your subsidies patch:
1) Why not change the maximum distance in a non-constant value? You could also change it in a growing value, to make sure affordable subsidies appear at the game's start. With this option you don't need the distance slider anymore imho.
2) Why not change the duration of subsidies with the distance (70 tiles would be a year, 140 two years, etc.)? This would elimenate the need for the other slider, as the duration increases with distance.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Hello,

@ Expresso >

For the first point, I understand what you say, but I can't figure wich rule I could apply. May be basing on speed of the fastest vehicule ?
PS : The distance value can be safely changed during game play. This will affect only new subsidy. Right now, I use 70 for ealy years, then double the value every ten years.

For the second point, I like the idea. I'll work on it this evening.

@ Athanasios >

You're right about making more subsidies between same city industries, that's more realistic. I'll check if there is a way to do it. But I'm not sure it's possible at all. The only way I find should take too much time, as industries and cities are picked random: the only way to favor local subsidies it to pick several industries, and check if they are owned by the same city. When playing with a lot of cities I should requiere a lot of tries that would drastically slow down the game.
User avatar
Expresso
Tycoon
Tycoon
Posts: 1760
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Post by Expresso »

MagicBuzz wrote: For the first point, I understand what you say, but I can't figure wich rule I could apply. May be basing on speed of the fastest vehicule?
I was thinking about whether a player could afford to lay a route of the distance in question, so subsidies of a too great distance don't appear.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Expresso wrote:
MagicBuzz wrote: For the first point, I understand what you say, but I can't figure wich rule I could apply. May be basing on speed of the fastest vehicule?
I was thinking about whether a player could afford to lay a route of the distance in question, so subsidies of a too great distance don't appear.
No, it's impossible because calculating construction costs between 2 points is too slow if the game try 40 000 times each month...
Thus, as long as you can use planes, as soon as you have more than 2M$ you should be able to design a route between any points of the map.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Added a new patch : disable_accidents
It is still in alpha release, as I didn't even compiled it (I'm at work right now ;))
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Disable accidents patch is ok now.
I had to fix some GUI problems because the patch options windows was too small.

Now everything is ok.

Image
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

I updated the subsidies patch :
- Now, there is 50% chance an industry subsidy will be for two industries in the same city
- If range is greater than default value (70) then an new type of subsidy appears : Mail subsidy. It's 25% chances a mail subsidy will be created instead of a passenger subsidy

I also fixed a bug in the disable_accidents patch file (only patch description, not source code).
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

Could you make the crash patch like this (for planes): http://wiki.ttdpatch.net/tiki-index.php ... %20crashes
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

I thougth about a system like thisn but how to do with the patch GUI ?

If I ask for a number the payer will nerver understand what I'm asking for.

It should be nice to propose a cursor taking these values : (using a simple binary mask) on values 000, 001, 010, 011, 100, 101 and 111 :
- all crashes
- no road veh crash
- no rail and road veh crash
- no air and road veh crash
- no air and rail vah crash
- not any crash

But I don't know how to display that.
wozzar
Transport Coordinator
Transport Coordinator
Posts: 331
Joined: 27 Dec 2002 09:25

Post by wozzar »

Where do you put the disable accident patch into.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

As said in the main post, these patch are not "ready to use binaries".

They are simple "patch" files. This means it's a source code modification you have to apply on the game source code.

Take a look at this documentation to learn how to apply a patch.
You'll need a C++ compiler and a few programmation skills.
http://www.tt-forums.net/viewtopic.php?t=21678
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

erm.... whats up with that font in the screenshot? thats not a TTD font :shock:
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

I just had to use Arial (see the 3 "font" lines in your CFG file) because my French cities names patch uses the french "œ" character, and the OTTD default font displays a "?" instead ;)
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

New patch : Fast aircrafts can use only big airports.
It will prevent you for sending fast aircrafts to a small airport. This won't affect existing routes during autoreplacement.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Update : I move the fast aircraft only use big airports in the station section as the vehicle section is quite full.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

I need some help with my subsidies_range patch.

I'm working on it to change subsidy duration according the subsidy distance.

It works fine but...

Now the current subsidies duration are decremented randomly for 1 month times to times. It seems a subsidy duration change every year. Only subsidy at the same time is impacted. (???)

Here is my working copy patch (based on lasted source code) :
http://magicsite.manga-torii.com/files/ ... range2.zip (5 KB)

PS: When you launch the program, it can't load the opening title scenry so it will produce a warning.
It's because I changed the saveload chunk for the subsidies, then older savegame are not compatible.

All the rest of the patch works fine. And I just can't understand how this duration change can happen : I only calculate it one time, then I never write in the variable!
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

Hmmm, after some tests, it seems the bugs isn't from my code.

If I compile my old patch, that doesn't manage duration, I still get the bug.

I wonder if the bug doesn't come with the fact subsidies dates boundaries are used with 32 days length months.

After a we time, as 32 * 12 > 365.25, it would produce an offset.
It is invisible with the default 12 months duration, as 32 * 12 < 365 + 1 month.
But with subsidies for 24, 36 or 48 months, that could just produce an offset...

I'll investigate in this direction...
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests