Advanced Station Control

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

dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Advanced Station Control

Post by dadymax »

Main target of this patch is handling such situations:
On start player build one main line that supplies, for example, wood to lumber mill. By time he added transportation of goods from this station. Some time later he deside to split cargo flows: supplies of wood by old line but goods by new line from new station near lumber mill. Agree that this is common situation if player want build one-purpose (very)large stations.
At this point player have two stations that get goods from Lumber mill. Yes, rating on old station will be (very)low but if supplies of wood will huge then goods on old station may contain over 1k crates.
In classic TTD (and in OTTD) to handle this situation player need to rebuild supplies station from scratch (remove old, build brand new and change all routes to old station). That action on heavy loaded station is now so easy... I know
With this patch player just can click several times and problem will be gone.

Version 3 of this patch. If testing show no bugs ( :roll: ) then this patch is final of my idea about these features.
I made this because I really missed these features in TTD/OTTD. This features not critical but enjoyable :)

There a diff over trunk r24178 in attach.
Unfortunately I have to duplicate with some modifications one draw function.

What it do:
-On double click in Station View window (inside cargolist or ratinglist) rating list switch between normal ratings and ratings of cargo types that _not_ picked up before (or was turnoff, see below).
-On CTRL-click in cargolist this cargo: 1 click) stop getting from industry to station; 2 click) cleared from station as never picked up (but rating not affected).
-On CTRL-click in ratinglist (when extra cargo types view active) selected cargo type start comming from industry to station (if competition conditions allow). But this method of enabling industry have some penalties. I think that arrive of vehicle to station is much more good thing that only activate produce.
Penalties are:

Code: Select all

			ge.days_since_pickup = 100; // Some penalties: vehicle on station is still good thing.
			ge.last_speed = 1;
			ge.last_age = 50;
			ge.rating = ge.rating * 0.8;
As you can see multiple switching of production will cause rating drop.

Please, test it and report if some bugs or some found.

Also any suggestions welcome.
adv_st_control_v3_r24178.diff
(10.16 KiB) Downloaded 283 times
OLDPOST

Hello there. Here a little patch that allow to remove some type of goods from station.
Removing happen when in station view ctrl+click on row with stored cargo happen.
Removing have 2 stage:
First ctrl+click stop getting any new cargoes of this type from industries.
Second ctrl+click remove any cargo of this type remain on station.

Please try it and report bugs if any.

Write this patch because of 1) want to improve gameplay with this feature (sometimes very need it); 2) http://wiki.openttd.org/Todo_list

UPD: v3 released.
Last edited by dadymax on 28 Apr 2012 05:08, edited 8 times in total.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Advanced Station Control

Post by Alberth »

dadymax wrote:Now try to implement second native chunk of this feature that needed by almost everyone - somehow start getting production from industry _before_ first vehicle arrive on station.
I haven't looked at your patch, but this one is easy, just toggle a setting in the advanced settings.

EDIT: A quick look at the patch was enough. It is
- Very much not according to the code style. Do proper indenting of code, use the right kind of comments, and the right kind of spacing.
- Not multi-player safe. This patch only changes the local station, not everyone in a MP game.
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

Alberth wrote:I haven't looked at your patch, but this one is easy, just toggle a setting in the advanced settings.
Oh... My fault. Ok :D
EDIT: A quick look at the patch was enough. It is ...
- Not multi-player safe. This patch only changes the local station, not everyone in a MP game.
Not understood what you mean :?
Stop getting goods can only owner of station. Why this is not safe?
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Advanced Station Control

Post by Eddi »

every player has a completely independent game on his computer. they only occasionally check back whether they still have the same state.

the way you implement it, you tell only your computer that your station should not get cargo. but all other computers still think you get the cargo, thus for them you transport different amounts of cargo -> boom! desync!

you need to tell all computers in the network game that you stop accepting the cargo. this is done by the DoCommand() function.
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

Eddi wrote:every player has a completely independent game on his computer. they only occasionally check back whether they still have the same state.

the way you implement it, you tell only your computer that your station should not get cargo. but all other computers still think you get the cargo, thus for them you transport different amounts of cargo -> boom! desync!

you need to tell all computers in the network game that you stop accepting the cargo. this is done by the DoCommand() function.
Thanks for explain! Go 2 investigate :)
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

Wow... Until now I haven't time to make changes to this implementation ( :cry: ) but I have thought about gamesetting [Deliver cargo to a station only when there is a demand]: if we build station nearby, for example, Iron ore and Coal mines (that each of them in the catchment area) but want to make routes only for coal then we will have a huge amount of unneded Iron ore.
As I want to implement such feature: player have ability to view all goods that he can catch from the station (for ex. iron ore and coal) and select these of them what he want.
Suggestions about this point of view? :roll:


However, if I can make ability to remove cargoes from station MP-secure then above suggestion will have no use. 8)

UPD:

Nope... I check: with [Deliver cargo to a station only when there is a demand] seting set to No (i.e. Cargo go to station always) stoping with my method does'nt stop flow.

And I make some changes for doing thing through DoCommandP function. And add some things to make cargo drop to station as I suggest... No implemented fully yet.
I can't check MP compatibility now because of corporate rules ( :mrgreen: ) but try to check this evening.
Please take a look to review.
Attachments
adv_st_control_v2_r24178.diff
(5.38 KiB) Downloaded 193 times
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

This day was a good day - I make v3 of this patch. If testing show no bugs ( :roll: ) then this patch is final of my idea about these features.
I made this because I really missed these features in TTD/OTTD. This features not critical but enjoyable :)

There a diff over trunk r24178 in first post.

Unfortunately I have to duplicate with some modifications one draw function.

What it do:
-On double click in Station View window (inside cargolist or ratinglist) rating list switch between normal ratings and ratings of cargo types that _not_ picked up before (or was turnoff, see below).
-On CTRL-click in cargolist this cargo: 1 click) stop getting from industry to station; 2 click) cleared from station as never picked up (but rating not affected).
-On CTRL-click in ratinglist (when extra cargo types view active) selected cargo type start comming from industry to station (if competition conditions allow). But this method of enabling industry have some penalties. I think that arrive of vehicle to station is much more good thing that only activate produce.
Penalties are:

Code: Select all

			ge.days_since_pickup = 100; // Some penalties: vehicle on station is still good thing.
			ge.last_speed = 1;
			ge.last_age = 50;
			ge.rating = ge.rating * 0.8;
As you can see multiple switching of production will cause rating drop.

Please, test it and report if some bugs or some found.

Also any suggestions welcome.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Advanced Station Control

Post by Eddi »

dadymax wrote:-On CTRL-click in cargolist this cargo: 1 click) stop getting from industry to station; 2 click) cleared from station as never picked up (but rating not affected).
i don't think clearing cargo from station should be on the player's choice. clicking should only trigger enable/disable/automatic
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Advanced Station Control

Post by Alberth »

Eddi wrote:
dadymax wrote:-On CTRL-click in cargolist this cargo: 1 click) stop getting from industry to station; 2 click) cleared from station as never picked up (but rating not affected).
i don't think clearing cargo from station should be on the player's choice. clicking should only trigger enable/disable/automatic
I agree with that. Clearing cargo is a form of cheating yourself to a better rating, as you evade the cost of getting the cargo from the station, either by real transport or by decaying the cargo.
Such cheats tend to get exploited in MP games.

As such, I am not even sure that being able to disable cargo flow should be free of cost; you could keep artifically good ratings by turning off cargo delivery every time a train leaves. I would prefer a big penalty every time you use it, so at least it is not exploitable in a game.

You may also want to look into changing the window, ctrl+click is hard to find for new players. It is fine as short-cut, but you should be able to do it by just clicking buttons too, imho.
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

Well, I agree that CTRL-click is hard to find but Station View widget is heavily overloaded by buttons and adding individual button for relatively rare action isn't good idea.
As for specifically CTRL-click - in ottd lot of secondary actions doing by same scheme.

And I disagree that clearing cargo from station must be not in players hands. Reason is simple: in TTD/OTTD not exist any function on server side that clean unused cargo on stations. E.g. player stop transporting some cargo but do not delete station for some reason. Until infinity cargo still accumulates on old station by small quanity but exist.

Therefore I agree that rating must fall down not only on enabling but on disabling too. Add this tomorrow.

Anyone test this on MP?.. :roll:
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

How about adding rule to half rating if cargo flow stopped by player?
I mean string like this

Code: Select all

ge.rating = ge.rating / 2;
Then this action cannot be profitable even on middle ratings (on high it will dramaticaly reduce reting). On very low ratings this action not do any sensetive damage to rating.
Also I think about merge two stage of stopping carg flow into one: stop getting new cargo and clear station. But in this situation accidental click may cause huge lost in time on game start... Suggestions?

Main target of this patch is handling such situations:
On start player build one main line that supplies, for example, wood to lumber mill. By time he added transportation of goods from this station. Some time later he deside to split cargo flows: supplies of wood by old line but goods by new line from new station near lumber mill. Agree that this is common situation if player want build one-purpose (very)large stations.
At this point player have two stations that get goods from Lumber mill. Yes, rating on old station will be (very)low but if supplies of wood will huge then goods on old station may contain over 1k crates.
In classic TTD (and in OTTD) to handle this situation player need to rebuild supplies station from scratch (remove old, build brand new and change all routes to old station). That action on heavy loaded station is now so easy... I know :twisted:
With this patch player just can click several times and problem will be gone.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Advanced Station Control

Post by Alberth »

dadymax wrote:On start player build one main line that supplies, for example, wood to lumber mill. By time he added transportation of goods from this station. Some time later he deside to split cargo flows: supplies of wood by old line but goods by new line from new station near lumber mill. Agree that this is common situation if player want build one-purpose (very)large stations.
At this point player have two stations that get goods from Lumber mill. Yes, rating on old station will be (very)low but if supplies of wood will huge then goods on old station may contain over 1k crates.
I would probably expand the current station with more platforms dedicated to handling goods. Note that you can extend a station even if the platforms are not connected (with ctrl-click building); visually they look like different stations then.

If you want to split a station, I agree you have this problem.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Advanced Station Control

Post by FooBar »

Or just use the old station for goods and make a new one for wood.
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

FooBar wrote:Or just use the old station for goods and make a new one for wood.
This may be very hard in some occasions. And with some settings. In standart TTD there no problem at all - all trains run fast enough and every road is good.
In ottd many people play with hard settings that not allow vehicles to run as fast as they can because of slopes, weight of cargo etc. In this kind of rules build new lines with multi-level interchanges with bridges and tunnels are not acceptable because of significantly speeddown. And therefore using one station for all is not acceptable.
This can be solved by build different stations under one name (ctrl-building as Alberth wrote) but, again, not every situation can be resolved this action. There can be limit in station length, for ex., or something.

And, again, second main reason that I make this patch - request from ToDo list. With this patсh things become easier :))
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Advanced Station Control

Post by FooBar »

dadymax wrote:
FooBar wrote:Or just use the old station for goods and make a new one for wood.
This may be very hard in some occasions.
I find that actually very interesting gameplay, having to work out a way to move a station while keeping traffic flowing as best as possible.
So personally I don't really see a need for this, but I guess I can simply not use it :)
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Advanced Station Control

Post by Transportman »

I like the idea of being able to remove and stop accepting cargo at stations, because even if you no longer send any vehicles to the station, there still will be some cargo send to the station because the rating will not be 0 (unless you crash some vehicles, but that is only a temporary solution).

Just a question about this patch (didn't actually try it), but how does this handle transfer stations? If I would say at a transfer station to no longer accept cargo, will that also stop vehicles from transferring that cargo to that station?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Advanced Station Control

Post by Eddi »

no, this would only prevent cargo coming from industries. not cargo coming from vehicles.
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

Transportman wrote:Just a question about this patch (didn't actually try it), but how does this handle transfer stations? If I would say at a transfer station to no longer accept cargo, will that also stop vehicles from transferring that cargo to that station?
Eddi's right, this patch handle only Industry->Station interaction, nothing else.
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Advanced Station Control

Post by Vaulter »

Is it compatible with cargodist ?
Thanks.
dadymax
Engineer
Engineer
Posts: 37
Joined: 03 Apr 2012 12:34
Location: Russia, Moscow
Contact:

Re: Advanced Station Control

Post by dadymax »

Vaulter wrote:Is it compatible with cargodist ?
Thanks.
I think yes. It is a very simple patch :oops:
But dev's say that this patch need huge improuvment to be a good patch (See ottd bugtracker, there are ticket for this patch) Also we have report of desyncs in a later game...

P.S.
Спасибо, Vaulter, за твою сборку на ttdrussia, она стала очередным толчком для меня, чтобы вспомнить эту замечательную игрушку. А тут и руки зачесались поприменять свежие знания. К сожалению, сейчас по работе не до плюсов, поэтому не могу пока продолжать развитие идеи.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests