Page 2 of 9

Re: "Real" time patch

Posted: 06 May 2019 11:00
by eekee
Ah, gotcha. Okay then.

Re: "Real" time patch

Posted: 06 May 2019 13:46
by Eddi
SciFurz wrote:I'm currently trying to figure out why cargo only gets a destination with a day length factor of 1038 or lower
i can think of two obvious ways this could happen:
  1. a counter overflows, and never reaches a trigger threshold
  2. a division by a large value results in always rounding to 0

Re: "Real" time patch

Posted: 06 May 2019 19:48
by SciFurz
Eddi wrote:i can think of two obvious ways this could happen:
  1. a counter overflows, and never reaches a trigger threshold
  2. a division by a large value results in always rounding to 0
Looks like it did have something to do with an overflow of ticks, I reverted the simple linkgraph code changes and added code that uses _date and _date_fract seperately without multiplying the lot together with day ticks and the day length factor (in the end it was too much for int32 while I thought at first I calculated enough overhead). Suddenly a bunch of people want to go places. :-p

Now to do the same trick for other functions where doing things in less that one day is useful..

Update on TTD 1.9.1 patch

Posted: 06 May 2019 20:06
by SciFurz
See top post for the patch.

Modified linkgraph code which seems to work now. A few changes still have to be made though.
Introduced several macros for code clarity and abbreviation, eleminating some long code lines dealing with ticks and their multiplications.

Thought about creating a single date stamp variable with functions for calculations but that would be overkill and a lot of extra code stuffed in between. Where necessary I'll add bits to calculate total days and day fractions seperately.

And now back to digging through the code.
beta, 1980-10-13.png
(499.88 KiB) Not downloaded yet

Vanilla patch update 0.9, nearly done for plain OpenTTD.

Posted: 08 May 2019 18:47
by SciFurz
Getting closer to done now.

Made the time factor a selection list with reasonable options up to running at near real time.
At least for busses it all seems to work, so I'll just be busy creating a network to check out other cargo, trains, etcetera.
If that seems fine I can continue work on the JGR patch and on adding the time factor variable to the savegame code.

Tile size test

Posted: 10 May 2019 08:54
by SciFurz
Checked for tile size at a time factor of 1440 yesterday while tweaking code. Ran a train and a fast bus between two stations with a travel time of 3600 ticks and calculated speed versus number of tiles, and came up with a tile size of roughly 1.73 kilometre.
Taking that into account the tile size at the current highest time factor would go down to around 50 metres, and I could add even one step higher to get around 25 metres but then the game would run at half the real time.
On the other hand that might not matter to anyone wanting to run it as a model train track. It's a lot more room to scale than the tile size of around 18 kilometres with day length patch set at 125.

JGR patch updated, realtime-JGR-0.7.diff

Posted: 11 May 2019 15:25
by SciFurz
After trouble with savegame settings, started from scratch again with the JGR source for a clean patch.

As with the vanilla TTD patch, this one introduces the time factor selection for setting the game speed among some minor tweaks.

Have to start a new game to test changes to linkgraph, and timetables and dispatch still have to be converted to the extra real time variables I added, but the patch is playable as far as I see.
As sson as this timing replacement is done I'll have to try out the shunting patch here, which would look awesome on a huge distribution yard with some real timetabling.
Creating day and night cycles seems like a real option too now.

Small update JGR patch

Posted: 11 May 2019 18:58
by SciFurz
Linkgraph is working now, made a small update of the JGR patch.

Getting dispatch working is next.

Updated JGR patch

Posted: 12 May 2019 14:36
by SciFurz
Hopefully fixed the dispatch time issue.

Everything seems to be functional now, which doesn't seem bad for something others said couldn't be done. :-p

Update vanilla patch

Posted: 14 May 2019 18:42
by SciFurz
Modified savegame code for changed and new variables, no problems saving and loading new games but original 1.9.1 savegames fail with invalid chunk size error.
I thought that would work after this last change but maybe I overlooked one variable.

JGR patch updated for version 0.31.0

Posted: 14 May 2019 21:34
by SciFurz
Updated the JGR patch for version 0.31.0 and implemented the saveload changes.

Noticed town labels turned red despite authority on a good level, so building is not a problem.

Re: Updated JGR patch

Posted: 28 May 2019 15:42
by eekee
SciFurz wrote:Everything seems to be functional now, which doesn't seem bad for something others said couldn't be done. :-p
Not bad indeed! :D With computers, there are always people who say something can't be done; always have been, but there's always a way.

Re: Updated JGR patch

Posted: 29 May 2019 10:33
by SciFurz
eekee wrote:
SciFurz wrote:Everything seems to be functional now, which doesn't seem bad for something others said couldn't be done. :-p
Not bad indeed! :D With computers, there are always people who say something can't be done; always have been, but there's always a way.
Thanks! Whenever someone said something couldn't be done I got the urge to take on that challenge. My pride of being a systems administrator was at stake then. :-)

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 29 May 2019 16:02
by Eddi
i'm failing to see any post saying "it can't be done"...

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 30 May 2019 17:18
by SciFurz
Eddi wrote:i'm failing to see any post saying "it can't be done"...
If not outright stated, it was surely implied by posts I've come across before while I read through the board (don't ask where, too long ago).
Why else would several people make patches that squeezed in ticks between the default ticks instead of taking on the root of the "problem"? Unless the reason was as a friend of mine suggested, simply fear of taking on the task.

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 31 May 2019 01:04
by SimYouLater
Can someone compile a version of JGR 0.31.0 that includes this patch? Or at least give me a tutorial so I can do it myself?

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 31 May 2019 01:17
by SciFurz
SimYouLater wrote:Can someone compile a version of JGR 0.31.0 that includes this patch? Or at least give me a tutorial so I can do it myself?
I took a quick look at the cross compiling instructions on the OpenTTD wiki, https://wiki.openttd.org/Cross-compiling_for_Windows, and might give it a shot one of these days (need to do manual compile). If that works I'll post Windows executables as well.

I remember someone asking for a version of the shunt patch with day length patch in it so I could also post the test version I compiled in the shunt thread.

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 31 May 2019 02:30
by SimYouLater
SciFurz wrote:
SimYouLater wrote:Can someone compile a version of JGR 0.31.0 that includes this patch? Or at least give me a tutorial so I can do it myself?
I took a quick look at the cross compiling instructions on the OpenTTD wiki, https://wiki.openttd.org/Cross-compiling_for_Windows, and might give it a shot one of these days (need to do manual compile). If that works I'll post Windows executables as well.

I remember someone asking for a version of the shunt patch with day length patch in it so I could also post the test version I compiled in the shunt thread.
A version with both shunt and real time would be nice, if possible.

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 02 Jun 2019 02:13
by SciFurz
SimYouLater wrote:
A version with both shunt and real time would be nice, if possible.
I had a look at the latest version and again had a train stuck on "waiting for free path", so I'll have to integrate specific parts of the patch and see if that's functional enough to warrant a compiled executable.
Maybe I'll have to build upon the original work and create an alternative version.

Re: "Real" time patch (TTD 1.9.1 + JGR 0.31.0)

Posted: 02 Jun 2019 03:36
by SimYouLater
SciFurz wrote:
SimYouLater wrote:
A version with both shunt and real time would be nice, if possible.
I had a look at the latest version and again had a train stuck on "waiting for free path", so I'll have to integrate specific parts of the patch and see if that's functional enough to warrant a compiled executable.
Maybe I'll have to build upon the original work and create an alternative version.
Fair enough. I guess a real time patch version of JGRPP is enough to sate my appetite for realism. Thanks in advance!