Jump to content

Synchronized traffic lights


Kaltsu

Recommended Posts

  • 4 weeks later...
Posted

I said it before, and I'll say it again. The lights should either be turned off altogether, or, turned all at the same time with the same color across the entire map. Anything else would take up too much bandwidth, or take too much time to code. Sure, you could code just ONE intersection to have synched lights, but who wants to race at the same damn light each time? So then you'll say "why can't you make the nearest intersection synched with a command or something?" My answer to that is : Holy crap I bet that's hard to code!

Posted
I said it before, and I'll say it again. The lights should either be turned off altogether, or, turned all at the same time with the same color across the entire map. Anything else would take up too much bandwidth, or take too much time to code.

Really? What about making groups of lights? The minimum number could be 2. It wouldn't take up much bandwidth.

Posted

I dont know, its one of those things like Garage doors. They're synced in 1.0 but its because R* conveniently assigned them all IDs which can be used to easily retrieve them.

In the case of traffic lights, its highly unlikely they'd bother tagging them individually. Instead there's probably an overall system that takes nearby lights. That's just a guess, but it immediately makes it more problematic to start trying to figure out how to retrieve each set of traffic lights so that they can be set.

  • 2 months later...
Posted

The traffic lights change in turns, depending if they are pointing more towards North/South or more towards West/East. No matter where in the map the light is located, they still change at the same time depending on their direction (tested in Map Editor). So basically there are 2 different sets of traffic lights that would need to be synced.

Here is the timeline for the loop:

0:00 - Set 1 turns green / Set 2 stays red

0:12 - Set 1 turns red / Set 2 turns green

0:22 - Set 2 turns red / Set 1 stays red

0:31 - Set 1 turns green / Set 2 stays red

Total: 31 seconds

* Set 1 = Pointing towards North/South

* Set 2 = Pointing towards West/East

Both of the lights stay red for the last 9 seconds of the loop, because that's the only period in the loop when the pedestrian lights for both sets turn white.

However, at the moment it seems that the sync of the traffic lights between two players depends on their FPS.

  • 2 weeks later...
Posted

Well what about syncing the clients' sets to ones defined by the server? That way their lag to the server would define the sync, which is pretty much how everything works at the moment with any multiplayer client.

Posted

I guess people should be reminded of what Talidan said before in this topic:

...

In the case of traffic lights, its highly unlikely they'd bother tagging them individually. Instead there's probably an overall system that takes nearby lights. That's just a guess, but it immediately makes it more problematic to start trying to figure out how to retrieve each set of traffic lights so that they can be set.

This means that it's just very hard to get all (or some) of the traffic lights. We need to wait for someone to find a way to get them, before there should be discussed about bandwidth, synch etc. :roll:

Posted

This is what lucasc190 noted in the Mantis report (http://bugs.mtasa.com/view.php?id=4120).

I found the function addresses, 0x49dab0 (if ret is written, all traffic lights go blank (including pedestrian walk lights), and 0x156e5bc (if ret is written, the traffic ignore the traffic lights (in the origional game)). Maybe someone can have a look around at these addresses and find the memory addresses that they read from. Or maybe just write ret to 0x49dab0 (to keep them all blank) just for now until they are synced. Maybe if someone finds the memory addresses, a script function can be made that sets them, then someone can make a resource with a timer to set them at specific intervals. (There is no real need to sync them to a player because its much simpler to use a server-side timer)

I can't really say much about this, since I'm not very experienced in scripting etc. but at least to me this looks like somekind of a step forward... ( :?: )

Posted

He only talked about making them blank, which isn't really what we want I guess.

However, when they're blank, I think you can use Corona's (createMarker) to simulate the traffic lights. Will be a bit weird when the light has collapsed, but might be a temp solution? :P

Posted
He only talked about making them blank, which isn't really what we want I guess.

However, when they're blank, I think you can use Corona's (createMarker) to simulate the traffic lights. Will be a bit weird when the light has collapsed, but might be a temp solution? :P

Yeah. I'll assign you to work out every single light position :).

Posted
Yeah. I'll assign you to work out every single light position :).

I must say that the task should be incredibly easier now with the new Map Editor, but not easy enough for me! D:

I might be able to do about 2 traffic lights by next year though. :D

Posted
Yeah. I'll assign you to work out every single light position :).

It's possible by making a program that reads IPL files, finds traffic lights and writes light positions to a file :)

Posted

How many types of traffic lights are there in SA? If it's only one, then your method should make it a piece of pie with the help of my good 'ol buddy Trigonometry.

Otherwise, it's a smaller piece of pie. And I want moar pie! :(

Posted
How many types of traffic lights are there in SA? If it's only one, then your method should make it a piece of pie with the help of my good 'ol buddy Trigonometry.

Otherwise, it's a smaller piece of pie. And I want moar pie! :(

Well... maybe you mean geometry, not trigonometry? (or you really mean sin, cos, tg, ctg etc.?)

Posted

Well, maybe trigonometry won't be needed. I've got better idea.

What if smb creates a traffic lights map with all traffic lights marked with all of the properties.

  • 2 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...