Page 6 of 10

Re: Traffic lights (r13411)

Posted: 16 Jul 2009 14:07
by hwndmaster
So separate GRF isn't possible? Is this feature (Traffic Lights) compiled to some binary file?

If yes, could someone who know these routines share patched binary file with us? (exe / dat?)

Thanks

Re: Traffic lights (r13411)

Posted: 16 Jul 2009 14:10
by Yexo
hwndmaster wrote:So separate GRF isn't possible?
Yes, that's exactly what I said in my previous post.
Is this feature (Traffic Lights) compiled to some binary file?
Maybe.
If yes, could someone who know these routines share patched binary file with us? (exe / dat?)
If there is a patched binary, you'll find it in this topic. Don't be afraid to do some reading / searching yourself. If you don't find it, the only way will be to compile openttd yourself.

Re: Traffic lights (r13411)

Posted: 28 Jul 2009 12:48
by hwndmaster
Attempted to apply latest .diff to latest revision of OpenTTD in SVN (used TortoiseSVN) and got very many conflicts.

I don't know how the source of OpenTTD works and attempted to resolve them (conflicts) by intuition. It did not help me - VS2008 shows many errors.

Do you planning to update .diff for the latest version of OpenTTD sources?

Re: Traffic lights (r13411)

Posted: 28 Jul 2009 15:22
by DaleStan
hwndmaster wrote:Attempted to apply latest .diff to latest revision of OpenTTD in SVN (used TortoiseSVN) and got very many conflicts.
Try using the version specified in the patch (quite likely 13411)

Re: Traffic lights (r13411)

Posted: 28 Jul 2009 18:25
by Roujin
hwndmaster wrote:Do you planning to update .diff for the latest version of OpenTTD sources?
I'm currently not planning to update this patch. Your best bet is to use on the revision it was made for, as DaleStan suggested.

Re: Traffic lights (r13411)

Posted: 28 Jul 2009 18:43
by Zephyris
Which is sad because I like this patch :(

Re: Traffic lights (r13411)

Posted: 28 Jul 2009 21:46
by 2007Alain2007
so do many but no one seem to want or have the skills to update the pacth

Re: Traffic lights (r13411)

Posted: 06 Sep 2009 18:48
by Gedemon
For my personnal use I've updated this patch to r17420, I'm posting it here for those who are still interested.

:!: you'll need to update savegame version manually

Re: Traffic lights (r13411)

Posted: 06 Sep 2009 20:12
by Zephyris
Mmm, good to see this back up to date, how many changes were needed?

Re: Traffic lights (r13411)

Posted: 06 Sep 2009 20:57
by Roujin
Nice :) Sorry for not updating it myself, got busy with other things. ;)
But why didn't you include the savegame bump in your patch? Other users who want to use it might not understand how to do it...

---
mmh, I just looked at this code again first time since a long time :lol: I'm missing one little thing.. didn't I insert some hack to restrict usage of the m1 byte in other places to bits 0-6, so I could use bit 7 for the traffic lights? Because that bit was not declared as "free" but only "used but without meaning" (see docs/landscape_grid.html). Gotta check my old patch... edit: forget what I said, your update still contains said hack, I just didn't see it while browsing through for the 1st time.

Anyway, I should probably change it to m6 bit 2 or m7 bit 4, as appearently those are free nowadays (r17435) (back in r13411 they weren't)

That will break savegames though (well, not completely break, but existing TLs would vanish).

hmmm
damn you (not meant seriously! :mrgreen: ) for updating the patch.. I'll end up making a new version like this... ;)

Re: Traffic lights (r13411)

Posted: 06 Sep 2009 23:14
by Gedemon
Zephyris wrote:Mmm, good to see this back up to date, how many changes were needed?
enough for me this WE :O

but almost no change to the core of the patch.
Roujin wrote:Nice :) Sorry for not updating it myself, got busy with other things. ;)
But why didn't you include the savegame bump in your patch? Other users who want to use it might not understand how to do it...
I find it easier to bump the whole when making a patch pack for myself, so I post it as it was on my computer. But you're right, it should be kept in public version. (and now that you're back on it... :mrgreen: )

Re: Traffic lights (r13411)

Posted: 07 Sep 2009 02:37
by Roujin
Alright, here is the promised update. Special thanks to Gedemon for doing all the tedious work (updating 4k revisions).

edit: removed due to saveload flaw. fixed version will be uploaded shortly.

Changelog:

Code: Select all

* savegame version bump
* fixed inconsistency regarding tram tracks: now they are equal to roads regarding TLs.
If there are at least three roadbits of any kind, a TL is allowed on the tile.
Also added button to build tramway toolbar.
* fixed error string that would never appear ("Must remove traffic light first") when
removing roadbits so there would be less than three left.
* increased performance by not drawing traffic lights when zoomed out
(can't see them properly anyway)
* Bundle advanced settings into own section

I'd like to point out a small feature of this patch maybe not all of you know: There is a trafficlight penalty added for both the NPF and YAPF pathfinder. It is a "hidden" setting, not found in the GUI, so you have to set it inside your openttd.cfg or using the console in a running game.
The settings are named "pf.npf.npf_road_trafficlight_penalty" and "pf.yapf.road_trafficlight_penalty", respectively.
So what does it do? It causes vehicles to avoid traffic lights by a certain degree (you can finetune it by setting the value to something higher/lower. The higher the value, the more the vehicle will avoid traffic lights).
For example in the screenshot below, there's a town with a ridiculous amount of traffic lights, so trucks will take the route around the town even if it's quite a detour.
TL penalty 2.png
(273.75 KiB) Downloaded 74 times
As a final note, imo this patch works well together with another (small) patch I made, random road construction. Together with the setting "towns build traffic lights during road construction", it will result in towns constructing some traffic lights by themselves after some time.

Have fun. :)

Re: Traffic lights (r13411)

Posted: 07 Sep 2009 02:44
by Comm Cody
If this was merged with Improved RV acceleration, I would fall over dead.
May you please provide a Binary?

Re: Traffic lights (r17438)

Posted: 07 Sep 2009 03:37
by petert
Win32 binary. Trafficlight.grf included.

Re: Traffic lights (r17438)

Posted: 07 Sep 2009 14:16
by Comm Cody
The Binary is of (Ahem) Poor quality. It crashes every time i build something. I waiting for roujin to post one. But thank you for trying Petert.

Re: Traffic lights (r17438)

Posted: 07 Sep 2009 14:20
by Roujin
Comm Cody wrote:The Binary is of (Ahem) Poor quality. It crashes every time i build something. I waiting for roujin to post one. But thank you for trying Petert.
That is strange. I can't imagine that being caused by a mistake in compiling. Could you describe what exactly you did so it crashed, so I can check?
Anyway, above patch (I removed it now) contained a mistake by me. That one should have had no impact on building anything though, only on loading trunk savegames (that failed with a crash). I'm uploading a new one shortly.

Re: Traffic lights (r17438)

Posted: 07 Sep 2009 14:53
by Comm Cody
When i went to build a station using drag and drop, my game went to desktop whining about mingwin or the compiler and booted me out of OTTD. so I put the Binary in the recycling bin.

Re: Traffic lights (r17438)

Posted: 07 Sep 2009 15:16
by Roujin
Here it is. New version for r17455.
trafficlights_r17455.diff
traffic lights for r17455
(50.29 KiB) Downloaded 994 times
Fix: loading trunk savegames.

Please, if you downloaded the one from earlier, use this one instead. The old one messed up saveload stuff badly. Savegames are not compatible between this one and the previous one. Loading games from clean trunk should work now, though.

Here's a win32 binary. Hope it works for you.
trafficlights_r17455_win32_bin.zip
traffic lights for r17455 win32 binaries
(3.34 MiB) Downloaded 2180 times

Re: Traffic lights (r17438)

Posted: 07 Sep 2009 15:58
by petert
Roujin wrote:
Comm Cody wrote:The Binary is of (Ahem) Poor quality. It crashes every time i build something. I waiting for roujin to post one. But thank you for trying Petert.
That is strange. I can't imagine that being caused by a mistake in compiling. Could you describe what exactly you did so it crashed, so I can check?
Anyway, above patch (I removed it now) contained a mistake by me. That one should have had no impact on building anything though, only on loading trunk savegames (that failed with a crash). I'm uploading a new one shortly.
Sorry Comm Cody, but I didn't write the patch, try the link from above this post.

Re: Traffic lights (r17455)

Posted: 14 Sep 2009 20:20
by Kosov_1986
hello,

sorry, but will you put this into trunk in the future?