Traffic lights (r17455)
Moderator: OpenTTD Developers
Re: [Alpha 2] Traffic lights
Very nice work! Soooo, road vehicle accidents next?
And nice to see my graphics in action, OpenGFX and GRVTS!
And nice to see my graphics in action, OpenGFX and GRVTS!
Re: [Alpha 1.1 released] Traffic lights
I'm not quite sure but:Soeb wrote:Can help, thanks. However I can't understand which part is for "red" state, which for "green" state.
- on junction it was only one semaphore - on middle of road
- the red state was when 'flyers' where full visable (pointin perpendicular road where is driver / red light)
- green state was when they where not (pointing same / reverse road where is driver / green ligh).
- it was working like this: when signal was about to change, policeman was using level to rotate top part by 90deg (glases and 'flyers').
- DeletedUser5
- Transport Coordinator
- Posts: 277
- Joined: 07 Oct 2007 15:10
Re: [Alpha 2] Traffic lights
Works good but there are few stupid things like vehicle can stop on junction because the light turned there to red.
Re: [Alpha 2] Traffic lights
Zephyris: nope, sorry maybe in faaaaar future (if at all )
Yep, those grfs are nice, I like them a lot
Soeb: can you explain what you mean? I didn't really understand it... maybe also provide a screenshot of what you mean?
Yep, those grfs are nice, I like them a lot
Soeb: can you explain what you mean? I didn't really understand it... maybe also provide a screenshot of what you mean?
- DeletedUser5
- Transport Coordinator
- Posts: 277
- Joined: 07 Oct 2007 15:10
Re: [Alpha 2] Traffic lights
Me too.
I meant that vehicle stops on junction because lights on its way turned red. However it shouldn't because it's already on junction.
I meant that vehicle stops on junction because lights on its way turned red. However it shouldn't because it's already on junction.
Re: [Alpha 2] Traffic lights
I think he means that the lights dont act as signals - to block entry to the junction tile - they also make any vehicles on the junction tile stop... Havn't seen it myself tho...
Re: [Alpha 2] Traffic lights
Just started a game to check out these lights with the latest alpha. So, I put up light anywhere I could in a city and started a car running randomly around. After a while, the city started a random road construction... In a junction where I already had a trafficlight... Is that wanted behavior?
Other than that, wow, looks pretty cool! Very nice to see the lights changing, cars stopping etc.
Edit: Oh also, when a city puts up lights, I can remove them... Is that really wanted?
Other than that, wow, looks pretty cool! Very nice to see the lights changing, cars stopping etc.
Edit: Oh also, when a city puts up lights, I can remove them... Is that really wanted?
..: Trond :.. because you deserve it!
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
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
Re: [Alpha 2] Traffic lights
@Soeb & Zephyris: I couldn't observe this, are you sure about that?
or, Soeb, did you mean that they stop too far into the crossing when they have a red light (see screenshot with North American road set, which has stopping lines)? Then that's something I can't (or rather do not want to) do much about, as my TL junctions act like closed level crossings. Meaning if I change where roadvehs stop at my TLs, it will also change for level crossings. And I don't want to change too much on other stuff. ---
@Trond:
The random road construction appears anywhere in a city, randomly. In fact, that feature is pretty independent from the traffic lights, except for the fact that during road construction on crossings, traffic lights may be put up with a given chance.
You can also adjust the patch to your likings, e.g. turn off the random road construction, if you don't like it (or make it less probable, or more probable if you want). The four patch settings I introduced should be pretty much self explaining.
edit: here's a rediff for newest revision. Nothing changed, though.
or, Soeb, did you mean that they stop too far into the crossing when they have a red light (see screenshot with North American road set, which has stopping lines)? Then that's something I can't (or rather do not want to) do much about, as my TL junctions act like closed level crossings. Meaning if I change where roadvehs stop at my TLs, it will also change for level crossings. And I don't want to change too much on other stuff. ---
@Trond:
The random road construction appears anywhere in a city, randomly. In fact, that feature is pretty independent from the traffic lights, except for the fact that during road construction on crossings, traffic lights may be put up with a given chance.
You can also adjust the patch to your likings, e.g. turn off the random road construction, if you don't like it (or make it less probable, or more probable if you want). The four patch settings I introduced should be pretty much self explaining.
At the moment, it is intended behavior, yes. At the final stage of this patch, you should only be allowed to place/remove signals if you're the owner of the road piece below. But I didn't implement this yet as it's more convenient for testing without that restriction.Edit: Oh also, when a city puts up lights, I can remove them... Is that really wanted?
edit: here's a rediff for newest revision. Nothing changed, though.
- Attachments
-
- trafficlights_alpha2_r12318.diff
- traffic lights alpha 2 for r12318
- (36.31 KiB) Downloaded 217 times
Re: [Alpha 2] Traffic lights
Yeah, I noticed the patchsettings, and maxed out that random road construction to see how it works And it works really well I would say, looks good to! I'm gonna continue using this untill it gets accepted to trunk, cause this is a really nice one
Edit: I will use it after its accepted to trunk also only then I dont have to patch it myself
Edit: I will use it after its accepted to trunk also only then I dont have to patch it myself
..: Trond :.. because you deserve it!
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
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
Re: [Alpha 2] Traffic lights
I expect that this stays as a patch (= not in trunk) for a while for some reasons:
- 0.6.0 is on the way. During preparation for a stable release, the devs won't include patches with new features because they bear the risk of new bugs. They want to get the game as bugfree as possible for the stable release. After the release, they might be more open towards new features.
- how I store the stuff in the map array. I don't like what I'm doing there myself. If it were to be included in trunk, I guess that would have to change.
After these two are solved, it's still the question if the devs like the feature. Only if that's all fulfilled, you may see it in trunk sometime.
edit: Thinking about it, I might release the random road construction as a standalone. That one is such a minor codechange that it might just be accepted into trunk. If the feature is being liked, that is.
- 0.6.0 is on the way. During preparation for a stable release, the devs won't include patches with new features because they bear the risk of new bugs. They want to get the game as bugfree as possible for the stable release. After the release, they might be more open towards new features.
- how I store the stuff in the map array. I don't like what I'm doing there myself. If it were to be included in trunk, I guess that would have to change.
After these two are solved, it's still the question if the devs like the feature. Only if that's all fulfilled, you may see it in trunk sometime.
edit: Thinking about it, I might release the random road construction as a standalone. That one is such a minor codechange that it might just be accepted into trunk. If the feature is being liked, that is.
Re: [Alpha 2] Traffic lights
Sadly I agree, but there must be somewhere else with free bits!how I store the stuff in the map array. I don't like what I'm doing there myself. If it were to be included in trunk, I guess that would have to change.
- DeletedUser5
- Transport Coordinator
- Posts: 277
- Joined: 07 Oct 2007 15:10
Re: [Alpha 2] Traffic lights
No it wasn't the thing I meant.
Let's say it like that:
I build traffics lights in whole town than run on bus. I was watching it for a while and noticed that sometimes when bus goes onto the T junction and then goes for example to right ( the road ends there ) so it stops there. In my opinion it shouldn't.
Let's say it like that:
I build traffics lights in whole town than run on bus. I was watching it for a while and noticed that sometimes when bus goes onto the T junction and then goes for example to right ( the road ends there ) so it stops there. In my opinion it shouldn't.
- Attachments
-
- Muntfingley Transport, 24th Oct 1950.png (134.06 KiB) Viewed 7783 times
Re: [Alpha 2] Traffic lights
The behaviour there is that the vehicle has exited the junction, been forced to turn by lack of road, but has been met by a red light on reentering the junction. I believe the same can happen on a dead end level crossing - hence the origin of this bug...
Re: [Alpha 2] Traffic lights
Nah, for road tiles, it's completely stuffed. (see docs/landscape_grid.html) These three bits were the only ones I could somehow use. Unless I would throw out the reserved bits for a third road type (road type as in normal, tram). But I doubt the devs would like that either.Zephyris wrote:Sadly I agree, but there must be somewhere else with free bits!how I store the stuff in the map array. I don't like what I'm doing there myself. If it were to be included in trunk, I guess that would have to change.
Other than the map array, one could use a pool for storing stuff. But then we would still need to store a pointer in the map array. Nah, this isn't going anywhere...
---
@Soeb: Ah, I see. Well, technically the bus is turning at the edge of the tile and before entering the tile again, checks if it is allowed to. Since there's a red light, it isn't. So it waits until it gets green again.
I don't think that's relevant enough to justify big changes in code. Firstly, that's a weird crossing you have there because one of the ways ends just after the crossing. Secondly, even if there is such a crossing, it would be quite rare for a vehicle to head into this direction (if it has proper orders).
edit: @Zephyris: yeah, it should be the same for dead end level crossing as I reused the code for level crossings.
- DeletedUser5
- Transport Coordinator
- Posts: 277
- Joined: 07 Oct 2007 15:10
Re: [Alpha 2] Traffic lights
It wasn't weird for that vehicle. And sometimes towns build junctions like that ( it was generated not created ). Let's say town will build junction with traffic lights like that, and on one of ends there will be road reconstruction. Vehicle will go there and loose some time because of that.
Re: [Alpha 2] Traffic lights
Is it necessary to store the traffic light state in the map array? You could use a single bit to store whether it is a road tile with traffic lights, then drive the colour change off the tile refresh cycle...
Re: [Alpha 2] Traffic lights
Then how are the vehicles supposed to know if they may drive or not? I have to store the state of the crossing somewhere..
And what if I load an existing game? If the current state of a TL crossing isn't saved in the savegame, after loading all TLs are in one state (all off or say x green y red) regardless of what they were when the game was saved.
Nah, I'm pretty sure the states must be stored somewhere. Another thing that comes to my mind just now is multiplayer consistency: What if a player joins a running multiplayer game with TLs placed somewhere. How should he (= his client) know which state the TLs are in? He cannot just assume they are in (for example) x green y red because it will lead to different flow of traffic on his client compared to the server/other clients, eventually leading to desync.
And what if I load an existing game? If the current state of a TL crossing isn't saved in the savegame, after loading all TLs are in one state (all off or say x green y red) regardless of what they were when the game was saved.
Nah, I'm pretty sure the states must be stored somewhere. Another thing that comes to my mind just now is multiplayer consistency: What if a player joins a running multiplayer game with TLs placed somewhere. How should he (= his client) know which state the TLs are in? He cannot just assume they are in (for example) x green y red because it will lead to different flow of traffic on his client compared to the server/other clients, eventually leading to desync.
Re: [Alpha 2] Traffic lights
Small update: made a new version (alpha 2.1) without random road construction, as I've made a seperate patch for that.
edit: rediff for r12436
edit: rediff for r12436
- Attachments
-
- trafficlights_alpha2.1_r12320.diff
- traffic lights alpha 2.1 for r12320
(without random road construction) - (35.71 KiB) Downloaded 236 times
Last edited by Roujin on 26 Mar 2008 23:58, edited 1 time in total.
Re: [Alpha 2] Traffic lights
How about basing all the trafic light states on the game time. Every even tick vehicles from the x direction have a green light and uneven for the y direction. This way you dont have to store anything in the map. Only thing is that all trafic lights will show the same behaviour this way but im sure you can come up with some algorithm to make it appear random.Roujin wrote:Then how are the vehicles supposed to know if they may drive or not? I have to store the state of the crossing somewhere..
And what if I load an existing game? If the current state of a TL crossing isn't saved in the savegame, after loading all TLs are in one state (all off or say x green y red) regardless of what they were when the game was saved.
Nah, I'm pretty sure the states must be stored somewhere. Another thing that comes to my mind just now is multiplayer consistency: What if a player joins a running multiplayer game with TLs placed somewhere. How should he (= his client) know which state the TLs are in? He cannot just assume they are in (for example) x green y red because it will lead to different flow of traffic on his client compared to the server/other clients, eventually leading to desync.
[edit]ohh sounds a lot like what Zephyris just posted.
Re: [Alpha 2] Traffic lights
Zephyris wrote:Is it necessary to store the traffic light state in the map array? You could use a single bit to store whether it is a road tile with traffic lights, then drive the colour change off the tile refresh cycle...
Using the same information that drives the light state. If _game_ticks % 16 is 0..6, signal is green for X-direction, and X-direction vehicles may pass. If _game_ticks % 16 is 7, signal shows yellow in X direction.Roujin wrote:Then how are the vehicles supposed to know if they may drive or not?
If _game_ticks % 16 is 8..14 and 15, same as above, but for Y-direction instead.
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
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Who is online
Users browsing this forum: No registered users and 54 guests