Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu May 23, 2019 6:03 pm

All times are UTC




Post new topic  Reply to topic  [ 31 posts ]  Go to page 1 2 Next
Author Message
PostPosted: Sat Apr 27, 2019 7:14 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
This patch replaces the 74 ticks based day with a 60 ticks time unit and multiply it with a chosen factor to slow the game down.
Some said it wasn't possible because the 74 was too hardcoded but yet the core change was done quickly and the game was still functional. Most work is in scaling other aspects and tweaking settings.

Unlike other day lengthening patches, this does not insert an extra loop between two original day ticks but it actually increases the amount of available ticks in a day (with factors aligning to real time).

Currently both vanilla and JGR patch seem fully functional.

Changes in patch (depending on OpenTTD branch):
- modified DAY_TICKS and related constants and added/replaced several for code clarity, among which:
- TIME_UNIT (60 ticks default block replacing the 74 standard)
- DAY_LENGTH (TIME_UNIT multiplied with _time_factor (the chosen slowdown factor))
- HOUR (the length of a game hour in ticks
- MINUTE (the length of a game minute in ticks)
- CUR_HOUR (current hour of the day)
- CUR_MINUTE (current minute of the hour)
- modified timetable variables for timing
- replaced monthly with daily autosave
- setting for selecting the time factor (removed old day length option)
- alternative station catchment radius set higher for bus and lower for other stations
- tweaks in duration of load/unloading
- dispatch timing divided by a factor of 60 (tick-wise) to fit in the 14 bits used for storage (workaround, should replace process with something better)
- Changed station rating modifiers, vehicle age factor changes only slightly over 10 years and speed is no longer a factor so the small and slower vehicles have a use

Recommended settings (depending on OpenTTD branch):

Interface - Wall clock:
- Show time in minutes: on
- Enter timetable times as text: on
- Ticks per minute: 60 for time factor 1440 (is automatically adjusted at time factor changes to 48 or above but can be changed manually again)
- Show date: full date


Possible issues (the ones seen so far, depending on OpwnTTD branch, not all confirmed fixed yet by me):

Not savegame compatible, you might get an ocean background at the intro screen but saving and loading new games works so far.
Production rate might be set higher for testing purposes, eventually to be set to once a day by default.
Build of new industires is done in a day or so instead of one or two months in JGR patch, TTD patch probably works (not tested yet).
Intermittent brief slowdown at fast forward (but seems caused by the Intel graphics in my laptop).
Town label is red even though attitude is good. (seems caused by loading of previous test games and disappears after saving/reloading game)

Planned additions:
- scale town size
- scale acceleration
- scale catchment area for bus station (other stations can be scaled by combining with bus station when it makes sense for covering populated areas, like mail, goods)

---

Diff for JGR patch branch (0.31.0):
Attachment:
realtime-JGR-0.9.diff [163.43 KiB]
Downloaded 5 times


Diff for vanilla 1.9.1 branch (1.9.1):
Attachment:
realtime-TTD-1.2.diff [140.69 KiB]
Downloaded 2 times


PS: Diff files are made from local directories, not the git repositories.

.
Attachment:
The attachment beta, 1981-07-08.png is no longer available


Attachments:
beta, 1981-07-08.png [700 KiB]
Not downloaded yet

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Last edited by SciFurz on Wed May 15, 2019 7:12 am, edited 24 times in total.
Top
   
 Post subject: Re: "Real" time patch
PostPosted: Mon Apr 29, 2019 12:20 am 
Offline
Director
Director

Joined: Sun Apr 03, 2016 8:19 pm
Posts: 554
SciFurz wrote:
...


JGR wrote:
...


Just getting JGR's attention. This would be nice to add to your patchpack, but no rush.

_________________
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.


Top
   
 Post subject: updates
PostPosted: Mon Apr 29, 2019 3:44 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
New versions of patched posted.

In these the station/cargo ratings should get a daily update.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Mon Apr 29, 2019 10:27 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Mar 30, 2005 9:43 am
Posts: 1644
SciFurz wrote:
Currently default game time is one minute per two real seconds

That does not seem right. A game DAY is 74 game ticks, which is about 2.25 real seconds.

_________________
He's like, some kind of OpenTTD developer.


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Mon Apr 29, 2019 11:24 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
peter1138 wrote:
SciFurz wrote:
Currently default game time is one minute per two real seconds

That does not seem right. A game DAY is 74 game ticks, which is about 2.25 real seconds.


It is default for the patch, which is 1167.567 times slower than the TTD default.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Tue Apr 30, 2019 10:04 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Mar 30, 2005 9:43 am
Posts: 1644
SciFurz wrote:
peter1138 wrote:
SciFurz wrote:
Currently default game time is one minute per two real seconds

That does not seem right. A game DAY is 74 game ticks, which is about 2.25 real seconds.


It is default for the patch, which is 1167.567 times slower than the TTD default.
Ah, "currently" ... This patch seems very intrusive though. It's there a way to disable it?

_________________
He's like, some kind of OpenTTD developer.


Top
   
 Post subject: Re:
PostPosted: Tue Apr 30, 2019 10:25 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
[/quote]Ah, "currently" ... This patch seems very intrusive though. It's there a way to disable it?[/quote]

Don't patch and compile it. ;-)
DAY_TICKS is a constant and there's no changing it dynamically. That's why I'm seeing if I can add a setting to modify it like tthe day length patch, only keeping the factor compatible with real time (no fractional minutes).

And obviously it's very intrusive, anything previously handled by byte size and overflowing them needs to be rewritten to the actual amount of ticks.
It's a wonder I can run the game and load and save without a crash or losing anything so far. :-p

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Tue Apr 30, 2019 1:10 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Aug 08, 2005 1:46 pm
Posts: 1931
Location: Ipswich
SimYouLater wrote:
SciFurz wrote:
...


JGR wrote:
...


Just getting JGR's attention. This would be nice to add to your patchpack, but no rush.

I'm not sure I understand what the motivation/benefit of this is.
Changing the day length this drastically is likely to have a lot of side-effects on other parts of the game.
I'm not making any commitments about merging or not, however not being able to to turn it off would be a major blocker.

_________________
Ex TTDPatch Coder, Grumpy Greymuzzle
Avatar by MoonsongWolf.
Patch Pack, Github
Dad-Coder since April 2018


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Tue Apr 30, 2019 1:20 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4853
Location: Lost in Music
SimYouLater wrote:
Just getting JGR's attention. This would be nice to add to your patchpack, but no rush.

Why quote people into the thread like this? It's just rude. Stop with this crap.

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (Released) | CHIPS Has Improved Players' Stations (Finished)
Iron Horse (trains, released) | Termite (tracks for Iron Horse, released) | Busy Bee (game script, released)

Road Hog (road vehicles, released)


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Tue Apr 30, 2019 3:42 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
JGR wrote:
I'm not sure I understand what the motivation/benefit of this is.


It's for those that like to run the game as a model railroad and/or prefer to be able to play and ponder the next step without the stress of constantly needing to pay attention to things one after the other. It also creates more virtual space for better looking railroade stations and junctions without either side ending up touching the next town. :-)
It also makes combining road and rail transport more effective in my opinion. So far it's been a lot more fun and realistic managing a transport network.

JGR wrote:
Changing the day length this drastically is likely to have a lot of side-effects on other parts of the game.
I'm not making any commitments about merging or not, however not being able to to turn it off would be a major blocker.


Actually, I was surprised at how well the game ran after the simple step of increasing day ticks, and certainly your version compared to the vanilla OpenTTD. ;-)
This patch is way too alpha to commit to a release version, for me one requirement is the option to select a speed up, and maybe even a slow down to run it at actual real time. Perhaps even a switch to freeze time and have the game looping the same day?
Anyway, the first step was to see if I could get it running with ticks as seconds, after this I can look at a good method to select a speed for those that like to blast through the game as usual.
They might miss out on taking the time to watch super long trains driving across great plains or parked in numbers on a huge industrial yard though. ;-) The shunting ability would be awesome then.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Tue Apr 30, 2019 10:09 pm 
Offline
Director
Director

Joined: Sun Apr 03, 2016 8:19 pm
Posts: 554
andythenorth wrote:
SimYouLater wrote:
Just getting JGR's attention. This would be nice to add to your patchpack, but no rush.

Why quote people into the thread like this? It's just rude. Stop with this crap.


You don't have to be a jerk about it. I was just trying to point JGR to it, it's entirely up to him; He said he can't decide yet whether it will be included, so I won't bother him further about this patch because that would be rude.

_________________
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Wed May 01, 2019 1:41 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7350
SciFurz wrote:
JGR wrote:
Changing the day length this drastically is likely to have a lot of side-effects on other parts of the game.
I'm not making any commitments about merging or not, however not being able to to turn it off would be a major blocker.
Actually, I was surprised at how well the game ran after the simple step of increasing day ticks, and certainly your version compared to the vanilla OpenTTD. ;-)

several attempts at daylength patches have started with this seemingly simple change, but once you dig deeper, it usually falls apart quickly, as some code paths have not been fitted with handling lager numbers, or people having different opinions over which parts of the game should be slowed down and which parts shouldn't.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Thu May 02, 2019 9:33 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
Eddi wrote:
several attempts at daylength patches have started with this seemingly simple change, but once you dig deeper, it usually falls apart quickly, as some code paths have not been fitted with handling lager numbers, or people having different opinions over which parts of the game should be slowed down and which parts shouldn't.


I did have to increase several variables to int32 indeed. No showstopper for me and the game hasn't crashed on me yet. The only drawback is old savegames aren't compatible with the current code but that's not an issue for me either.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Update TTD patch
PostPosted: Thu May 02, 2019 2:47 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
Updated the TTD patch to version 0.4.

Included the option setting day length factor under environment to slow down the game speed.
Set to 1 day ticks are 60, higher multiplies it by the factor (goes up to a maximum of 20000(!)). Set it to 1440 to get 86400 ticks in a game day.

Town cargo production is scaled with it, so no need to throw a lot of busses at passengers, instead slow down time so fewer busses can pick up all in one day.


Attachments:
beta, 1981-07-08.png [700 KiB]
Not downloaded yet

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz
Top
   
 Post subject: Re: "Real" time patch
PostPosted: Sat May 04, 2019 4:42 pm 
Offline
Engineer
Engineer
User avatar

Joined: Thu Jun 23, 2005 7:45 pm
Posts: 88
Location: Cyberspace
SciFurz wrote:
It's for those that like to run the game as a model railroad and/or prefer to be able to play and ponder the next step without the stress of constantly needing to pay attention to things one after the other.

This is exactly what I need! As much as I like OpenTTD, I keep thinking I really ought to replace it with another game because I keep playing too hard and getting stressed.

_________________
Extreme network builder. screenshot thread


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Sat May 04, 2019 11:10 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
eekee wrote:
This is exactly what I need! As much as I like OpenTTD, I keep thinking I really ought to replace it with another game because I keep playing too hard and getting stressed.

That's why I began tinkering in the code to get the option to run the game at a scale I want to use. I don't want a train to take hours or even days to go from one end of the station to the next. :-p
Can't wait to build a complete railroad yard with long trains waiting on schedule at a decent scale to cities.. ;-)

Currently I can slow down the game at a chosen factor, but at a factor above 109 passengers keep gwtting a destination of any station at a newly built one. Working back through the code to find out where probably linkgraph jobs hit a limit.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Sun May 05, 2019 12:20 am 
Offline
Engineer
Engineer
User avatar

Joined: Thu Jun 23, 2005 7:45 pm
Posts: 88
Location: Cyberspace
Um... That's normal for newly-built stations.

_________________
Extreme network builder. screenshot thread


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Sun May 05, 2019 5:30 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
eekee wrote:
Um... That's normal for newly-built stations.


Not after a bus has picked up passengers and dropped them off. Then a direct link has been established and subsequent passengers from that station have a destination.
"Any station" is for discovering a station accepting that cargo type.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Sun May 05, 2019 4:39 pm 
Offline
Engineer
Engineer
User avatar

Joined: Thu Jun 23, 2005 7:45 pm
Posts: 88
Location: Cyberspace
I just tested in plain 1.9.0 with two quite closely-spaced bus stops and a bus which didn't have enough capacity to pick up all the passengers on its second visit. In this case, passengers "via any station" continued to increase after the second visit.

I don't think the small bus capacity is necessary to trigger this. I think it's because Cargodist doesn't recalculate the link graph straight away. It has an option for how long to take; default 16 days. What that 16 days means with your patch, I don't know. :)

_________________
Extreme network builder. screenshot thread


Top
   
 Post subject: Re: "Real" time patch
PostPosted: Sun May 05, 2019 7:24 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sat Oct 13, 2018 4:33 pm
Posts: 34
eekee wrote:
I just tested in plain 1.9.0 with two quite closely-spaced bus stops and a bus which didn't have enough capacity to pick up all the passengers on its second visit. In this case, passengers "via any station" continued to increase after the second visit.

I don't think the small bus capacity is necessary to trigger this. I think it's because Cargodist doesn't recalculate the link graph straight away. It has an option for how long to take; default 16 days. What that 16 days means with your patch, I don't know. :)


It's not the number of days for the recalculation of the link graph, or the interval. I'm currently trying to figure out why cargo only gets a destination with a day length factor of 1038 or lower (on 60 day ticks in my current modified code). It seems the calculation of links hits an unintentional timeout when there's actually more than enough time in a day. Rather a reverse problem of time. :-/
The term days for the recalculation will become irrelevant anyway since it won't be days but the time unit DAY_TICKS.

_________________
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 31 posts ]  Go to page 1 2 Next

All times are UTC


Who is online

Users browsing this forum: Tintinfan and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.