Aberro PatchPack r27050

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
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Aberro PatchPack r27050

Post by aberro »

Build that I'm currently playing, compatible with latest trunk.

Patches:
Automated timetables v0.8, currently mostly not working, left for future fix.
Hardware cursor v1.1, my patch, makes cursor hardware acceleration (works only in Windows).
Huge cities, my micropatch, expands maximum town size in settings, so new map may be generated with really huge cities (>200k population)
More conditional orders, it's... more conditional orders.
Polyline track tool v8d, make curved tracks in two clicks.
Reduced tree growth.
Route Markers v1.1, modified version supporting both NPF and YAPF.
ShipsMovement v5, ships try to keep distance from each other and try to do not overlap on map (with exception for docks)
Day length factor.
Town cargo rates, reduces or increases quantity of passengers and mail generated by town.
Stuck trains, minimap mode that shows places where trains are stuck often.
Custom Bridge Heads, reanimated from damn hell and oblivion, but I've really wanted it to work. And I've succeeded in it, by cost of Signal Tunnel incompatibility.
Temperate snowline, variable temperate snowline height, depending on month.
The Clipboard v1.1.0, copy&paste segments of map with all structures on it.
Town Rating Labels, rating of your company are shown as colour of town name.
Trains cortege speed limit, another my patch that slows down fast trains following slow ones so that fast train won't stop on signals but follow train in front at same speed.
Vehicle Group Info, shows group overall income stats.
Custom Town Growth, my patch that changes town growth algorithm. Originally, town growth rate was depend on count of serviced stations (even if you use it to get coal from nearby mine), with upper limit 5, which is, I believe, absurd. Now towns growth rate depends on passengers&mail serviced ratio to maximum (i.e. if you serviced 500 pass. and 300 mail in past month from max. 1000 pass. and 500 mail, town will grow veeeeery slowly). Towns with passengers|mail ratio below 0.5 will not grow at all. Stations mean service level also affects town growth, so, i.e., if your stations do not cover all town (and therefore you cannot service maximum passengers), but serviced really good (~40% and more), town will grow slightly faster. If your service is below 40%, town growth rate will be reduced. With this new algorithm small towns are easier to expand that bit cities, but last ones are still grows pretty fast if serviced at good level.

Code: Select all

Version history:
v0.1:
 Initial release
v0.2:
 Fixed crush when trains enters CBH from direction different than direction of bridge.
v0.3.4
 Added CBH support for road|tram. Small fixes. YAPF have incompatibility with CBH, so avoid using it for road or rail vehicles.
v0.4.1
 Added Trains cortege speed limit patch;
 Bugfixes.
P.S. Do not ask me to give you some of updated patches diffs, I've applied them all over same build, so now it's really hard to get diffs of some patch separated from diffs of another one. If you really want to get updated patch separately from patch pack, either download pack and separate diffs or update patch by yourself.
Attachments
Aberro_PatchPack_v0.4.2_r27050.zip
Diffs
(218.2 KiB) Downloaded 80 times
bin_0.4.2.7z
Executable (win64); if you prefer other OS, you more probably may compile project by yourself.
(9.74 MiB) Downloaded 100 times
Last edited by aberro on 14 Nov 2014 07:56, edited 13 times in total.
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: Aberro PatchPack r27050

Post by Supercheese »

aberro wrote:Custom Bridge Heads, reanimated from damn hell and oblivion, but I've really wanted it to work. And I've succeeded in it, by cost of Signal Tunnel incompatibility.
You are aware that Custom Bridge Heads is implemented in cirdan's New Map Features, right?
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

Nope.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

I've looked at NMF, but it's too heavily patched compared to official trunk. It would take me too much time to add any other patch based on trunk, besides, because I'm building this pack primarily for myself and for my current game, I don't want to switch from the trunk to this fork, because a savegames are totally incompatible. Currently, debugging the old CBS is easier for me than try to get it from NMF, because NMF is almost completely different. But thanks anyway, maybe I could use something from NMF at least for debugging purposes. And actually, I've already done it just a few minutes ago, but in this case it didn't help me a lot, only sent my thoughts into right direction.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

Update. Fixed crash from CBS.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

Update is here. Now CBH are supported for roads and trams (both types are possible for same bridge head). Still, bugs and crashes are possible, so be sure to save often.
UPD.: version 0.3 was bugged and updated to 0.3.2. If someone has savegame from older version of this patchpack and want to upgrade some bridge with custom head, it's recommended to send all vehicles that may pass through that bridge to depot and then upgrade bridge. Otherwise, pathfinder algorithm may crash game. Not sure if I fixed this crash, because I don't know how exactly to reproduce it. UPD.: just removed assert. Certainly, should fix that bug. Uncertainly would bring new ones. So, in the bottom line it's better to remove it and see for results.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Aberro PatchPack r27050

Post by Alberth »

The whole point of an assert is that it checks things that should always hold (and thus the assert should never fail).
An assert is a detection mechanism of things going very wrong, rather than being a cause of bugs[+].

Example:

Code: Select all

assert(1+1 == 2);
x = y + 1;
The example is pretty stupid, but what it expresses is that you really want 1+1 to be 2. If it doesn't hold, something "impossible" has happened, and all bets are off, for example, you cannot trust the value of x in the assignment any more (it depends on + being sane).

If an assert fails, you can remove the assert, and it will not crash on the assert anymore (obviously). However, the "this should always be true" check is also not checked anymore, and x in the example may get weird values without noticing it. The computer doesn't know what is good or wrong, it just continues running computations, until 2365[*] statements later, you use a computed value like x (or another value that depends on x), and it fails hard (any form of crash is possible at this stage).


In other words, if an assert fails, the assert itself is not the culprit, it just detected that something very wrong has happened in the code before. Removing the assert is not the answer, since the "very wrong" stuff is still there causing havoc. Instead, find where the code invalidates the assert condition (somewhere before the assert statement), and check why that happens.

[+] Technically, an assert can be a cause for bugs, but that's uncommon.
[*] Just an example, it can be any number of statements between 1 and infinite.
Being a retired OpenTTD developer does not mean I know what I am doing.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Aberro PatchPack r27050

Post by Eddi »

it's like when someone is stealing your neighbours car, you close your windows and blinds, so you don't see and hear anymore that someone is stealing your neighbours car.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

I know, I know, it's like fix one bug and then get ten another bugs. Just tried to go easiest way - it's easier to try something easier and see what it would do and then try something harder if that doesn't work. Unfortunately, in this particular case it doesn't worked, so I'll do some more debugging. Would it so easy to just find where the code invalidates and check why this is happens I surely won't even try to do this 'technique'. But I barely understand what happens in code and how to always reproduce bug, not to mention why something goes wrong. Currently all I know is that failure happens during pathfinding or following found path soon after adding CBH somewhere on the possible route.
Besides, Eddi, in that case 'blindness' would be a solution in some terms. Furthermore, some people are doing so.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Aberro PatchPack r27050

Post by Eddi »

usually you'd run the program in a debugger, try to provoke the crash, and then analyse the backtrace and program state to find out what's wrong. (or analyse what the code actually does)

also, you'd usually do this with only this one single patch, and not in a patchpack.

and yes, the "turning a blind eye" approach does work. until one day it's not your neighbour's car that is stolen, but yours. then it crashes.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

Oh, tell me more obvious useless things about coding, sensei. What is debugger, or how I should press keys on my keyboard.
Yes, merging all patches in one pack was a mistake. Which, wouldn't it be done, anyway, wouldn't make debugging easier, because no other patches modifies that parts of pathfinding that leads to assertion failure, I can tell this for sure, even though I don't know what exactly causes failure.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

I give up. I'm totally do not understand why YAPF fails on bridge head upgrade. Just use NPF on road vehicles (it seems like this path-finder works well anyway) or send all vehicles that physically may pass through the bridge you want upgrade to depot. If anybody at all plays this pack.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Aberro PatchPack r27050

Post by Eddi »

well, what do you expect except of "obvious useless things"?

i don't know what your capabilities are
i don't know which code you're looking at
even if i did, you're the only person here which has looked at this piece of code in years, so you are "the expert".
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

Anyway, even if someone would be totally noob at coding, the advice "try to provoke the crash, and then analyse the backtrace and program state to find out what's wrong" would be either obvious and useless or too complicated to understand. And useless. The state when someone knows how to write and compile code and absolutely have no idea how to use debugger is very short, as far as I know. Therefore, this is K.O. advice.
And no, I'm not "the expert".
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Aberro PatchPack r27050

Post by Eddi »

i'm glad i could help you, then.
aberro
Engineer
Engineer
Posts: 64
Joined: 20 May 2013 20:20

Re: Aberro PatchPack r27050

Post by aberro »

Update. Added Trains cortege speed limit patch.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests