This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Traffic Control

Return to Traffic Control

Entity1037Entity1037

2014/3/20

LOL all of the cars are frozen in a giant circle and none of them are moving. They're all detecting each other in a loop around the screen.
PointifixPointifix

2014/3/20

Cars get stuck sometimes ;)
danpostdanpost

2014/3/20

Yes, that is called a traffic jam. It happens sometimes during rush hour. Either that or the drivers are too polite to go first! I will work on a 'work-around' on that. But, it will not be that easy.
lordhersheylordhershey

2014/3/20

Solving this problem is a non-trivial task. What do you think you will try to work around this?
PointifixPointifix

2014/3/20

youll match this for sure ;D
bournebourne

2014/3/20

Are you going to allow them to make turns?
Entity1037Entity1037

2014/3/20

I think the traffic jam can be solved by allowing them to turn right.
lordhersheylordhershey

2014/3/20

I would think that not letting them block the intersection would do a huge amount, then resolve a 4 way stop by who ever can go and was waiting the longest.
bournebourne

2014/3/20

I made a traffic system found here: http://www.greenfoot.org/scenarios/8256 and I think each intersection had a queue, but also took into account turns and what can go simultaneously through the parts of the intersections
danpostdanpost

2014/3/20

First, I would need a way to determine that a traffic jam exists. But, I do not want to just make them turn to alleviate the problem. I would want them to find a way to continue through regardless (I think the turning would be sort of a cheat and not a work-around). Maybe randomly pick which way should continue first and let all those going that direction through. Then, hopefully, the problem will be cleared up enough for normal procedures.
danpostdanpost

2014/3/20

Maybe I should limit that choice to those direction that lead cars out of the world. That would help clear the central area instead of congesting it.
A new version of this scenario was uploaded on Fri Mar 21 03:17:17 UTC 2014
danpostdanpost

2014/3/21

I would like this to still be running in the morning when I wake up!
A new version of this scenario was uploaded on Fri Mar 21 03:46:42 UTC 2014
A new version of this scenario was uploaded on Fri Mar 21 04:17:58 UTC 2014
danpostdanpost

2014/3/21

Please report any traffic jams, so I can get a patrol officer to the scene to direct traffic.
A new version of this scenario was uploaded on Mon Mar 24 15:34:13 UTC 2014 Re-painted the lines on the road (changed the way it was done).
PointifixPointifix

2014/3/24

slow down the cars maybe? would be greater to watch then ;)
Entity1037Entity1037

2014/3/24

How about unlock the scenario? Or maybe add the fps actor that can change the speed of the scenario?
A new version of this scenario was uploaded on Mon Mar 24 18:44:29 UTC 2014
danpostdanpost

2014/3/24

OK. Added a clickable bar for changing the scenario speed within a range of 50 to 70.
PointifixPointifix

2014/3/24

jeah very nice to watch now, thanks ;)
Super_HippoSuper_Hippo

2014/3/24

I do not find the speed bar in the code, so I can not say what is wrong, but if you press and hold the mouse on the xx/70, then it is at 70 and decreases fast to 50.
danpostdanpost

2014/3/24

@Super_Hippo, click to the left or right INSIDE the bar to change it one at a time.
A new version of this scenario was uploaded on Mon Mar 24 19:35:27 UTC 2014
Entity1037Entity1037

2014/3/25

That is one glitchy speed gauge!
danpostdanpost

2014/3/25

I was thinking about putting a real time factor in the act method of the speed bar. The speed of the changing of the bar varies as the speed of the scenario changes. However, with the range I gave the bar, quick clicks will produce minimal changes. Maybe better (for changing scenario speeds) would be to only allow single clicks as the range is not that big. I will think about doing that.
A new version of this scenario was uploaded on Tue Mar 25 05:38:37 UTC 2014
danpostdanpost

2014/3/25

@Entity1037, changed speed bar to only except single clicks. Is that better?
danpostdanpost

2014/3/25

@Entity1037, changed speed bar to only accept single clicks. (spelling correction).
A new version of this scenario was uploaded on Tue Mar 25 06:13:54 UTC 2014
danpostdanpost

2014/3/25

Doubled the spawn rate!!! Went from 20 to 39 acts per spawn to 10 to 19 acts per spawn.
danpostdanpost

2014/3/25

I now have an occasional fender-bender at intersections that I need to fix. Just one more check to add. Will work on it in the near future.
danpostdanpost

2014/3/25

Alright, have working code (I believe). Had to re-work the car movement and the intersection pads. Will have documented revision up soon.
A new version of this scenario was uploaded on Tue Mar 25 18:32:33 UTC 2014
Entity1037Entity1037

2014/3/25

The scenario won't load. It says: "NoClassDefFoundError City$1"
A new version of this scenario was uploaded on Tue Mar 25 19:21:08 UTC 2014
danpostdanpost

2014/3/25

@Entity1037, sorry 'bout that. I recompiled and uploaded again.
Entity1037Entity1037

2014/3/25

OK. It's fine now!
A new version of this scenario was uploaded on 2020-10-28 21:29:10 UTC