
And nice to see my graphics in action, OpenGFX and GRVTS!

Moderator: OpenTTD Developers
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.
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?
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.
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.
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.
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?
Users browsing this forum: No registered users and 14 guests