TrafficWorlds

Add to
My games
Add to
Wishlist 1
Save to
Collection
No reviews
Exceptional
Meh
Skip

About

TrafficWorlds

by Theta Games (version 1.1.5)

Instructions

Connect homes (dull-colored squares) to corresponding-color businesses (brighter squares) with roads. If a path is available from a given home to the business of the corresponding color, cars (circles) will generate at the homes and travel there. You (the player) earn money each time a car reaches its destination; which, in turn, allows you to pay for new roads and maintenance on existing roads. Though this gameplay mechanic is not particularly realistic, it can be thought of as an abstraction of taxes from workers and businesses feeding back into public works.

As you try to connect more homes to businesses, your roads will likely intersect and/or provide paths for lots of different cars moving between various homes and businesses. Also, obstacles (dark grey squares, representing other buildings in the city) will appear; roads may not be placed on obstacles. In general, designing an efficient grid is key to this game. To help with this, various stoplight types and color-coded gates may be placed on the roads (please see a description of these under the "Controls" section).

The game measures efficiency of your traffic grid via a metric called flow ratio. An efficient traffic grid (i.e. having a flow ratio near 100%) will allow you to directly earn more money; also, the flow ratio directly affects how likely new homes and businesses will spawn (who would want to develop in a congested, poorly managed city?).

TrafficWorlds (like my previous game ĐiệnWorlds) has no definite end. See how many weeks you can maintain an efficient grid and make money; the game is meant for players to explore and experiment with strategies to see what works best. If you get stuck, just start over ("Regenerate" at the main menu) - the game doesn't take particularly long to "mature."

Controls
  • Left mouse button: Place road (if you can afford it). Clicking again on a road will place a stoplight or color-gate of the selected type on the road (stoplights/color-gates do not cost money).
  • Right mouse button: Delete road with everything on it. If the given road was placed while paused, and you haven't unpaused the game since, then you will be reimbursed the full road cost. Otherwise, you will be reimbursed half the road cost.
  • Ctrl + left mouse button (used on stoplights): Stoplights have two states which (by default) alternate at set, equal time intervals of 120 frames (two seconds if the game is running at a full 60 fps). Ctrl+clicking a stoplight will increment the time interval at which the stoplight will wait at whichever state it was in upon receiving this command. For example, consider a stoplight that alternates between states NS (North-South) and EW (East-West). If you ctrl-click on this stoplight while it is in the NS state, it will subsequently wait 240 frames in each subsequent NS state (while continuing to only wait 120 frames in each subsequent EW state). Ctrl-clicking it again in the NS state will make it wait 360 frames in each subsequent NS state.
  • Ctrl + right mouse button (used on stoplights/color-gates): Delete the stoplight/color-gate at the cursor position, without deleting the road beneath it.
  • SPACE: Pause/unpause the game. Roads and stoplights/color-gates may be placed, deleted, or managed while the game is paused.
  • Digits 1 - 9: Select a stoplight or color-gate type. See below:
    • 1: (NS/WE stoplight): In "state NS," the stoplight admits cars only from the North or South, while in "state WE" it admits cars only from the west or east.
    • 2: (N/S stoplight): In "state N," the stoplight admits cars only from the north, while in "state S" it admits cars only from the south. This stoplight never admits cars from the west or the east.
    • 3: (W/E stoplight): In "state W," the stoplight admits cars only from the west, while in "state E" it admits cars only from the east. This stoplight never admits cars from the north or the south.
    • 4 - 8: (Single color-gates): A color-gate will only allow cars of its corresponding color to pass, and will block all other traffic. Each of these five keys correspond to a different color of color-gate.
    • 9: (Custom color-gate): This will select the current custom color-gate (see "Digit 0" bullet-point).
  • Digit 0: Enter color-gate design mode. When in this mode, digits 4 - 8 will each toggle a color added to a "custom" color-gate. A custom color gate can allow multiple colors to pass through it (even all five, though this is rather pointless). By default, the custom color-gate will be black, indicating that no colors will be allowed to pass through it. When you are finished designing a custom color-gate, press "0" digit key again (or "9") to exit color-gate design mode, and the custom color-gate you just designed will be selected.
  • ESC: Bring up the main menu (from which you can save/load/regenerate). Pressing ESC again at the main menu will return to the game.
  • R: (R)ecall the maintenance fee applied last week (see the "Money/Probabilities/etc." section)
  • B: Recall last (b)uilding spawn (the expanding-square spawn effect will appear again at the last building spawn location).
  • M: Toggle (m)usic muting
  • S: Toggle (s)ound effects muting
  • F: Display (f)ps. The game should run at 60 fps.
  • Ctrl-L: Activate "easy-mode" by granting you a (l)oan of $1,000,000. This "loan" does not have to be re-paid, though it cannot be used if your funds are at least $10,000,000.
  • C: Toggle (c)olorblind mode. This mode displays digit(s) 1 - 5 on everything in the game that would otherwise be differentiated by hue (homes, businesses, cars, color-gates). In this mode, "GO" is displayed on the "green" side of stoplights.
Main Menu

At the main menu (accessible by pressing ESC), you can save/load your game (the save file is stored locally), or regenerate the board (which starts over with a newly randomized configuration).

Car Movement

While it is not necessary to understand every detail of the underlying simulation, having a basic understanding of some topics might help with making an optimal grid.

First and foremost, nothing in the game acts on diagonals. Cars will only move in the four cardinal directions, and roads should be constructed to produce paths accordingly.

A car will begin its journey with a path (if there is no available path from a given home to the corresponding business, cars will not spawn). Spawned cars' paths may be temporarily have other cars or red stoplights in the way (but not color-gates). The selected path will always be no longer (in number of adjacent squares) than any other possible paths.

With a path set, the car will set an internal timer to 16 frames; when this timer hits zero, the car will move to the first square on its path (but only if the adjacent square is unoccupied by a car, and isn't blocked by a "red" stoplight or a color-gate of a different color than the given car's color). A successful move will trigger a new timer of 14 frames; whereas if the car could not move, a timer of 16 frames is set again. Any time a car successfully moves, the next timer is set for two fewer frames than the previous timer was set (with a minimum of 2 frames for the set timer), while a blocked car's timer will always set to 16. Additionally, a car's timer will be set to 16 if it enters a non-stoplight square that is adjacent to at least one other car (this mechanic simulates "stop-sign" behavior at intersections where stoplights are not placed). This "timer" mechanic is a reasonable approximation to motion-by-acceleration (we invite the player to work this out as an exercise).

Within each frame of the game, the priority in which cars are given to move is determined randomly, though all cars will have a chance to move in the given frame. Because of this, two cars cannot enter the same square simultaneously.

If a car was stopped (i.e. its timer was set to 16), yet an adjacent square opens up, there is a chance that it will try to re-calculate a path. A path calculated at this state must not have any other stopped cars in the way. Hence, cars may try to circumvent a jam if such a path exists.

Money/Probabilities/etc.

In this section, we discuss some money-related and chance-based aspects of the game.

  • Roads cost $50 to place
  • A car successfully reaching its corresponding business will earn $16*(flow ratio)
  • At the end of each week, a "maintenance fee" is applied. This fee increases with the number of roads on the board and with the number of weeks played. The formula is listed below:

    Maintenance fee = $250 * sqrt(# roads) * (1 + 0.25*((week number) - 1)).

  • The chance of home/business generation is proportional to the flow ratio. A global timer is set to a random integer between (inclusively) 80 and 160 frames. When this timer goes off, it is reset to another random integer, and there is a (20*(flow ratio))% chance that a new home/business will try to spawn. The new building is chosen to be a new business with 40% probability; otherwise, it will be a home. The location of the new building is randomly assigned to an unoccupied square (though new homes or businesses will not spawn adjacent to roads). Note that if the board is very crowded, buildings may not spawn, as they will only try a maximum of 500 times to place themselves).
  • At the end of each day, flow ratio is computed. Heuristically, flow ratio is the ratio of the number of cars reaching their destinations to an expected number of cars reaching their destinations (both computed over a day). The flow ratio is appropriately normalized so that free-flowing traffic yields a flow ratio of 100%.
  • Homes generate cars on timers according to the formula

    new timer = R - round(100*sin^2 (pi*(time of day))),

    where R is a random integer between (inclusively) 180 and 220, and "time of day" is a number between 0 and 1, which increases as the day progresses. The "sin^2 term" represents a crude "rush hour" effect (though there is only one "rush hour" per day cycle.
Hints/Tips

I would like to encourage players to experiment and discover strategies on their own (as the dev, I don't even yet know what kinds of layouts yield the best results). Still, there are some basic hints that might help out new players.

  • Stoplights often help with traffic flow. Any time cars slow down, there runs a risk of causing a backup elsewhere. Stoplights may cause temporary backups, but if planned correctly, they will release these backups regularly, and allow for cars to move quicker.
  • Ctrl-clicking stoplights can be very useful for allowing a high-volume road to have more "green-light" time.
  • There are no one-way streets. Cars (especially newly-spawned ones) will sometimes try to enter a road that they shouldn't, and block traffic by trying to go the opposite way of the other cars (this happens because cars will always try for the shortest path to the destination - even if other cars might end up going the opposite direction along the same path). Color-gates (and general, careful planning) can be very useful for preventing this; but if it does happen, temporarily place some extra roads to try to alleviate the gridlock.
Other Information

TrafficWorlds was created with Game Maker: Studio by myself (Theta Games). All sound effects are by myself, along with the soundtrack piece "Traffic Melody and Variations." This piece can be found at the following places:

Bandcamp

SoundCloud

YouTube

A download link is available (near the bottom of the page) for users who might want a stand-alone Windows executable. Make sure you unzip the archive before playing.

Have fun, and thanks for playing!

Changelog
  • v1.0.1: Fixed a small bug with ctrl-clicked stoplights slowly falling out of sync relative to non-ctrl-clicked stoplights placed at the same step.
  • v1.0.2: Ensured that houses do not spawn in inaccessible areas (i.e. blocked from the corresponding business by obstacles, other houses, or businesses of a different color). Also, ensured that a new color business will not spawn immediately after a previous business spawn.
  • v1.0.3: Now, the next spawn after a new color business will be a house of the same color.
  • v1.0.4: (Hopefully) fixed a strange bug in which the music occasionally stopped upon pressing "Regenerate."
  • v1.0.5: Increased length of time that the "new building" effect lingers, to improve visibility and allow players to easily pick out where new buildings spawn.
  • v1.0.6: Ensured that homes will not spawn next to businesses of different color, and vice-versa.
  • v1.0.7: Made a small adjustment to the "stopsign" behavior; now, cars will not incur this penalty at all if an stoplight is present on the square. Also, made some small cosmetic changes to improve visibility (made color-gates less bright, homes more dull).
  • v1.1.0: Added "custom" color-gates, which can be designed by the player. These gates can allow multiple colors through.
  • v1.1.1: Some more cosmetic changes to improve visibility. Made businesses/homes contrast more, changed the look of intersections, implemented a keypress ("B") to recall last building spawn.
  • v1.1.2:
    • A car immediately behind a permanent red-light (e.g. a car sitting south of an E/W intersection) will now try to get around it. Also, did some "balance" work with fees and revenues.
    • Each car reaching its destination now earns $16*(flow ratio) (so flow ratio now essentially affects overall revenue quadratically).
    • Maintenance base fees are now increased, but the rate (per week) at which the fees increase has been decreased a lot. Also, maintenance is now proportional to the square root of the number of roads (it was previously proportional to the number of roads).
    • Changed the look of E/W and N/S intersections.
    • Finally, for those who wish to experiment with no money problems, there is now an "easy-mode" which grants the player $1,000,000 (activated with Ctrl-L).
  • v1.1.3: Bumped up the rate at which maintenance fees increase again.
  • v1.1.4: Bumped up base maintenance fee.
  • v1.1.5: Implemented a "colorblind mode" (toggled by the C key). This mode displays digit(s) 1 - 5 on everything in the game that would otherwise be differentiated by hue (homes, businesses, cars, color-gates). In this mode, "GO" is displayed on the "green" side of stoplights.
Platforms
Release date
Developer
ThetaGames
Age rating
Not rated

System requirements for PC

System requirements for Web

Read more...
Edit the game info
Last Modified: Jan 9, 2019

Where to buy

itch.io