Adventures in JGRPP

Screenshots of your games! All Transport Tycoon games acceptable (including TTDPatch and OpenTTD).
Post Reply
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Adventures in JGRPP

Post by le_harv »

*** May 2024 Update ***

The first few posts are quite complex and potentially needlessly so. New features were added to JGRPP in release 57.0 that greatly simplifies things. Why not start there instead?

Click here to go to the post where I uncover these new features.

=======

I am hoping to turn this thread into exploration of some of the more complex features available in JGRPP (starting with 0.53.0). There isn’t a huge amount of detailed information out there on how to use some of these features so hopefully I can provide some insight here. I am by no means an expert and simply got here through trial and error as well as seeing what others had done.

Boring Background
[+] Spoiler
After a long (too long) hiatus from OpenTTD I was drawn back after remembering how I used some of the JGRPP features back then to create a suburban rail network that ran to a quasi-realistic schedule including stabling overnight and peak demand services.

That save is all but lost, so I fired up the latest version of JGRPP and am blown away about all the new features that have been incorporated since I have been away. Features, that mean you can truly do some remarkable stuff in creating a realistic service pattern using a clock.

I’ve always wanted to create a mammoth, ‘to scale’ transport network but I always end up just sinking hours into little experiments on the side to explore how some of the feature’s work. The beauty of OpenTTD is you can play exactly how you want.

Combining Scheduled Dispatch, Conditional Orders and Slots
This first post will take a look at using Scheduled Dispatch, Conditional Orders and Slots to create a functioning, scheduled, ‘realistic’ bus route in the test city of Montreux. It simulates:
  • Stabling busses overnight
  • Running services across a route from either end.
  • Handling distribution of busses across the network for the first departure of the day
  • Running the service schedules throughout the day
  • Handling the last service of the day and returning busses to the depot.
Here is CONNECT ROUTE 1, a simple 2.75km (one way) bus route that offers service every 5 minutes in each direction from 04.45 to 23.15. One direction takes about 7 or 8 minutes to complete and to offer the frequency of service it needs 4 busses to run. The order list below gives you a preview of the logic at play:

Orders.png
Orders.png (29.54 KiB) Viewed 4987 times
Last edited by le_harv on 20 May 2024 20:07, edited 2 times in total.
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

3 schedules using scheduled dispatch (Schedule 1 to control when each bus leaves the depot and Schedule 2 and 3 to control the schedules in each direction, from each termini). As there are 4 busses then there are only 4 departures that need scheduling from the depot compared with from each termini.

Schedule 1.png
Schedule 1.png (7.41 KiB) Viewed 4986 times
Schedule 2.png
Schedule 2.png (7.92 KiB) Viewed 4986 times

Assigning the schedules to specific orders at the depot and at the termini is the basis for how this route successfully functions. As mentioned, Schedule One control depot departures and Schedules 2 and 3 control departures at each end of the line.

Dispatch Assignments.png
Dispatch Assignments.png (27.38 KiB) Viewed 4986 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

Slots are used to control distribution of buses to the right end of the line for the first service in the AM otherwise they will all go to the same station.

Slot List.png
Slot List.png (13.66 KiB) Viewed 4985 times

Conditional orders are used each time a bus reaches each end of the line to determine whether it is the last service or not.

Orders Part 2.png
Orders Part 2.png (6.13 KiB) Viewed 4985 times

Special instructions are included to let the bus know what to do in the last service of the day.

Orders Part 4.png
Orders Part 4.png (4.95 KiB) Viewed 4985 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

In the morning the first bus is scheduled to leave the depot at 04.30 (Schedule 1) to arrive at a termini on time for the first service at 04.45. We need to split the busses between the termini evenly so we can use slots to do this. The first two buses are conditionally ordered to acquire a slot in CONNECT Morning A (Order 3) and then instructed to proceed to the first termini (Order 7). The last two busses will try and also acquire a slot in CONNECT Morning A (Order 3) but won’t be able to (Order 4) as will be full with the first two buses. Therefore, they acquire a CONNECT Morning B Slot (Order 5) and are then conditionally ordered to head to the second termini (Order 18).

Orders Part 1.png
Orders Part 1.png (5.28 KiB) Viewed 4984 times

Once the busses arrive at the termini they will now wait for the first scheduled service at 04.45 (Schedule 2) and will leave on time and complete the route to the other termini (Orders 8 -13). After the penultimate stop before the termini some conditional orders are used to determine behaviour. If the bus is not the last bus of the day on this schedule (Order 15) then it will proceed to the termini as normal (Order 18) but if it is the last bus of the day (Order 16) it will be given some special instructions (Order 33). Note, the slots here refer to Scheduled Dispatch slots and not the slots mentioned above.

Orders Part 2.png
Orders Part 2.png (6.13 KiB) Viewed 4984 times

Once the bus arrives at the other terminal it waits for the next departure the same logic applies in the opposite direction (Schedule 3). Again it is tasked with some conditional orders to determine if the bus is the last service of the day. If it isn’t, then it is routed back to the top of the route order (Order 7) to wait for the next departure at that terminus. If it is the last then it proceeds to special instructions (Order 29).

Orders Part 3.png
Orders Part 3.png (5.61 KiB) Viewed 4984 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

So what if the bus IS the last service of the day at 23.15? There is a special process that the busses will get directed to follow based on the outcome of Order 15/16 and 26/27. These orders send the last service to the respective termini depending on what end of the line they are at to unload passengers but leave empty. Can’t have any passengers being taken back to the depot! Once there, they also release whatever slot they are occupying so that the slots are available for morning procedures. Note that Order 32 ensures that the last services of the day at the first termini do not go to the second termini before the depot. The last service at the second termini will never see this order because it has been directed to Order 33.

Orders Part 4.png
Orders Part 4.png (4.95 KiB) Viewed 4983 times

I really hope this helps break it down for someone who is thinking of using these powerful features without having to repeat order lists or fiddle with timings or speeds.

Let me know what you think and whether I can provide anymore information. All feedback is welcome.

CONNECT Route 1 resize.png
CONNECT Route 1 resize.png (585.24 KiB) Viewed 4981 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

I was learning about procedures while messing about with some NML. What if you could apply 'procedural' logic to a timetable? Maybe I can annotate my 'code' too.

I streamlined as much as possible and I am sure there is more that can be done or is redundant. Happy to hear opinions of different approaches! But essentially...
  • Trains start in a handful of holding places and when their scheduled dispatch tells them its time to go... off they head.
  • They then try to acquire the appropriate 'slot' depending on the time of day and the resulting service pattern
  • Next they tackle the route repeatedly until conditions change such as time of day. (note you only have to put the route in once).
  • When the service pattern changes so does the number of slots available, meaning some trains get taken out of service.
  • When a train gets removed from service, it gets distributed to the appropriate stabling points, especially ahead of tomorrows schedule
Something that saved me from going crazy was having the jump order, jump targets be the label... not the actual order so that you could rearrange the content of that section without having to always make sure that jump orders were pointing to the right places!

This format is also quite modular and the template can be 'cloned' over to other vehicles and edited appropriately. Want to add more service patterns? Easy to duplicate orders and create a new slot group. Want to change when rush hour is? Just change the time check. Want to add more stabling points? Just add more and create a new scheduled dispatch for it.
Orders.png
Orders.png (125.65 KiB) Viewed 3289 times
orders.gif
orders.gif (242.92 KiB) Viewed 3285 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

Or is this even cleaner?
Orders2.png
Orders2.png (123.01 KiB) Viewed 3279 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

A little fun with slots to make trains line up for storage on the same line! Thanks to some kind people on Discord who gave me their saves to learn the tricks of the trade.
doublestorage.gif
doublestorage.gif (247.67 KiB) Viewed 3251 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

Scale

Does OpenTTD really have a ‘scale’? Perhaps but it’s a little inconsistent here and there. I think its hard to have a conversation about time for scheduling without acknowledging distance and speed.

I can’t remember exactly how I got here but for me, each tile is 50m x 50m. It kind of makes sense as the more traditional newgrf 2 car trains typically fit on 1 tile (2x 25m carriages). You do have to ignore a few things like distance between tracks!

When you do the maths on distance between stops, it just feels right.
  • Bus stops every 400m are 8 tiles apart
  • Subway stations every 1km = 20 tiles
  • 100km = 2000 tiles
  • 512 x 512 map is 25.6km x 25.6km
  • 8192 tiles is 409.6km (near enough the straight line distance between Paris and Amsterdam!)
For a simple calculation:
  • Kms = tiles multiplied by 0.05
  • Tiles = kms divided by 0.05
But how does this relate to timetabling?

I used this base number to set ticks per minute based on how many ticks it takes a vehicle travelling at 60 km/h to cover 20 tiles (1km)… 1km at 60km/h should take exactly 1 minute. In this case… 690 ticks = 1 minute.

timetest4.gif
timetest4.gif (141.35 KiB) Viewed 3114 times

This might be quite a long time for gameplay but it is ‘accurate’. Hope this might be useful!
Attachments
tpm.png
tpm.png (5.34 KiB) Viewed 3114 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

I received some feedback through discord seeking more information on the dispatch schedules in my 'stabling and sidings' example. So here is a cleaner post that lays out some screenshots showing the mechanics in more detail. First the order list...

Orders2.png
Orders2.png (123.01 KiB) Viewed 3001 times

And here is where the stabling and sidings schedules for dispatch are tagged. Each of these 'storage' schedules contain the release slots for both the morning entries into service and the re-entry for the afternoon rush.

SD1.png
SD1.png (82.96 KiB) Viewed 3001 times
StablingsidingSD.png
StablingsidingSD.png (56.31 KiB) Viewed 3001 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

Here is where the schedules for each of the stations are tagged...
SD2.png
SD2.png (82.92 KiB) Viewed 3000 times
The actual schedules themselves look complicated but they are pretty straightforward. For example, for morning rush, I'd CTRL click 'add slot' and set the times (5am to 9am) and 6tph at 10 minute intervals (period).
Multislot.png
Multislot.png (5.41 KiB) Viewed 3000 times
Then for the next window (9am to 3pm) at 4tph I'd pick 15 minute intervals and add those slots... and so on. Once you've got all the windows figured out you end up with this!
StationsSD.png
StationsSD.png (85.89 KiB) Viewed 3000 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

And finally for good measure... the slot set up as well.
Slots.png
Slots.png (39.9 KiB) Viewed 2999 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

And here is an effort at balanced storage at the end of service. Its very much a work in progress and could do with further refinement (the scheduled dispatches are a disaster and I think the departure boards want to quit) but the logic works!

Perhaps some of the slot acquisition behaviour at the termini could actually be handled by programmable signals rather than the order list.
BSA.png
BSA.png (96.3 KiB) Viewed 2970 times
BSB.png
BSB.png (72.99 KiB) Viewed 2967 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

Forget everything you just read!

The methods described above are enjoyable, use lots of great JGRPP features but are quite complex to get operating. JGR 57.0 added a new feature that sneaked in under the radar for me...

Allow tagging individual departure slots for testing with the last/next departure slot conditional order.

That little line, buried in the changelog contains a very powerful feature that shortcuts the order sheet, removes the complexity for overnight stabling and makes balancing super easy. In the below image you will see an order sheet that:
  • Removes trains from service after rush hour
  • Removes trains from service over night
  • Makes sure that the trains are stabled in the right place so there are enough to start morning service.
This is a train route that:
  • Takes 41 minutes to complete in one direction
  • Off peak service requires 4 trains and runs a service every 30 minutes
  • Morning and afternoon peak service requires 6 trains and runs a service every 15 minutes
  • Trains are stabled in sidings at each end of the line overnight or when they need to be removed from service during the day.
How is this accomplished with so few orders? Read on!
Attachments
tags.png
tags.png (68.08 KiB) Viewed 143 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

Firstly we need to set up what our daily schedule looks like. The CTRL button when you click add slot makes life so much easier! I just need one schedule for the route. I built this one in chunks...
  • 0500 to 1030, every 15 minutes
  • 1030 to 1500, every 30 minutes
  • 1500 to 1830, every 15 minutes
  • 1830 to 2230, every 30 minutes
The result looks like this (I'll explain the asterisks, the tags, in a later post). I labelled this for the station at one end of the line and duplicated it for the other end of the line.
tags2.png
tags2.png (33.03 KiB) Viewed 139 times
I also create a schedule for the sidings to release the trains needed at the right time. It too is duplicated for each end of the line. Three slots in the morning are needed to start the service and one in the afternoon to return the train we took out of service after morning rush, back to service for the afternoon rush.
tags3.png
tags3.png (26.32 KiB) Viewed 139 times
These are then assigned to the stabling points and stations as you can see below.
tags4.png
tags4.png (129.08 KiB) Viewed 139 times
User avatar
le_harv
Engineer
Engineer
Posts: 90
Joined: 27 Sep 2014 05:16

Re: Adventures in JGRPP

Post by le_harv »

So cool, what about the tags?

This is where it becomes a bit of a gamechanger. You can tag a dispatch slot...
tags5.png
tags5.png (28.91 KiB) Viewed 123 times
and then have a conditional order check the status of the dispatch slot and whether it does or does not have a tag.
tags6.png
tags6.png (29.67 KiB) Viewed 123 times
So what does this actually do? In this example, when a train approaches the station at either end, it looks to check if the next dispatch slot has a tag. If it has a tag, then the train is directed to a different order, which in this case is to go hang out in the sidings. So in the image below, the train is approaching Kerkeinde at 1038. The conditional order at 13 asked the train to look to see if the next slot (1045 in this case) has tag 1. You can see by the asterisk that it has the tag.

Because it does have the tag, the train jumps to order 26, which is the start of the procedure to go to the sidings instead of continuing service. Remember I said that the morning rush stopped at 1030? Well the 1045 tag is effectively a dummy slot. The next train after this one won't arrive in time for 1045 but will line up for the untagged 1100 slot and will continue service.

The timetable has two of these dummy slots added for this reason... 1045 and 1845. I also added 0400 (the start of the timetable) so the when the train reaches this decision point on the last service it knows to go to sidings overnight, sleeps through this departure slot and leaves for the station at 0450 for the first 0500 service of the day. Without the dummy slot, the train would go the station... and then head straight back to bed because the 0500 slot would be tagged.
tags7.png
tags7.png (214.95 KiB) Viewed 123 times
Post Reply

Return to “Screenshots”

Who is online

Users browsing this forum: No registered users and 6 guests