Traffic lights (r17455)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
hwndmaster
Engineer
Engineer
Posts: 4
Joined: 16 Jul 2009 10:09

Re: Traffic lights (r13411)

Post 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
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Traffic lights (r13411)

Post 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.
hwndmaster
Engineer
Engineer
Posts: 4
Joined: 16 Jul 2009 10:09

Re: Traffic lights (r13411)

Post 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?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Traffic lights (r13411)

Post 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)
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Traffic lights (r13411)

Post 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.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Traffic lights (r13411)

Post by Zephyris »

Which is sad because I like this patch :(
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Traffic lights (r13411)

Post by 2007Alain2007 »

so do many but no one seem to want or have the skills to update the pacth
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
Gedemon
Traffic Manager
Traffic Manager
Posts: 150
Joined: 29 Apr 2004 21:53

Re: Traffic lights (r13411)

Post 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
Attachments
r17420_trafficlights.patch
(48.82 KiB) Downloaded 227 times
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Traffic lights (r13411)

Post by Zephyris »

Mmm, good to see this back up to date, how many changes were needed?
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Traffic lights (r13411)

Post 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... ;)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Gedemon
Traffic Manager
Traffic Manager
Posts: 150
Joined: 29 Apr 2004 21:53

Re: Traffic lights (r13411)

Post 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: )
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Traffic lights (r13411)

Post 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. :)
Last edited by Roujin on 07 Sep 2009 14:16, edited 4 times in total.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Comm Cody
Tycoon
Tycoon
Posts: 1060
Joined: 07 Mar 2008 22:21
Location: In a galaxy far far away.

Re: Traffic lights (r13411)

Post by Comm Cody »

If this was merged with Improved RV acceleration, I would fall over dead.
May you please provide a Binary?
Something goes here, hell if I know.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Traffic lights (r17438)

Post by petert »

Win32 binary. Trafficlight.grf included.
Attachments
trafficlights_win32_r17432.zip
(3.87 MiB) Downloaded 381 times
User avatar
Comm Cody
Tycoon
Tycoon
Posts: 1060
Joined: 07 Mar 2008 22:21
Location: In a galaxy far far away.

Re: Traffic lights (r17438)

Post 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.
Something goes here, hell if I know.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Traffic lights (r17438)

Post 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.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Comm Cody
Tycoon
Tycoon
Posts: 1060
Joined: 07 Mar 2008 22:21
Location: In a galaxy far far away.

Re: Traffic lights (r17438)

Post 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.
Something goes here, hell if I know.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Traffic lights (r17438)

Post by Roujin »

Here it is. New version for r17455.
trafficlights_r17455.diff
traffic lights for r17455
(50.29 KiB) Downloaded 889 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 1993 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Traffic lights (r17438)

Post 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.
User avatar
Kosov_1986
Traffic Manager
Traffic Manager
Posts: 248
Joined: 01 May 2006 14:37
Location: Pecs, Hungary
Contact:

Re: Traffic lights (r17455)

Post by Kosov_1986 »

hello,

sorry, but will you put this into trunk in the future?
Kosov from the depths of East Europe!


My English isn't good but i never use translating programs :D

I had a Chinese gf, for 3 days, now she's in Germany because she studies there... she was my first serious gf.

Minibus topic, (Renault-Ikarus 546 released by wyctor) http://www.tt-forums.net/viewtopic.php?t=25662

Ikarus buses from all around the world! http://www.tt-forums.net/viewtopic.php?t=26985
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 39 guests