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

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [WIP]Traffic lights

Post by Roujin » 18 Feb 2008 17:33

First public alpha(1.1) released!

Please also check the first post for instructions, the changelog and a screenshot.
Attachments
trafficlights_dark.grf
dark version of the trafficlights.
rename to trafficlights.grf before usage
(2.03 KiB) Downloaded 1018 times
trafficlights_light.grf
light version of the trafficlights.
rename to trafficlights.grf before usage
(2.03 KiB) Downloaded 1511 times
trafficlights_alpha1.1_r12178.diff
traffic lights patch for r12178
(29.67 KiB) Downloaded 402 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

Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Alpha 1.1 released] Traffic lights

Post by Trond » 19 Feb 2008 09:17

Roujin wrote: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)
I just put this patch (together with a couple of others I like to use) on r11285, and I cannot see an TL's when doinf roadreconstruction... Now ofcoz, this could be becoz of the other patches, and it could also be becoz I used a newer version that what the patch is made for, just tought I'd mention it... Will try to patch now with only this one and see if it makes any difference...

Looks great tough, very cool, but, and I havent looked into this, where trafficlights invented as early as 1950?

Also some lights seem to be a tad misplaced, look at this tl in the garden of those people... I'd be so upset if that happened to me :lol:
I'm aware this is alpha, just letting you know :)

EDIT: Compiled at r11278 and still no tl's with roadconstruction... using opengfx road if I'm not mistaken... fyi only :)
Attachments
Clipboard01.png
Clipboard01.png (14.03 KiB) Viewed 10197 times
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Alpha 1.1 released] Traffic lights

Post by Roujin » 19 Feb 2008 09:56

Trond wrote:
Roujin wrote: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)
I just put this patch (together with a couple of others I like to use) on r11285, and I cannot see an TL's when doinf roadreconstruction... Now ofcoz, this could be becoz of the other patches, and it could also be becoz I used a newer version that what the patch is made for, just tought I'd mention it... Will try to patch now with only this one and see if it makes any difference...

Looks great tough, very cool, but, and I havent looked into this, where trafficlights invented as early as 1950?

Also some lights seem to be a tad misplaced, look at this tl in the garden of those people... I'd be so upset if that happened to me :lol:
I'm aware this is alpha, just letting you know :)

EDIT: Compiled at r11278 and still no tl's with roadconstruction... using opengfx road if I'm not mistaken... fyi only :)
with TL in the garden, do you mean this one? (marked with red ?)
this one?
this one?
Clipboard01.png (13.96 KiB) Viewed 10174 times
The pole of this traffic light starts down where i marked with some blue pixels, so it's not really in that garden, but in front of it (perspectively). It's a bit hard to see those pixels down there.. Maybe you want to try the lighter ones, if you're using the OpenGFX roads anyways I think the lighter ones fit better. (But of course it's also a matter of personal taste)

Thanks for telling me about the road construction. Maybe the new road construction sprites somehow draw over my traffic lights and hides them. I'll look into that..
but to be perfectly sure that we're talking about the same thing: deactivated traffic lights are only shown if road constructions start on a tile that had traffic lights before.
If road construction start on a crossing which didn't have TLs before, only at the end of road construction, with a chance of 50%, TLs will appear.
* @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

Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Alpha 1.1 released] Traffic lights

Post by Trond » 19 Feb 2008 10:03

Yes, thats the one I meant, but I see what you mean and will try with the light ones later when I have some time again.

Got you. I understood it so that when they started to dig they would put up temporarely trafficlights during the time of construction... Now I understand, and no wonder there are no trafficlights there... my bad... so everything is working fine then :)

Quick test, works as intended. Trafficlights turn red when roadworks are active, and with no trafficlights at start of reconstruction, they put up several when finnished. So everything I said earlier was wrong... You even was correct that the light TL's worked better :bow:
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish

User avatar
DeletedUser5
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 07 Oct 2007 15:10

Re: [Alpha 1.1 released] Traffic lights

Post by DeletedUser5 » 19 Feb 2008 10:59

Works great. As soon as vehicles will stop on red light it will be better. Could you also change time? Let's say 20 seconds green, 5 seconds red. Red-yellow and yellow for 2 seconds. Or maybe a patch option to change it by yourself.

@EDIT: And new version of lights. I've made them wooden this time ( they don't look as Roujin's one ).
Attachments
trafficlights_wooden.grf
(2.03 KiB) Downloaded 384 times

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Alpha 1.1 released] Traffic lights

Post by Roujin » 19 Feb 2008 17:40

Trond wrote:Yes, thats the one I meant, but I see what you mean and will try with the light ones later when I have some time again.

Got you. I understood it so that when they started to dig they would put up temporarely trafficlights during the time of construction... Now I understand, and no wonder there are no trafficlights there... my bad... so everything is working fine then :)

Quick test, works as intended. Trafficlights turn red when roadworks are active, and with no trafficlights at start of reconstruction, they put up several when finnished. So everything I said earlier was wrong... You even was correct that the light TL's worked better :bow:
I could change it so that they put up the TLs at the beginning of road construction (with a chance of 50% of course). Would you find that more realistic than putting them up at the end? I don't know how it is in RL... If they decide to install traffic lights, do they put up the posts at the very end (after say having installed all the wiring under the ground), or do they put up the posts first?
Hmm now that I think about it, I could also rewrite the thing a bit, to allow the TLs to appear some time while the road construction.
Road construction lasts for 16 TileLoops. I could make it for example so that the first 8 TileLoops each have a chance of 5% for a Traffic Light being placed. This results in a total chance of about 33% for a TL being placed during road construction, and it will be placed sometime during the first half of road construction.
Or distribute it over the whole time of road construction?

How would you find it most realistic? When during road construction are the light poles set up?
Soeb wrote:Works great. As soon as vehicles will stop on red light it will be better. Could you also change time? Let's say 20 seconds green, 5 seconds red. Red-yellow and yellow for 2 seconds. Or maybe a patch option to change it by yourself.

@EDIT: And new version of lights. I've made them wooden this time ( they don't look as Roujin's one ).
How do you mean that, 20 seconds green, 5 seconds red? While two sides are red, the other two sides are green so I can't see how one could make the green phase longer than the red phase... oO

Generally, like the traffic lights are handled now, it's hard to make changes to the duration. For the yellow and red-yellow phase, I currently use 16 AnimateTiles (i can only count up to 16 with the internal structure i'm using). I could shorten that to anything down to 1 AnimateTile (that means 16 times shorter than it is now). If I want to increase it, I'd have to make it as long as a green/red phase is currently. And that is awfully long for a yellow phase if you ask me.
For the green/red phase, I could also use counting (up to 16) here, and thus multiply the duration by the factor n (where n between 1 and 16).

I could also make that as a patch option then. Like "Traffic light green/red phase duration" (between 1 and 16). But 16 would be awfully long. That's as long as a road construction oO

---
@New version of lights: maybe before invention of the traffic lights, there were some wooden, mechanical traffic "lights", much like the semaphores for railway? I just thought about that when I tested your new sprites...
* @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
DeletedUser5
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 07 Oct 2007 15:10

Re: [Alpha 1.1 released] Traffic lights

Post by DeletedUser5 » 19 Feb 2008 17:52

I didn't though about that. My fault. I though there is some way ( yeah, I know it's hard to do it ) so you can change time ( in seconds ) for red/green state in patch options. If there isn't any way to do it, leave it as it is now.

User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: [Alpha 1.1 released] Traffic lights

Post by athanasios » 19 Feb 2008 23:46

Trond wrote:... and I havent looked into this, where trafficlights invented as early as 1950?
:P Wikipedia can be your friend:
On 10 December 1868, the first traffic lights were installed outside the British Houses of Parliament in London, by the railway engineer J. P. Knight. They resembled railway signals of the time, with semaphore arms and red and green gas lamps for night use. The gas lantern was turned with a lever at its base so that the appropriate light faced traffic. Unfortunately, it exploded on 2 January 1869, injuring the policeman who was operating it.

The modern electric traffic light is an American invention. As early as 1912 in Salt Lake City, Utah, policeman Lester Wire invented the first red-green electric traffic lights. On 5 August 1914, the American Traffic Signal Company installed a traffic signal system on the corner of 105th Street and Euclid Avenue in Cleveland, Ohio. It had two colours, red and green, and a buzzer, based on the design of James Hoge, to provide a warning for colour changes. The design by James Hoge (USPTO # 1251666 Sept. 22, 1913) allowed Police and Fire stations to control the signals in case of emergency. The first four-way, three-colour traffic light was created by police officer William Potts in Detroit in 1920. In 1923, Garrett Morgan patented a traffic signal device, although it was not a precursor of the modern traffic light.

The first interconnected traffic signal system was installed in Salt Lake City in 1917, with six connected intersections controlled simultaneously from a manual switch. Automatic control of interconnected traffic lights was introduced March 1922 in Houston, Texas. The first automatic experimental traffic lights in England were deployed in Wolverhampton in 1927.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.

Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Alpha 1.1 released] Traffic lights

Post by Trond » 20 Feb 2008 05:32

If I'm not mistaken, the usually put up the tl poles quite early in the process, but I must admit I havent been very interested in this in rl, so I havent really looked for it :D I think putting them up some time during the construction, random, would be best...

Thanks athanasios, now we know :P When reading your paste from wikip. I can even remember this from some movies :) So no doubt was there tl's in 1950... Now, to make the 1920 tl's, I guess the hard part for Roujin is to code that policeman to go around firing up the lights :lol:
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish

User avatar
WWTBAM
Moderator
Moderator
Posts: 3682
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: [Alpha 1.1 released] Traffic lights

Post by WWTBAM » 20 Feb 2008 06:23

You could have a policeman satnding in the miidle of the interection holding his hand up in the direction of red and have it switch to the other direction for green. Yellow would be either the green or the red sprite as IRL policemen can see if there is a vehicle comming and if not switch to the side that needs to go.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/

User avatar
DeletedUser5
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 07 Oct 2007 15:10

Re: [Alpha 1.1 released] Traffic lights

Post by DeletedUser5 » 20 Feb 2008 07:16

In actual zoom level he won't be visible. And we can't make him too big. If we want to make him visible, he needs to be at least as big as vehicle.

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Alpha 1.1 released] Traffic lights

Post by Roujin » 20 Feb 2008 10:28

Soeb wrote:I didn't though about that. My fault. I though there is some way ( yeah, I know it's hard to do it ) so you can change time ( in seconds ) for red/green state in patch options. If there isn't any way to do it, leave it as it is now.
Well, I'll maybe put in the option for red/green state like I suggested above. If I misuse the road construction counter for my stuff anyways, why not use it for the red/green phase as well :mrgreen: but that won't be in seconds. Only a scale from 1 to 16..
athanasios wrote:
Trond wrote:... and I havent looked into this, where trafficlights invented as early as 1950?
:P Wikipedia can be your friend:
[...]
Okay, with that I think we can safely use traffic lights without breaking too much realism ;) But if you like, and if i'm provided with sprites, I could include "semaphore traffic lights" like the stuff mentioned in wikipedia plus a patch setting "use semaphore traffic lights prior to Year xxxx". In year xxxx, they would be automatically replaced by electric ones.
Thinking about it, I just came up with another idea (maybe switchable by patch option): low chance of random defuction of a TL causing road construction to start on that tile (without a player funding road construction!). Thinking even further, this could even happen for any road tiles owned by towns, not only TL crossings (but with a even lower chance).

---
@others: yeah, policeman is a no-go :P people in the correct scale are about 2 or 3 pixels big (in full zoom level) I think. I could be persuaded to include a pre 1930 or so semaphore traffic light like I wrote above ;)
* @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
DeletedUser5
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 07 Oct 2007 15:10

Re: [Alpha 1.1 released] Traffic lights

Post by DeletedUser5 » 20 Feb 2008 10:38

I can give it a try, but I need some photos of semaphore traffic lights.

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Alpha 1.1 released] Traffic lights

Post by Roujin » 20 Feb 2008 11:13

Well there aren't any at the wikipedia, and as that was just an experiment and not really used in public before they invented the electric ones, I doubt it's easy to find photos of such a thing. Maybe in some museum or so...
I guess you'd have to invent it from your own creativity :)

But this is low prio anyways, just an idea. 8)
* @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

Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Alpha 1.1 released] Traffic lights

Post by Trond » 20 Feb 2008 11:18

I guess the road semaphores where much like those for railroads, or maybe something inbetween :P http://trafficlights.com/tlites/semaphore.jpg
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish

User avatar
DeletedUser5
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 07 Oct 2007 15:10

Re: [Alpha 1.1 released] Traffic lights

Post by DeletedUser5 » 20 Feb 2008 11:29

Well, I looked trough 35 pages on Google Image and I did find nothing. Even a drawing or something like that would help me with doing it.

Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Alpha 1.1 released] Traffic lights

Post by Trond » 20 Feb 2008 11:47

how about this drawing from 1868 london: http://www.imsasafety.org/journal/septo ... 8light.jpg
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish

User avatar
DeletedUser5
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 07 Oct 2007 15:10

Re: [Alpha 1.1 released] Traffic lights

Post by DeletedUser5 » 20 Feb 2008 11:50

Can help, thanks. However I can't understand which part is for "red" state, which for "green" state.

Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Alpha 1.1 released] Traffic lights

Post by Trond » 20 Feb 2008 12:10

- for red and / for green? tbh I dont know myself :P
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Alpha 2] Traffic lights

Post by Roujin » 26 Feb 2008 21:33

Alpha 2 released!

Check the first post for instructions, the changelog, and screenshots.
Attachments
trafficlights_alpha2_r12276.diff
traffic lights alpha 2 for r12276
(36.75 KiB) Downloaded 202 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

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests