Realtime 3.1-maybe-beta (12.2 base)

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
eekee
Engineer
Engineer
Posts: 96
Joined: 23 Jun 2005 19:45
Location: quantum superposition

Re: "Real" time patch

Post by eekee »

Ah, gotcha. Okay then.
Extreme network builder. screenshot thread
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: "Real" time patch

Post 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
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Re: "Real" time patch

Post 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..
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Update on TTD 1.9.1 patch

Post 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
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Vanilla patch update 0.9, nearly done for plain OpenTTD.

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Tile size test

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

JGR patch updated, realtime-JGR-0.7.diff

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Small update JGR patch

Post by SciFurz »

Linkgraph is working now, made a small update of the JGR patch.

Getting dispatch working is next.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Updated JGR patch

Post 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
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Update vanilla patch

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

JGR patch updated for version 0.31.0

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
User avatar
eekee
Engineer
Engineer
Posts: 96
Joined: 23 Jun 2005 19:45
Location: quantum superposition

Re: Updated JGR patch

Post 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.
Extreme network builder. screenshot thread
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

Re: Updated JGR patch

Post 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. :-)
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

i'm failing to see any post saying "it can't be done"...
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

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

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

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

Post 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?
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.
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

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

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

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

Post 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.
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.
User avatar
SciFurz
Traffic Manager
Traffic Manager
Posts: 154
Joined: 13 Oct 2018 16:33
Contact:

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

Post 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.
Tinkering in the code in between writing mostly naughty stuff.
See http://scifurz.wordpress.com/
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

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

Post 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!
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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 18 guests