Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (575) Games in Android Showcase (154) games submitted by our members Games in WIP (623) 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 2714 times) 0 Members and 1 Guest are viewing this topic.
noblemaster

« JGO Spiffy Duke »

Medals: 23
Projects: 10

Age of Conquest makes your day!

 « Posted 2007-08-10 00: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

moogie

JGO Ninja

Medals: 15
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
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

You cannot reply to this message, because it is very, very old.

 BurntPizza (29 views) 2015-04-23 03:42:11 theagentd (35 views) 2015-04-22 16:23:07 Riven (48 views) 2015-04-16 10:48:47 Duke0200 (59 views) 2015-04-16 01:59:01 Fairy Tailz (41 views) 2015-04-14 20:13:12 Riven (43 views) 2015-04-12 21:36:37 bus hotdog (60 views) 2015-04-10 02:39:32 CopyableCougar4 (66 views) 2015-04-10 00:51:04 BurntPizza (69 views) 2015-04-06 22:06:58 ags1 (67 views) 2015-04-02 10:58:48
 theagentd 23x BurntPizza 17x wessles 15x kingroka123 11x alwex 11x 65K 11x kevglass 8x Rayvolution 8x Roquen 7x chrislo27 7x Hanksha 7x Riven 7x Olo 7x Ecumene 7x ra4king 7x KevinWorkman 6x
 How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27
 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