Conditional loading

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
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Conditional loading

Post by pavel1269 » 18 Mar 2011 23:28

What it does is simple. I will examine on example.
  • 1: Go to Station1
    2: Go to Station2
    3: Jump to 2 if Load percentage is below 20.
This will cause a vehicle to stay without interruption in a station 2, loading for the condition to meet (tested only on train, but it should work on all types).
Attachments
conditional_load_r22836.patch
(2.19 KiB) Downloaded 185 times
conditional_load_r25493.patch
(2.62 KiB) Downloaded 161 times
Last edited by pavel1269 on 28 Jun 2013 20:07, edited 8 times in total.

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 26 Aug 2011 10:46

Update

edit: Attachment removed. See first post.
Last edited by pavel1269 on 20 Sep 2011 09:23, edited 1 time in total.

User avatar
Leanden
Tycoon
Tycoon
Posts: 2621
Joined: 19 Mar 2009 19:25
Location: Kent

Re: Conditional loading

Post by Leanden » 26 Aug 2011 14:35

The patch isnt adding the conditional loading option though is it?

What you are actually adding is a change to the train pathfinder where if a train is issued an order to the same station twice, it just stays there instead of trying to route back to the station?
Image

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 26 Aug 2011 16:48

Leanden wrote:The patch isnt adding the conditional loading option though is it?
No, nothing is added.
Leanden wrote:What you are actually adding is a change to the train pathfinder where if a train is issued an order to the same station twice, it just stays there instead of trying to route back to the station?
I am not doing anything with PF. I am not sure if I understand you correctly, so I am not saying you are right or wrong. I hoped, that my example will demonstrate everything, which this patch does.
pavel1269 wrote:
  • 1: Go to Station1
    2: Go to Station2
    3: Jump to 2 if Load percentage is below 20.
This will cause a vehicle to stay without interruption in a station 2, loading for the condition to meet.

User avatar
Leanden
Tycoon
Tycoon
Posts: 2621
Joined: 19 Mar 2009 19:25
Location: Kent

Re: Conditional loading

Post by Leanden » 27 Aug 2011 14:38

Ye so instead of leaving the station as the train currently does, the train stops in the station because it has been asked to return to the same station by the conditional order.
Image

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 20 Sep 2011 09:27

I found a bug connected with this patch. Well, more like a unspecified behavior. The gradual loading works only for full load orders and this patch forces vehicles to stay at station without full load order. So the gradual loading was not working. Fix is in the first post.

User avatar
Drury
Tycoon
Tycoon
Posts: 2151
Joined: 09 Dec 2008 16:20
Skype: yes
Location: Slovakia
Contact:

Re: Conditional loading

Post by Drury » 04 Nov 2011 14:52

This is something worthy considering implementing in trunk.

I've been waiting for this since conditional orders were introduced! Current system is very awkward and not always useful.
Image

Only dumb people quote themselves, and only the truest retards put such quotes in their forum signatures
-Drury

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 12 Apr 2012 17:53

A little update. Renamed variable, to fit a little more. Removed limitation of conditional orders which type is percentage loaded, for the sake of extensibility.
Attachments
conditional_load_r24112.patch
(2.11 KiB) Downloaded 150 times

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 28 Jun 2013 19:48

Patch updated to current trunk. Patch file is in the first post.

benem
Engineer
Engineer
Posts: 4
Joined: 09 Dec 2013 10:39

Re: Conditional loading

Post by benem » 18 Dec 2013 09:00

Hi, sorry to resume this old post but I have a problem with this patch.

I'm using it via this binary, but I cannot find the way to specify how much load percentage to wait on each station.

Should it need to be activated in some way? I cannot find any options.

Thanks.

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Conditional loading

Post by adf88 » 18 Dec 2013 09:39

benem wrote:...I cannot find any options
http://wiki.openttd.org/Conditional_Orders


I would like to see this patch in a more universal form - while vehicle is on a station process it's orders and don't move it until another station order.

Example A:
[1] Go to station X
[2] Go to station X
[3] Go to station X
...
would keep the vehicle on the "station X"

Example B:
[1] Go to station X
[2] Jump to order 4
[3] Jump to order 1
[4] Jump to order 3
would keep the vehicle on the "station X"

Example C:
[1] Go to station X and unload all
[2] Go to station X and full load all
would give the same result as single "Go to station X, unload all and full load all" order

Example D:
[1] Go to station X
[2] Jump to order 5 if load percentage > 80
[3] Jump to order 1 if load percentage < 40
[4] Go to station Y and full load
[5] Go to station Z and unload all
would make the vehicle stay at station X until 40% loaded

etc.
:] don't worry, be happy and checkout my patches

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 22 Dec 2013 18:32

While I see the point in examples B and D, I don't see what other examples have common with this patch at all.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4736
Joined: 09 Sep 2007 05:03
Location: home

Re: Conditional loading

Post by Alberth » 22 Dec 2013 18:54

After playing some cdist, I can see the idea of a partial load now.

However, all this jumping around in the orders seems a little complicated, what's wrong with extending loading or (for symmetry) unloading until some percentage?

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 22 Dec 2013 19:01

I wanted to defend the example D, but I now see problem in it's concept. If I change it to the following:

Example D:
[1] Go to station X
[3] Jump to order 1 if load percentage < 40
[2] Jump to order 5 if load percentage > 80
[4] Go to station Y and full load
[5] Go to station Z and unload all

The it would work, right? :)

And to be honest, I don't see any in game example of example B, so you might be right that it is good as it stands now.

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Conditional loading

Post by adf88 » 23 Dec 2013 08:43

These are not real life examples. The point is to unify things and allow user to create any layout, even crazy one.
:] don't worry, be happy and checkout my patches

Eddi
Tycoon
Tycoon
Posts: 7414
Joined: 17 Jan 2007 00:14

Re: Conditional loading

Post by Eddi » 23 Dec 2013 11:55

Alberth wrote:However, all this jumping around in the orders seems a little complicated, what's wrong with extending loading or (for symmetry) unloading until some percentage?
the main advantage of this method is that you don't need any new GUI elements, the order GUI is already very overloaded anyway.

also, it might allow something like this:

Goto A: unload and no loading, wait for 18 days
Goto A: load, wait for 2 days

at the end station. this way, cargo won't lose value during the waiting time.
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
skippern
Traffic Manager
Traffic Manager
Posts: 199
Joined: 30 Oct 2013 13:57

Re: Conditional loading

Post by skippern » 19 Jan 2014 22:48

Something like this would be nice
  1. Station A: Wait for full cargo goods
  2. Station B: Unload all
  3. Station C: Load goods if available
  4. Station D: Skip if no goods onboard
  5. Goto 1
Skippern
OpenTTD Mac user

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 19 Jan 2014 23:44

You can't do that in clean trunk already?

User avatar
skippern
Traffic Manager
Traffic Manager
Posts: 199
Joined: 30 Oct 2013 13:57

Re: Conditional loading

Post by skippern » 20 Jan 2014 06:29

I've seen AI's do if age > X skip order, but I havn't figured out how to do it myself
Skippern
OpenTTD Mac user

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Conditional loading

Post by pavel1269 » 20 Jan 2014 09:19

  1. Station A: Wait for full cargo goods
  2. Station B: Unload all
  3. Station C: Load goods if available
  4. Go to 1, if no goods on board
  5. Station D: Unload all (I guess)
You better search some tutorials next time for it. This patch has nothing to do with this.

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 0 guests