Released a new update for r17455.Download here: r17455
(win32 binaries also in that post)
older post:Traffic Lights v3 released
Download here: r12951
- The function for getting the current state of a traffic light tile now looks up what traffic light consist that
tile is in and synches the state with the northernmost tile of the consist (actually: lowest TileIndex) (v2.3)
- Moved traffic light code into own files (trafficlight_func.h, trafficlight_type.h and trafficlight.cpp) (v2.4)
- If the patch setting for traffic lights is turned off during game, all existing traffic lights
are now deleted permanently. (v2.2)
- Reintroduction of varying switching times. (now not all TLs are switching states simultanuously anymore) (v2.3)
- New patch setting to limit size of traffic light consists. Standard is 4, includes a "no limit" option (0). (v2.3)
- Too high CPU usage (v2.1)
- If traffic lights were turned off during game, it was impossible to remove
roads that had traffic lights on them previously. (v2.2)
older post:Traffic Lights v2.1 released
Download here: r12905
- Traffic light tiles got marked "dirty" far too often, resulting in high CPU usage.Traffic Lights v2 released!
Download it here: r12812
- added new patch setting allow_building_tls_on_town_roads. See Features. (v1.1)
- added new settings road_trafficlight_penalty (yapf) and npf_road_trafficlight_penalty. See Features. (v1.2)
- New patch option: allow building/removing traffic lights on town owned roads. (v1.1)
- The NPF and YAPF pathfinders now have penalties for traffic lights. They are set to 200 by default,
you can tweak the settings in your openttd.cfg. (v1.2)
- A traffic light will now not be displayed on a side where there's a one way road so no vehicles can come from there [eye candy] (v1.3)
- Multi tile consists: multiple tiles with trafficlights adjacent to each other will result in one big traffic light junction.
See examples below. (v1.3)
- The query tool (question mark) will now tell you that there's a traffic light on the road. (v1.4)
- you can make traffic lights "invisible" by making every road next to it one way facing away. Then there's no
visual represenation that there are traffic lights on that tile. I don't really know how to adress that though..
(who would do something like this, anyways?)
Multi tile consist examples
- | : roads
< > ^ v : one way roads
+ : crossing (with TL placed on it)
"highway x normal road":
File comment: Traffic lights multi tile consists. New in version 2.
TL multi tile consists.png [ 36.28 KiB | Viewed 50489 times ]
older post:Traffic Lights v1 released!
edit: update for r12733
sorry that it's not quite the newest revision, i'll update it soon.
Download it here: r12628 r12733Changelog for v1:
- traffic lights are now controlled by game ticks instead of saving their status to the map array.
This reduces map array usage from 3 bits to 1 bit. Now only highest bit of m1 is "borrowed".
- this also kills the need of misusing the road construction bits for yellow state.
- created some tables to look up stuff instead of using switch cases.
- better savegame version handling
- Now, all traffic lights are switched at the same time due to the internal changes.
I might do something to return this to previous behavior if it is requested.
- The random road construction feature was removed and moved to a seperate patch in alpha2.1.
- Owner check. Now, you aren't allowed to build or remove traffic lights on opponents' or towns' roads any more.
older post:Alpha 2
(rediff for r12436)
Most noticeable change: The traffic lights now actually have a purpose (other than eyecandy). Meaning the drivers will not just bluntly ignore them anymore
Also there are some new features, but maybe you want to turn them off, so there are patch options for that now.
Due to the added patch options which are saved in savegames, there is no compatibility with savegames from previous versions of this patch.
This patch needs a valid trafficlight.grf to work. You can find in this thread trafficlight_light.grf
(works well with most roads), trafficlight_dark.grf
(better for light roads like in TTRS) and trafficlight_wooden.grf
(if you prefer brown ones). Please choose the one you like, put it into your data folder and rename it to trafficlight.grfDownload alpha 2 here: (r12276) | (r12318) | (r12436)Changelog for alpha 2:
- Randomize TL placement over the first half of road construction (chance per TileLoop: 5%; total chance: about 33%)
- Tell road vehicles to stop at red lights (and yellow and red-yellow aswell)
- Patch setting to enable/disable TLs
- Patch setting to enable TLs built by towns while road construction
- Patch setting for random road construction in towns
- Patch setting for duration of green/red phase
File comment: traffic lights at a road crossing with buses waiting
traffic lights buses.png [ 35.05 KiB | Viewed 54101 times ]
first public alpha!
After fixing a serious bug, I decided now that the patch is ready for a first alpha release Version alpha1.1
This patch needs a valid trafficlight.grf to work. I'm offering trafficlight_dark.grf and trafficlight_light.grf (thanks Soeb) to download, please choose the one you like, put it into your data folder and rename it to trafficlight.grf
Please note that this version is just eyecandy for now. Road vehicles will NOT stop at red lights. All other kinds of bug reports are welcome, though
Downloads hereChangelog for version alpha1.1:
- Reset roadworks counter properly in some cases, like removing a TL in yellow state, or if road works start on a TL'ed tile
- Draw TLs also without full details and in far zoom level.
- Unexpected behavior in scedit. Therefore, TL transition is now deactivated in scedit.
- Savegame version bumped to 90 (because loading patched savegame with trunk will result in previously TL'ed tiles to have wrong owner "someone")
- TLs stop operation if their tile has roadworks.
- TLs are now displayed while road construction. All sides are set to red. (will be changed to colorless as soon as i have the sprite)
- Adapted new hold-CTRL code for removing trafficlights.
- Changed internals to allow seven states.
- Newly built traffic lights are turned OFF until TileLoop first happens for their tile.
- Towns build traffic lights on junctions after road construction with a chance (of currently 50%)
- New traffic light transition using six states: red/green, red/yellow, red-yellow/red, green/red, yellow/red and red/red-yellowScreenshot for alpha1.1:
If you're wondering why I didn't do any upgrades to my other patches lately, this is the reason.
I started a new patch project in order to learn some more about different parts of OpenTTD. I did learn a lot up until now, e.g. about sprites, the tilemap, animation of tiles and some more.
But enough about that for now, so what is this patch about?
This patch is aiming to introduce traffic lights, which can be placed on road junctions. Ideally (
), road vehicles will wait in front of a red light until it turns green. I don't really know if this will have any positive use on traffic, and I doubt it, as long as RVs are allowed to drive through each other on crossings etc. So i guess some of you will be rather objective towards this patch, as it seemingly makes the conditions for RVs only worse than they are now.
BUT, i have hope that some of you may like it, even just for its eyecandy-ness
It might also bring a splash of (*yuk*
) realism if the towns will place a heap of traffic lights inside the town, so you'll maybe build roads around a town for your trucks to avoid the inner city where they would wait in front of red lights...
Now after the introduction, the obligatory teaser screen shot
Note that it's only eye candy up until now, RVs will just ignore any traffic lights
- Store traffic lights in tile map (m1 bit 5-7 for those interested, I know, meh, but it's so cramped :/)
- Sprites for all 4 directions and all 4 states (red, red-yellow, green, yellow).
- Individually placed traffic lights, depending on junction (3-way, 4-way...)
- consistency check for removing roads (no traffic lights allowed on straight road or curve
- state transistion: switch to yellow/red-yellow every TileLoop, go on to green/red 16 AnimateTiles later (uses the road construction bits for counting)
- driving side support: the traffic lights will be on the driving side specified in the options window
Currently unimplemented, but planned:
- teach pathfinder to stop at red lights
- don't place traffic light at a one way road leading away from the junction
- chained multi tile junction consists
- only owner of road tile may place/remove TLs
- towns place their own TLs
... some more I don't recall right now
okay, that's basically it. Here's the sprites I used (drawn myself):
if you want you can supply me with some better ones
or just post what you think about the idea and so on...
edit: removed old images