[Patch] Daylength, Cargodist with sprinkles

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

Post Reply
User avatar
SpComb
Tycoon
Tycoon
Posts: 1109
Joined: 13 Nov 2003 20:26
Location: Finland
Contact:

[Patch] Daylength, Cargodist with sprinkles

Post by SpComb »

This is a collection of small patches intended to be used in conjunction with cargodist.

The most significant change is the introduction of an adjustable DAY_TICKS value (along with some related tweaks), and the possibility to scale down the passenger/mail amounts generated by towns.

The combined builds here additionally contain the timetable-based vehicle autoseparation patche(s).


Windows binaries:
There are combined win32 builds/binaries (with cargodist and autosep) to be found in this thread. The most recent version is found at the end of the topic:

--> openttd-cargodist-sprinkles-r19964-win32 <--

Please report any and all crashes from this build in this thread. See the per-build post for more specific notes.



Variable daylength: This patch lets you adjust Economy >> Day length factor to linearly increase the number of ticks in a day. Most visibly, this will increase the amount of real-time it takes for the game-time to tick forward into the next day. If you are playing with a factor of 4x, then in the time that it takes you to play from 1921 to, say, 1935 (the golden era of DBSetXL steam), you would normally already be in 1977, wondering when you're going to have the time to replace all those 40-year-old steam engines...

After that, things get more complicated. Changing the daylength causes different things to behave differently.
Town growth, Industry production, Town passenger/mail generation, Cargo payment (by duration transported), your profit - stay the same in real-time.
Running costs, Servicing intervals - stay the same in game-time.
Others - unknown.

The towngrowthfreq patch ties the town growth rate to the daylength. The goal here is that the towns will grow the same amount per given game-time (and hence more slowly in real-time). The towns growing too fast (i.e. at the same real-time rate) was my only major issue so far - you're in 1925, only have the BR38 and tiny pre-war coaches - and your towns have 8k pop and more passengers than you can handle. The adjustment is kind of crude, so the towns may actually grow slightly more slowly overall. This requires some more work.

The autofill-roundoff patch separates the timetable autofill roundoff interval from the daylength setting, having it use the same roundoff interval as trunk (74 ticks). This means that you'll no longer get ~10s wait times at each station when using timetable autofill at 4x daylength. Instead, you're more likely to get wait times that display as "0 days" in the GUI - I suggest you change Interface >> Show timetable in ticks rather than days to compensate. Fixing the timetable GUI to display fractional days is beyond the scope of this patch.

These trivial patches (~10 LOC) provide a usable and enjoyable increased-daylength gameplay experience for me. At the default settings, they do not influence the gameplay at all.




Adjust town passenger/cargo rates: This patch lets you adjust the amount of cargo (pax/mail) generated by a town using Economy >> Towns >> Town cargo generation factor. With the default value of 0, amounts remain unchanged. Set it to a negative number to decrease town cargo, or a positive number to increase it. Adjust carefully.

When playing with cargodist (or cargodest), you end up with a far higher load on your vehicles (due to passengers not getting off at stations along the way), and usually with large cities, one finds it impossible to sanely transport enough passengers to keep the stations from continuously overflowing.

This patch aims to resolve that by applying an exponential function to reduce the number of passengers and mail generated by town houses. The function is approximately amount = amount × 2^cf, where cf is an adjustable parameter. For negative cf values, this is equal to amount = amount / 2^–cf, and hence reduces the amount of cargo. I suggest a value of -1x to provide some relief, or a value of -2x if your aim is to keep your stations from filling up, and your trains less than 100% full.

The actual calculation is slightly different to adjust for integer math. Since this is calculated per-house, and the production will never drop to zero, the actual aggregate town production is slightly higher. There is a minimum limit on a town's pax/mail generation rate that is approximately equal to the number of house-tiles in the town. Referr to this table of values to see how the function behaves.



Daily autosave:
This patch implements a daily autosave loop in addition to the normal monthly autosave loop, and provides "daily" and "weekly" autosave options in addition to the previous monthly ones. This was adapted from a similar feature in an earlier daylength patch, and is intended as a quick fix for the daylength/autosave issue, although better solutions may exist...



Vehicle name length: This trivial patch raises the effective limit on vehicle names from 150px to 250px, or 30 bytes, whichever is greater. Note that long vehicle names with wide glyphs may cause the vehicle window to stretch.



Aggregate Patches (outdated; r18913): Patches are simple enough that they should apply against a wide range of trunk versions. Patches do not modify gameplay when at default values. All standard daylength disclaimers apply. No guarantees about savegame compatibility.
Last edited by SpComb on 05 Jul 2010 06:36, edited 22 times in total.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

Outdated, see http://www.tt-forums.net/viewtopic.php?p=843125#p843125

Hey,
I just moved this post from the CargoDist thread over to here. It is a compiled (mini-pack) of the patches. Built on MSVC for win32. Have fun!

Contains:
  • CargoDist
  • Varible DayLength
  • Town Growth Frequency
  • Town Cargo Factor
Disclaimer:
If the CargoDist Mini-Pack crashes, do not report it to the OpenTTD developers. Report it to this thread. When making your post about the crash, please upload the crash.dmp, crash.log, crash.sav, and crash.png (only available as of r18184, so if you are using a build older than that, don't bother). These files are vital to finding what happened during the crash. Also note that the PDB file attached is not needed when testing the CargoDist Mini-Pack, it is mainly for developers.

Peter
Attachments
cargodist_mini-pack_r18533.diff
(238.89 KiB) Downloaded 684 times
cargodist_mini-pack_r18533.rar
(3.36 MiB) Downloaded 981 times
cargodist_mini-pack_PDB_win32_r18533.rar
(2.78 MiB) Downloaded 526 times
Last edited by petert on 31 Dec 2009 01:17, edited 1 time in total.
User avatar
Raichase
Moderizzle
Moderizzle
Posts: 11509
Joined: 15 Dec 2002 00:58
Location: Sydney, Australia. Usually at work in the underground railway station...
Contact:

Re: [Patch] Daylength, Cargodist with sprinkles

Post by Raichase »

SpComb and petert - thanks for putting the effort in to this, it certainly sounds like an interesting challenge, and a way to make large maps (as well as a lot of the early DBXL vehicles) more playable for me. Thanks for the time to put this together, I look forward to having a go!
Posted by Raichase. Visit my Flickr! Gallery, Blog (get a feed of everyone at once at Planet TT-Forums).
Raichase - Perfect timing, all the time: [13:37] * Now talking in #tycoon
ImageImage
Official TT-Dave Worley Fan Club
Official TT-Andel-in-a-pink-hat Fan Club
Jimbow
Traffic Manager
Traffic Manager
Posts: 243
Joined: 29 Sep 2006 07:28
Location: Copenhagen, Denmark

Re: [Patch] Daylength, Cargodist with sprinkles

Post by Jimbow »

Thank you very much for this build :)

It would be very interesting if it was posible to put the timetable patch in here too.

I have found a bug in this build.
Sadly I did not read what files to send back to you, but i think i can describe how the bug appered.

It appered when i had build my first line, first train and wanted to clone the train with shared orders (CTRL+clone train).
The bug did not apper when i buy just the locomotive, and then try to clone it. But if i buy one loco and some waggons, and then clone it, the game crashes.

I hope that this info is enough to help you, and I'm sorry that i do not have the files.
Maybe someone else can reproduce the bug, and then send the files to you.
If not, i will send the files to you as soon as possible.

Hope it's possible to solve this bug, because this minipack is very nice :D
User avatar
SpComb
Tycoon
Tycoon
Posts: 1109
Joined: 13 Nov 2003 20:26
Location: Finland
Contact:

Re: [Patch] Daylength, Cargodist with sprinkles

Post by SpComb »

Jimbow wrote:It appered when i had build my first line, first train and wanted to clone the train with shared orders (CTRL+clone train).
The bug did not apper when i buy just the locomotive, and then try to clone it. But if i buy one loco and some waggons, and then clone it, the game crashes.
Reproducible in vanilla trunk r18533 and r18582. I'll report it to the OpenTTD devs.

EDIT: Fixed in r18590. It'll be in the next cargodist update/build.

Reproduce: Load DBSetXL; New temperate game; Build Depot, Build BR18 + local mail + local pass; clone; crash.
Assert: src/vehicle_gui.cpp:184: byte GetBestFittingSubType(Vehicle*, Vehicle*): Assertion `HasBit(e_for->info.refit_mask, v_from->cargo_type)' failed

Stacktrace:

Code: Select all

 [07] /lib/libc.so.6(__assert_fail+0xef) [0x7f583cbc92df]
 [08] ./openttd [0x78f1d6]
 [09] ./openttd(_Z15CmdCloneVehiclej13DoCommandFlagjjPKc+0x447) [0x782dc7]
 [10] ./openttd(_Z10DoCommandPjjjjPFvbjjjEPKcb+0x413) [0x57de33]
 [11] ./openttd(_ZN11DepotWindow11OnMouseLoopEv+0xbb) [0x59e4eb]
 [12] ./openttd(_Z17HandleMouseEventsv+0x81) [0x7b0331]
 [13] ./openttd(_Z9InputLoopv+0xf0) [0x7b0eb0]
 [14] ./openttd(_Z8GameLoopv+0xad) [0x664d1d]
 [15] ./openttd(_ZN15VideoDriver_SDL8MainLoopEv+0x411) [0x795ad1]
 [16] ./openttd(_Z8ttd_mainiPPc+0xf7a) [0x665dfa]
Last edited by SpComb on 22 Dec 2009 17:38, edited 1 time in total.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

Jimbow wrote:I have found a bug in this build.
Linking to the post would be better, especially when the topic gets longer with more total posts.
Jimbow wrote:Sadly I did not read what files to send back to you, but i think i can describe how the bug appered.
Read my disclaimer in this post (http://www.tt-forums.net/viewtopic.php?p=842067#p842067). Basically you need crash.dmp, crash.log, crash.png, and crash.sav (created when you press Emergency Save at the crash window). The crash window should tell you the location of these files.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

Do people want individual binaries for each patch? Should I get them here?
Creat
Traffic Manager
Traffic Manager
Posts: 141
Joined: 26 Oct 2009 16:33

Re: [Patch] Daylength, Cargodist with sprinkles

Post by Creat »

petert wrote:Do people want individual binaries for each patch? Should I get them here?
Quite frankly I wouldn't bother, as both patches are gameplay-neutral in their default settings. If someone just needs one of them he/she can just leave the other settings alone to achieve the desired result.
Creating three versions every time would just more or less flood this thread (or elongate the binary-posts at the very least). If someone actually requests a separate build this would be a different story though I think (as there would be a known demand) :)
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

Outdated, see http://www.tt-forums.net/viewtopic.php?p=844800#p844800

Hello all,
I've just compiled another build with MSVC for win32 because the bug in this post was fixed (http://www.tt-forums.net/viewtopic.php?p=842199#p842199).

Disclaimer:
If the CargoDist Mini-Pack crashes, do not report it to the OpenTTD developers. Report it to this thread. When making your post about the crash, please upload the crash.dmp, crash.log, crash.sav, and crash.png (only available as of r18184, so if you are using a build older than that, don't bother). These files are vital to finding what happened during the crash. Also note that the PDB file attached is not needed when testing the CargoDist Mini-Pack, it is mainly for developers.
Attachments
cargodist_mini-pack_win32_r18625.rar
(3.38 MiB) Downloaded 610 times
cargodist_mini-pack_PDB_win32_r18625.rar
(2.85 MiB) Downloaded 522 times
cargodist_mini-pack_r18625.diff
(240.9 KiB) Downloaded 657 times
Last edited by petert on 09 Jan 2010 22:20, edited 3 times in total.
User avatar
michielh
Engineer
Engineer
Posts: 22
Joined: 29 Apr 2009 13:17
Location: NL

Re: [Patch] Daylength, Cargodist with sprinkles

Post by michielh »

First, I want to say I really appreciate your attempts to merge the cargodist and daylength patches. :bow: I've been playing OpenTTD with cargodist for a while, and I've been waiting for a version with daylength patch for a long time.

It does work great for me, but I've just had a error, and since I would like you to help with the development of the patch, I've tried to make a bug-report. I haven't done this before, so I don't know if it's usefull to you, but if you need some more files, just shout :wink:
Attachments
crash.sav
(306.09 KiB) Downloaded 599 times
crash.txt
(9.48 KiB) Downloaded 594 times
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

michielh wrote:but if you need some more files, just shout :wink:
Do you have a crash.dmp and a crash.log? If yes, could you please upload them?
Jimbow
Traffic Manager
Traffic Manager
Posts: 243
Joined: 29 Sep 2006 07:28
Location: Copenhagen, Denmark

Re: [Patch] Daylength, Cargodist with sprinkles

Post by Jimbow »

I will also like to thank all developers for this build :)

I downloaded the new build and i did not find any problems so far :D

Cargodist and the daylength patch makes the game more fun!
Great work! :D
User avatar
michielh
Engineer
Engineer
Posts: 22
Joined: 29 Apr 2009 13:17
Location: NL

Re: [Patch] Daylength, Cargodist with sprinkles

Post by michielh »

I get this message when I try to upload the dmp file: The extension dmp is not allowed. How can I solve this? :)

And I've uploaded the log file in my previous post.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: [Patch] Daylength, Cargodist with sprinkles

Post by ChillCore »

I get this message when I try to upload the dmp file: The extension dmp is not allowed. How can I solve this? :)
Solution 1: Put your files in a zip.
Solution 2: Add .txt extension and tell people to remove it after downloading.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
User avatar
SpComb
Tycoon
Tycoon
Posts: 1109
Joined: 13 Nov 2003 20:26
Location: Finland
Contact:

Re: [Patch] Daylength, Cargodist with sprinkles

Post by SpComb »

michielh wrote:First, I want to say I really appreciate your attempts to merge the cargodist and daylength patches.
Small detail for accuracy: the "daylength" patch here is actually one that I wrote myself, not some daylength patch from elsewhere.
crash.txt wrote:Assertion failed at line 1145 of ..\src\economy.cpp: v->time_counter != 0
The code here is pretty spaghetti, so it's difficult to see what causes this. It might be some kind of obscure increased-daylength related overflow - but on the other hand, it happens in code that cargodist touches. I'll have to take a closer look at it once I'm back home for new year's, but I suspect it's a cargodist bug.

Unrelated note to self: high values of pf.wait_for_pbs_path (<255) might cause overflows with high values of DAY_TICKS.
Last edited by SpComb on 27 Dec 2009 22:13, edited 1 time in total.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

ChillCore wrote:Solution 2: Add .txt extension and tell people to remove it after downloading.
The first option is far more superior, it allows all the files to be together, rather than separate, in different posts and such.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: [Patch] Daylength, Cargodist with sprinkles

Post by ChillCore »

Yes petert, but that is asuming the reporter has a zipper. (Lol, sorry.)
Solution 2 is not recommended but sometimes zipping makes files bigger. Also one may assume that reporter will place all files in one post when reporting?

Solution 3: Kindly ask Mr orudge to allow .dmp extentions.

And now back to our regular show: Daylenght, Cargodist with sprinkles ...
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: [Patch] Daylength, Cargodist with sprinkles

Post by Kogut »

Thanks for binary!
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Daylength, Cargodist with sprinkles

Post by petert »

If you don't mind SpComb^, could you please write in your main post where binaries can be obtained, either via link or at latest posts?
peebee
Engineer
Engineer
Posts: 31
Joined: 08 Feb 2008 13:02

Re: [Patch] Daylength, Cargodist with sprinkles

Post by peebee »

Any chance to see auto-seperation or anything like that in your patch pack?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests