News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[Patch]Routing penalty signal (includes change of saving/paking)

Started by cfds, July 12, 2011, 03:24:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cfds

As discussed in the german forum (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
64bit Linux binary: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
32bit WinGDI binary http://simutrans-germany.com/patches/download.php?file=sim4692_4.zip
Pak(64)Addon: 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.

cfds

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

Andyh

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.

Erik

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.


cfds

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.

cfds

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)

Erik

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.


cfds

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...

Erik

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.


Andyh

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

cfds

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.

Erik

Quote from: 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.
...

Do you use the right makeobj?
Becouse of some changes the official makeobj 51 won't make the pak right for this.


cfds

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.

Andyh

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.

cfds

I can publish a Linux-Executable. The Windows variant fails due to mingw-libpng incombatibilities...

cfds

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).

Andyh

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.