Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
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 2507 times)
0 Members and 1 Guest are viewing this topic.
Offline noblemaster

JGO Ninja


Medals: 19
Projects: 9


Age of Conquest makes your day!


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

Goal: determine traffic for Streets and Rail

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

Constraints:
-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 Knight


Medals: 11
Projects: 5
Exp: 10 years


Java games rock!


« Reply #1 - Posted 2007-08-10 07: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.
Offline keldon85

Senior Member


Medals: 1



« Reply #2 - Posted 2007-08-10 09: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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (11 views)
2014-04-15 18:08:23

BurntPizza (10 views)
2014-04-15 03:46:01

UprightPath (23 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (107 views)
2014-04-08 23:06:04

tom_mai78101 (207 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org 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‑gaming.org
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!