The International Simutrans Forum

Development => Patches & Projects => Topic started by: cfds on July 12, 2011, 03:24:08 PM

Title: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on July 12, 2011, 03:24:08 PM
As discussed in the german forum (http://simutrans-forum.de/forum/thread.php?threadid=6380 (http://simutrans-forum.de/forum/thread.php?threadid=6380)) I built a signal that discourages the router to use the way across the signal by adding a value (that is defined in the .dat-file) in the get_kosten() call of waggons and automobiles. Since this made 16bit flags for signals necessary I included Eriks announce signal patch and slightly modified the handling of the minSpeed-Sign (it gets an own flag, too), this sign will have to be repaked with new version of makeobj. This patch (as Erik's) changes the savegame/pak version to 4.

Links:
Patchfile http://simutrans-germany.com/patches/download.php?file=newsignals.patch (http://simutrans-germany.com/patches/download.php?file=newsignals.patch)
64bit Linux binary:http://simutrans-germany.com/patches/download.php?file=sim64_4.zip (http://simutrans-germany.com/patches/download.php?file=sim64_4.zip)
32bit Linux binary:http://simutrans-germany.com/patches/download.php?file=sim32_4.zip (http://simutrans-germany.com/patches/download.php?file=sim32_4.zip)
32bit WinGDI binary http://simutrans-germany.com/patches/download.php?file=sim4692_4.zip (http://simutrans-germany.com/patches/download.php?file=sim4692_4.zip)
Pak(64)Addon: http://simutrans-germany.com/patches/download.php?file=addon.zip (http://simutrans-germany.com/patches/download.php?file=addon.zip) (Penalty signal and repacked minimum80)

Structure of penalty signal .dat-file:
obj=roadsign
name=PenaltySignal
copyright=cfds_dom700
waytype=track
cost=1500
penalty_sign=20
[image stuff]

for a penalty sign with 20 penalty points (for comparison: hill up is 25)

Please leave feedback.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on July 23, 2011, 03:41:58 PM
I updated my patch with:
-Dialog to set the routing penalty (similar to traffic lights)
-A signal that just closes the track without prompting trains to look for a new route (just a signal that never switches to green, perfect to clear a piece of track for recontruction measures

New executables, pak and patch:
Patchfile http://simutrans-germany.com/patches/download.php?file=signals.patch
64bit Linux binary http://simutrans-germany.com/patches/download.php?file=sim4711_4.zip
32bit Linux binary http://simutrans-germany.com/patches/download.php?file=sim4711_4_linux32.zip
32bit WinGDI binary http://simutrans-germany.com/patches/download.php?file=sim4711_4_win32gdi.zip
Pak(64)Addon: http://simutrans-germany.com/patches/download.php?file=signalsaddon.zip
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Andyh on July 26, 2011, 09:45:23 PM
This sounds great!  I've downloaded the patch; how do I apply it?

Also makes me think: is there a way to include this route finding penalty into into regular traffic lights?  Logically a bus or truck would want to avoid routes that contained a large number of traffic lights, but I've noticed that they don't appear to have an impact on route selection.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Erik on July 27, 2011, 10:22:05 AM
Would be a nice signal.

Perhaps I would build a signal for pak 128 and test it.
But it has to wait  few weeks.
I'm quiet busy at the moment.

Nice to hear that my efforts on the announce signal are helpfull.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on July 29, 2011, 06:17:27 AM
To apply the patch just download the appropriate executable and put it into your simutrans program folder. Then download the pak-Addon and extract it to your addon pak folder (typically in home/[user]/simutrans on linux systems and in [Own Documents]\simutrans\ on windows systems).

Savegames created with the new executable cannot be opened with an older version of simutrans, so keep a copy of your savegame.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on July 31, 2011, 11:52:07 AM
A new version (based on r4721) that addresses problems with the not save-safe variable signal_speed_limit from Erik's patch (yes, looking at you, erik). Now there should be no longer any strangely slow trains lurking about.

Links:
http://www.eckental-brand.de/sim4721_4.zip (linux64bit)
http://www.eckental-brand.de/sim4721_4linux32.zip (linux32bit)
http://www.eckental-brand.de/sim4721_4_win32gdi.zip (windows 32bit gdi)
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Erik on August 06, 2011, 02:41:06 PM
Was that still a case?

I tough it was solved.
If you saved the game, the variable "speed_limit" would be saved.
By starting up the game, the variable "signal_speed_limit" is set on Unlimited so the train would use his "speed_limit" variable.
The "signal_speed_limit" is only used if the train approach the signal.

By not making new save variables, then the saved game is still usable for other versions (older when needed).
It also keeps the save files smaller.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on August 07, 2011, 12:04:58 PM
I used the patch from this forum and there the signal_speed_limit is not set after loading (I did it in set_convoi(), since it is called after loading). I also set signal_speed_limit to SPEED_UNLIMITED in the constructor and "repaired" the graphic selection part (On electrified tracks your announce signal showed sometimes weird images since the check for 3 phases is only done for the presignal).

[Edit] Perhaps I should have posted this to your thread...
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Erik on August 07, 2011, 01:47:16 PM
Oops.
Totally forgotten to test it with electified tracks.
I hope having some time to change it soon.

At any way.
I wand to make a whole new way of managing the signals and trains if I have finished a other project (NS-pakset V2.0).
Your idea of routing penalty signal is also very useful for that.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Andyh on August 10, 2011, 05:04:17 AM
I'm struggling to get this patch to work.  Can anyone see what I'm doing wrong?

I'm using pak128.  I created a simple sign model and made a set of images.  Then I created a .dat file using the format given in this thread.  Then I created a pak file - using pak helper 3.2 - based on my images and the dat file.  I put the pak file in my pak128 folder and downloaded the executable (sim4721_4) and put that in my Simutrans folder.  I ran the executable but was unable to see my sign on any of the menus.  Do I need to do something in Menuconfig as well to get this to work?

Thanks

Andrew
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on August 10, 2011, 10:06:48 AM
It should work out of the box. I do not know if pak_helper checks the .dat file for mistakes and just erases the offending line. I will check this afternoon with pak128 and post the results.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Erik on August 10, 2011, 11:35:51 AM
I'm struggling to get this patch to work.  Can anyone see what I'm doing wrong?

I'm using pak128.  I created a simple sign model and made a set of images.  Then I created a .dat file using the format given in this thread.  Then I created a pak file - using pak helper 3.2 - based on my images and the dat file.  I put the pak file in my pak128 folder and downloaded the executable (sim4721_4) and put that in my Simutrans folder.
...

Do you use the right makeobj?
Becouse of some changes the official makeobj 51 won't make the pak right for this.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on August 10, 2011, 02:58:12 PM
Yes, you have to compile makeobj with my changed code. If you don't want to (or can) do this just send me the graphics and I will make a pak-file for you.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Andyh on August 10, 2011, 07:59:34 PM
That would be the problem.  I was simply using the standard MakeObj.

Thanks cfds for the offer to create a pak file for me, but do you think you could put a compiled version of the modified MakeObj executable on the Simutrans-Germany site?  That way I (and others) could create/modify signs as we wanted.
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on August 11, 2011, 07:56:11 AM
I can publish a Linux-Executable. The Windows variant fails due to mingw-libpng incombatibilities...
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: cfds on August 23, 2011, 08:54:57 AM
I loaded a new patchfile and a batch of patched executables to http://simutrans-germany.com/patches/filelist.php, including makeobj for win32 and linux64 (linux32 has to wait until I figure out how to compile libpng15 for multilib).
Title: Re: [Patch]Routing penalty signal (includes change of saving/paking)
Post by: Andyh on August 23, 2011, 06:14:03 PM
Thanks cdfs, I'll try out my pak128 sign with the win32 makeobj tonight.

Update 8/25: tried it last night.  Signal works a treat.  Thanks a lot for this patch cdfs.