Commute Time Customization

New in v1.0.0

Customize when commuters travel in your city

The Pop Timing API lets you customize the commute time ranges that determine when simulated commuters travel. This is useful for cities with different work patterns or cultural norms.

Default Commute Times#

By default, the game simulates two rush hours:

  • Morning rush: 7am - 9am
  • Evening rush: 5pm - 7pm

Get Current Ranges#

javascript
const ranges = window.SubwayBuilderAPI.popTiming.getCommuteTimeRanges();
console.log('Current ranges:', ranges);
// Default: [{ start: 7, end: 9 }, { start: 17, end: 19 }]

Set Custom Commute Times#

Override the default ranges for cities with different patterns:

javascript
// City with earlier work hours and lunch rush
window.SubwayBuilderAPI.popTiming.setCommuteTimeRanges([
    { start: 6, end: 10 }, // Extended morning rush (6am-10am)
    { start: 12, end: 14 }, // Lunch rush
    { start: 16, end: 20 } // Extended evening rush (4pm-8pm)
]);

Time Format#

Times are in 24-hour format:

  • 0 = midnight
  • 12 = noon
  • 17 = 5pm
  • 23 = 11pm

Reset to Defaults#

javascript
window.SubwayBuilderAPI.popTiming.resetCommuteTimeRanges();

Use Cases#

Spanish Schedule (Late Lunch, Late Dinner)#

javascript
window.SubwayBuilderAPI.popTiming.setCommuteTimeRanges([
    { start: 8, end: 10 }, // Morning commute
    { start: 14, end: 16 }, // Long lunch break
    { start: 20, end: 22 } // Evening commute (later)
]);

Industrial City (Shift Changes)#

javascript
window.SubwayBuilderAPI.popTiming.setCommuteTimeRanges([
    { start: 5, end: 7 }, // First shift arrival
    { start: 13, end: 15 }, // Shift change
    { start: 21, end: 23 } // Night shift change
]);

24-Hour City (Constant Demand)#

javascript
// Multiple smaller peaks throughout the day
window.SubwayBuilderAPI.popTiming.setCommuteTimeRanges([
    { start: 6, end: 9 },
    { start: 11, end: 13 },
    { start: 15, end: 17 },
    { start: 19, end: 21 },
    { start: 23, end: 1 } // Late night (wraps around midnight)
]);

Effect on Gameplay#

Changing commute times affects:

  • Ridership patterns: Passengers appear during your defined rush hours
  • Revenue distribution: Ticket sales spike during rush periods
  • Capacity planning: Trains need to handle peak loads at different times
  • Route optimization: Players may need to adjust service for unusual schedules

Complete Example#

javascript
const api = window.SubwayBuilderAPI;

// Register a custom city with matching commute times
api.registerCity({
    code: 'TOKYO',
    name: 'Tokyo'
    // ... other city config
});

// Tokyo has extremely early morning rush
api.popTiming.setCommuteTimeRanges([
    { start: 6, end: 10 }, // Long morning rush
    { start: 17, end: 21 } // Long evening rush
]);

// The simulation will now have passengers
// commuting during these hours