Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (843)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Determine Traffic in Real-Time?  (Read 3502 times)
0 Members and 1 Guest are viewing this topic.
Offline noblemaster

« JGO Spiffy Duke »

Medals: 35
Projects: 11

Age of Conquest makes your day!

« Posted 2007-08-10 00:53:45 »

Goal: determine traffic for Streets and Rail

-Grid: X * Y   (e.g. 100*100)
-Houses (each house is occupied by M people)
-Workplaces (each workplace can employ N people)
-Streets & Rail

-People move from houses to their workplaces and back
-update whole world in approximately every 3-5 seconds. The world doesn't need to be updated every iteration. every iteration only updates a part of the world

How would I go about to determine the traffic/congestion for each street/rail tile on the grid? I want to simulate people moving from their house to the closest available workplace. I cannot do the calculation for the whole map in a single iteration, so I figured I calculate only part of the map in each iteration, reducing computations.

There is a very easy way calculating traffic by counting the number of people close to a street/rail tile. But that's not what I want to do. It's not very realistic.

Suggestions? Algorithms? Do you know of anyone/link showing similar approaches? Similar discussions on the topic?

Thanks! Any ideas/pointers are highly appreciated. Please note, that this is for a city simulation type of game  Grin

Offline moogie

JGO Ninja

Medals: 16
Projects: 6
Exp: 10 years

Java games rock!

« Reply #1 - Posted 2007-08-10 05:15:32 »

How about using path finding to create a route which lists which road/rail segements a person will use between their house and place of work. This can probably be done once for each house.

And then each "commute initiation" time for the person (which i suggest to be random distributed around the usual morning and afternoon peak times) simply add to a counter each of the roal/rail segments.

i think this would probably be a bit more realistic.

Perhaps you might want to periodically attempt a new path between the house and the workplace and take into account a penalty with traffic congestion. This way a person can change their route to work and make the traffic congestion more realistic as people "learn" to avoid the hot spots.

Java4k RIP 2014
Offline keldon85

Senior Devvie

Medals: 1

« Reply #2 - Posted 2007-08-10 07:55:02 »

First of all get statistics on people's travel choices to make your results more realistic.

People tend to take the same sort of route and have a travel plan, which works well with AI. First create a general plan, first of all they need to have some idea of how they get to work, then they need some directions and so on. People don't think in terms of many nodes, our nodes are much more abstract. For example if you are planning a journey involving say, two buses and 3 separate trains we only care about the interconnections between the two. Often you have many choices ...

p.s. I think the route finding per person would be easier with a genetic algorithm! The fitness function can take in things such as waiting time, i.e. I had to wait for 10 minutes between each bus; simplicity, i.e. I only needed to take 2 buses even though it took long; and speed. Each person will have different preferences and many other factors, cost, reliability. You may also want to simulate traffic jams depending on your road plan; some junctions are hotspots for traffic jams - this will alter the people's choice in route big time. Plus you have signal failures on some routes, etc.

EDIT: also if this is for a game then you need to think of the main goals it has in the game. Without specifications there is no good or bad answer!

Pages: [1]
  ignore  |  Print  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

ivj94 (124 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!