Page 16 of 20

Re: Another Daylength patch

Posted: 04 Mar 2014 07:42
by planetmaker
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).

Re: Another Daylength patch

Posted: 04 Mar 2014 15:08
by gabrielbyrnei
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).
Sorry, got used to another forum where you had a very limited time to edit your posts.

:)


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

Posted: 19 Apr 2014 14:02
by Pyoro
I've ran into a bit of trouble getting the patch to work with current trunk:

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
now is

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
which conflicts with the patch adding this line:

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),
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);".

Re: Another Daylength patch

Posted: 19 Apr 2014 15:17
by Eddi
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)

Re: Another Daylength patch

Posted: 19 Apr 2014 15:44
by Pyoro
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 :)

Re: Another Daylength patch

Posted: 19 Apr 2014 16:20
by Eddi
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

Re: Another Daylength patch

Posted: 19 Apr 2014 17:27
by Pyoro
That indeed did the trick. Thanks again, seems to work fine now :)

Re: Another Daylength patch

Posted: 21 Apr 2014 21:49
by gabrielbyrnei
Im sorry, but what did you do to fix the savegame crashes? Im having the same issue, and total noob!

Thanks

Re: Another Daylength patch

Posted: 22 Apr 2014 07:08
by Pyoro
In date.cpp line 38 I commented out the assertion:
// assert(fract < DAY_TICKS);
...might as well just delete that line.

Re: Another Daylength patch

Posted: 22 Apr 2014 13:47
by gabrielbyrnei
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 :(

Code: Select all

Error: Assertion failed at line 38 of /home/gabriel/openttd/src/date.cpp: fract < DAY_TICKS

Re: Another Daylength patch

Posted: 22 Apr 2014 17:10
by Alberth
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)

Re: Another Daylength patch

Posted: 22 Apr 2014 17:33
by gabrielbyrnei
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!

Re: Another Daylength patch

Posted: 03 May 2014 06:07
by Transnova
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 :D

Re: Another Daylength patch

Posted: 03 May 2014 07:52
by kamnet
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.

Re: Another Daylength patch

Posted: 03 May 2014 10:39
by Eddi
well, there are 3 "simple" steps.
  1. Install a compiling environment for your operating system as per http://wiki.openttd.org/Compiling and compile the unmodified version
  2. Compile a modified version of the revision the patch was originally written for
  3. update the patch in slower or faster steps.

Re: Another Daylength patch

Posted: 18 Jul 2014 15:42
by pavel1269
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.

Re: Another Daylength patch

Posted: 03 Aug 2014 09:12
by Eddy Arfik
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

Posted: 03 Aug 2014 12:30
by Eddi
lag never ever causes desync.

Re: Another Daylength patch

Posted: 03 Aug 2014 13:06
by Eddy Arfik
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

Posted: 03 Aug 2014 19:58
by Eddi
... calling a timeout a desync is like calling a derailment a plane crash....