Another Daylength patch
Moderator: OpenTTD Developers
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Another Daylength patch
Can we please avoid double and tripple posts? You can edit your posts after creation. And when replying your can quote several postings easily by pressing 'quote' in the appropriate posts (by scrolling down further the list of postings of the thread when making your reply).
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
-
- Engineer
- Posts: 17
- Joined: 11 Oct 2013 23:20
Re: Another Daylength patch
Sorry, got used to another forum where you had a very limited time to edit your posts.planetmaker wrote:Can we please avoid double and tripple posts? You can edit your posts after creation. And when replying your can quote several postings easily by pressing 'quote' in the appropriate posts (by scrolling down further the list of postings of the thread when making your reply).
I dont know if this is the right place, but has anyone achieved patching the source with the automated timetables and this daylength patch? Those are the two things im really wishing i had before i start a new map
http://www.tt-forums.net/viewtopic.php?t=46391 (automated timetable)
Thanks!
Re: Another Daylength patch
I've ran into a bit of trouble getting the patch to work with current trunk:
now is
which conflicts with the patch adding this line:
Apparently CONDVARS aren't wanted anymore ...
Unfortunately I have absolute zero programming knowledge. Changing condvar to var compiles the game and it actually seems to be running fine, but, surprise surprise, newly made saves are corrupted/can't be loaded. Anything I can do about that? ^^;
€: to be more precise it crashes for saves with daylength set to not 1, at date.cpp "assert(fract < DAY_TICKS);".
Code: Select all
static const SaveLoadGlobVarList _date_desc[] = {
SLEG_CONDVAR(_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 30),
SLEG_CONDVAR(_date, SLE_INT32, 31, SL_MAX_VERSION),
SLEG_VAR(_date_fract, SLE_UINT16),
SLEG_VAR(_tick_counter, SLE_UINT16),
SLE_CONDNULL(2, 0, 156), // _vehicle_id_ctr_day
Code: Select all
static const SaveLoad _date_desc[] = {
SLEG_VAR(_date, SLE_FILE_U16 | SLE_VAR_I32, , , 0, 30),
SLEG_VAR(_date, SLE_INT32, 0, , 31, ),
SLEG_VAR(_date_fract, SLE_UINT16),
SLEG_VAR(_tick_counter, SLE_UINT16),
SLE_NULL(2, , , 0, 156), // _vehicle_id_ctr_day
Code: Select all
SLEG_CONDVAR(_date, SLE_INT32, 31, SL_MAX_VERSION),
SLEG_VAR(_date_fract, SLE_UINT16),
SLEG_VAR(_tick_counter, SLE_UINT16),
+ SLEG_CONDVAR(_tick_skip_counter, SLE_UINT8, 200, SL_MAX_VERSION),
SLE_CONDNULL(2, 0, 156), // _vehicle_id_ctr_day
SLEG_CONDVAR(_age_cargo_skip_counter, SLE_UINT8, 0, 161),
SLE_CONDNULL(1, 0, 45),
Unfortunately I have absolute zero programming knowledge. Changing condvar to var compiles the game and it actually seems to be running fine, but, surprise surprise, newly made saves are corrupted/can't be loaded. Anything I can do about that? ^^;
€: to be more precise it crashes for saves with daylength set to not 1, at date.cpp "assert(fract < DAY_TICKS);".
Re: Another Daylength patch
you probably need to replace the DAY_TICKS in this assert, to consider the daylength of the new savegame. and this is probably unrelated to the above conflict.
the difference between "VAR" and "CONDVAR" was that "CONDVAR" had a from-to range for the valid savegame versions. this difference was not very useful since all new things need CONDVAR anyway, so the two things were combined. so all "VAR" now have this range, with missing values filled with default. (0 and max)
the difference between "VAR" and "CONDVAR" was that "CONDVAR" had a from-to range for the valid savegame versions. this difference was not very useful since all new things need CONDVAR anyway, so the two things were combined. so all "VAR" now have this range, with missing values filled with default. (0 and max)
Re: Another Daylength patch
Mh. I thought about that, but none of the patch revs ever do anything in date.cpp, and also neither spring patch pack nor hard patch pack (always a good place to check for updated patches but currently both are too old ^^;). I tried changing it to DAY_TICKS_DAY_LENGTH (which the patch uses at some other point) but that makes it crash right at the start It's also I think a file virtually unchanged since quitealotofrevs.
That's basically why my mental connection went "game runs fine, but loading saves doesn't work" -> probably something to do with misc_sl, which is the only saveload thing that's changed. But I guess with your explanation that seems unlikely as well. Hm.
Oh well. There's only so far you can get with a bit of trial & error ^^; Thanks for trying to help though
That's basically why my mental connection went "game runs fine, but loading saves doesn't work" -> probably something to do with misc_sl, which is the only saveload thing that's changed. But I guess with your explanation that seems unlikely as well. Hm.
Oh well. There's only so far you can get with a bit of trial & error ^^; Thanks for trying to help though
Re: Another Daylength patch
the startup crash may be because order of setting initalization has changed, so at certain points there may be places where daylength has a value of 0. might need to guard against that.
since it's an assert, you can also just leave it out. it has no effect on how the program works, it's just a reminder to developers about preconditions this part of the code assumes
since it's an assert, you can also just leave it out. it has no effect on how the program works, it's just a reminder to developers about preconditions this part of the code assumes
Re: Another Daylength patch
That indeed did the trick. Thanks again, seems to work fine now
-
- Engineer
- Posts: 17
- Joined: 11 Oct 2013 23:20
Re: Another Daylength patch
Im sorry, but what did you do to fix the savegame crashes? Im having the same issue, and total noob!
Thanks
Thanks
Re: Another Daylength patch
In date.cpp line 38 I commented out the assertion:
...might as well just delete that line.// assert(fract < DAY_TICKS);
-
- Engineer
- Posts: 17
- Joined: 11 Oct 2013 23:20
Re: Another Daylength patch
Ok, deleted the line but still the issue.
I started a new test game, saved using 8 daylength, closed openttd, launched again, loaded and crash
I started a new test game, saved using 8 daylength, closed openttd, launched again, loaded and crash
Code: Select all
Error: Assertion failed at line 38 of /home/gabriel/openttd/src/date.cpp: fract < DAY_TICKS
Re: Another Daylength patch
Deleting a line in the source code doesn't change the binary program, you'll have to compile the source code again.
Edit: Anyway, "assert" usually means that the condition should always hold, or something very bad will happen.
Deleting the assert line will of course remove the check and the crash, but one should normally also make sure that nothing bad will happen when you run into the territory of values where the check would have failed.
(in other words, you remove an assert only after verifying that doing so will not cause any problem)
Edit: Anyway, "assert" usually means that the condition should always hold, or something very bad will happen.
Deleting the assert line will of course remove the check and the crash, but one should normally also make sure that nothing bad will happen when you run into the territory of values where the check would have failed.
(in other words, you remove an assert only after verifying that doing so will not cause any problem)
-
- Engineer
- Posts: 17
- Joined: 11 Oct 2013 23:20
Re: Another Daylength patch
Oh, little mistake by me then hehe.
So ill now remove the line before compiling. Will also do my best on checking if it causes problems.
Thanks for helping a new guy !
Edit: Worked like a charm now!
So ill now remove the line before compiling. Will also do my best on checking if it causes problems.
Thanks for helping a new guy !
Edit: Worked like a charm now!
Re: Another Daylength patch
Uggggh. This is so Confusing.
I just want to play with slower days.
I only play with the FIRS Industry Set and the FISH Ship set.
I downloaded the executable from page 14 on this thread.
Opened it up and downloaded FIRS and the FISH set and the OpenSFX and OpenMSX from the available online content.
Now how do I choose the daylength?
*edit*
Eureka I found it.
Now for my next question.
Instead of using that e xecutable. Is there a simple guide on how to get the current official Version to use this "True" Daylength Patch? It's impossible trying to sift through all the info on the threads, takes far too much time. I'm sure theres like 10 steps to getting the patch to work with the current build.... Just need the steps and I can do it.... Please
I just want to play with slower days.
I only play with the FIRS Industry Set and the FISH Ship set.
I downloaded the executable from page 14 on this thread.
Opened it up and downloaded FIRS and the FISH set and the OpenSFX and OpenMSX from the available online content.
Now how do I choose the daylength?
*edit*
Eureka I found it.
Now for my next question.
Instead of using that e xecutable. Is there a simple guide on how to get the current official Version to use this "True" Daylength Patch? It's impossible trying to sift through all the info on the threads, takes far too much time. I'm sure theres like 10 steps to getting the patch to work with the current build.... Just need the steps and I can do it.... Please
Re: Another Daylength patch
No, there's no simple steps to applying a patch to a current version of OpenTTD. You will need some familiarity with programming and modifying source files. If you're lucky you may be able to just apply the patch without having to make modifications, but considering that OpenTTD is a constantly-changing project, it is likely going to be trial-and-error. Apply the patch, compile, wait for it to fail, take a note of the errors and fix them. With any luck you'll finally end up with a patch that is updated and works. Feel free to share the source code of the patch here, and if you need help with specific issues feel free to ask.
Do you like drones, quadcopters & flying toys? Check out Drone Strike Force!
Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Re: Another Daylength patch
well, there are 3 "simple" steps.
- Install a compiling environment for your operating system as per http://wiki.openttd.org/Compiling and compile the unmodified version
- Compile a modified version of the revision the patch was originally written for
- update the patch in slower or faster steps.
Re: Another Daylength patch
Updated to current trunk. Problem only in save game version and game loop changed a bit.
edit: I noticed, that with this day length, I break the timetables. Updated patch included.
edit: I noticed, that with this day length, I break the timetables. Updated patch included.
- Attachments
-
- true_day_length_r26686.patch
- (8.01 KiB) Downloaded 547 times
My patches: Day length (new concept), Conditional loading, Auto separation, Unload all adds Leave empty, Better statue placement (in trunk)
My abandoned patches: Speed limits for RVs, Day length (old concept)
My abandoned patches: Speed limits for RVs, Day length (old concept)
-
- Transport Coordinator
- Posts: 260
- Joined: 09 Apr 2014 11:10
Re: Another Daylength patch
Thankyou for this patch, it has made the game playable again, I had sometimes over 100 trucks for each factory and 12 track wide train lines in places, and it still was not enough to move everything, on a large map with 3 players the lag soon causes desyncs. Now I can move everything with a good number of vehicles and realistic layout because they can make more trips per month.
Re: Another Daylength patch
lag never ever causes desync.
-
- Transport Coordinator
- Posts: 260
- Joined: 09 Apr 2014 11:10
Re: Another Daylength patch
server lags, stops sending data to clients, client connection times out, I don't know what else to call that other than desync, but that's besides the point. All I was trying to say was using this patch allows me to move the same amount of cargo with less vehicles, increasing my enjoyment of the game.
Re: Another Daylength patch
... calling a timeout a desync is like calling a derailment a plane crash....
Who is online
Users browsing this forum: No registered users and 2 guests