manual:subwaysim:map_construction:create_maplua
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| manual:subwaysim:map_construction:create_maplua [2026/01/14 14:08] – [7.2.6 Pattern C — Spawning Trains from a Depot] dcs | manual:subwaysim:map_construction:create_maplua [2026/01/14 14:37] (current) – [Final Step – Build & Test the Map] dcs | ||
|---|---|---|---|
| Line 815: | Line 815: | ||
| Dispatching is handled by the **ControlCenter** and works in addition to normal timetables. | Dispatching is handled by the **ControlCenter** and works in addition to normal timetables. | ||
| - | ===== 7.2.1 Basic Structure | + | ==== 7.2.1 Basic Structure ==== |
| Dispatching strategies are defined as a table, grouped by station: | Dispatching strategies are defined as a table, grouped by station: | ||
| Line 844: | Line 844: | ||
| - | ===== 7.2.3 Strategy Fields | + | ==== 7.2.3 Strategy Fields ==== |
| Each dispatching strategy can define the following fields: | Each dispatching strategy can define the following fields: | ||
| Line 960: | Line 960: | ||
| - | ===== 7.2.7 Pattern D — Sending Trains to a Depot ===== | + | ==== 7.2.7 Pattern D — Sending Trains to a Depot ==== |
| After service ends, trains can be removed from traffic. | After service ends, trains can be removed from traffic. | ||
| Line 994: | Line 994: | ||
| - | ===== 7.2.8 Hidden Timetables | + | ==== 7.2.8 Hidden Timetables ==== |
| Timetables inside dispatching strategies: | Timetables inside dispatching strategies: | ||
| Line 1009: | Line 1009: | ||
| - | ===== 7.2.9 Strategy Order ===== | + | ==== 7.2.9 Strategy Order ==== |
| Dispatching strategies are evaluated **in order**. | Dispatching strategies are evaluated **in order**. | ||
| Line 1023: | Line 1023: | ||
| - | ===== 7.2.10 Common Pitfalls | + | ==== 7.2.10 Common Pitfalls ==== |
| * depot names not matching the depots table | * depot names not matching the depots table | ||
| Line 1037: | Line 1037: | ||
| ===== 8) Career Mode (Optional) ===== | ===== 8) Career Mode (Optional) ===== | ||
| - | `loadCareerMode()` | + | Career Mode is optional. |
| + | If you don’t want career mode features on your map, you can leave `loadCareerMode()` empty. | ||
| - | This is where career mode related | + | If you *do* want career mode, this function defines: |
| + | |||
| + | * where the player | ||
| + | * optional route closures (for scenario logic) | ||
| + | * which train compositions the player is likely to get | ||
| + | * which timetable templates are used for pathfinding | ||
| + | |||
| + | ==== 8.1 Takeover Stations (Where the Player Can Start) ==== | ||
| + | |||
| + | `self.cmTakeoverStations` is a list of stations | ||
| + | |||
| + | For the TestMap, we keep it simple: | ||
| + | |||
| + | <code lua> | ||
| + | -- Initializes | ||
| + | function TestMap: | ||
| + | |||
| + | -- Stations where the player | ||
| + | self.cmTakeoverStations = { | ||
| + | self.stations.TS, | ||
| + | self.stations.TSA, | ||
| + | self.stations.DP, | ||
| + | }; | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | |||
| + | Notes: | ||
| + | * You reference the stations from `self.stations` (created in `loadStations()`). | ||
| + | * If a station is missing here, the player won’t be offered takeovers there. | ||
| + | |||
| + | ==== 8.2 Route Closures (Optional) ==== | ||
| + | |||
| + | Route closures allow you to define sections that may be blocked in career mode. | ||
| + | This is mainly for scenario systems and future gameplay logic. | ||
| + | |||
| + | Each closure uses: | ||
| + | * `stationSource` → start of the closed section | ||
| + | * `stationTarget` → end of the closed section | ||
| + | * a DayMask (e.g. `DayMask.Always`, | ||
| + | |||
| + | Example for the TestMap (optional): | ||
| + | |||
| + | <code lua> | ||
| + | function TestMap: | ||
| + | |||
| + | self.cmTakeoverStations = { | ||
| + | self.stations.TS, | ||
| + | self.stations.TSA, | ||
| + | self.stations.DP, | ||
| + | }; | ||
| + | |||
| + | -- Optional: example closure between TS and TSA on weekends | ||
| + | self.cmRouteClosures = { | ||
| + | { | ||
| + | stationSource | ||
| + | stationTarget | ||
| + | tempClosure | ||
| + | }, | ||
| + | }; | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | |||
| + | If you don’t need closures, simply omit `self.cmRouteClosures`. | ||
| + | |||
| + | ==== 8.3 cmGroups (Train Pool + Probability) ==== | ||
| + | |||
| + | `self.cmGroups` defines which train compositions can appear in career mode. | ||
| + | |||
| + | Each group represents a **probability set** for vehicle selection. | ||
| + | |||
| + | You can define **multiple groups**. | ||
| + | Each group has: | ||
| + | |||
| + | ^ Field ^ Meaning ^ | ||
| + | | frequency | Probability factor in the range **0.0 – 1.0** | | ||
| + | | compositions | List of composition `contentName` strings | | ||
| + | |||
| + | Important: | ||
| + | * `frequency = 1.0` means **100 % chance** for this group to be considered. | ||
| + | * `frequency = 0.0` disables the group entirely. | ||
| + | * Values between 0.0 and 1.0 reduce the chance accordingly. | ||
| + | * The value is **not relative** to other groups. | ||
| + | |||
| + | ==== Example (TestMap) ==== | ||
| + | |||
| + | <code lua> | ||
| + | function TestMap: | ||
| + | |||
| + | self.cmTakeoverStations = { | ||
| + | self.stations.TS, | ||
| + | self.stations.TSA, | ||
| + | self.stations.DP, | ||
| + | }; | ||
| + | |||
| + | -- Career mode vehicle selection pool | ||
| + | self.cmGroups = { | ||
| + | -- Main vehicle pool (always available) | ||
| + | { | ||
| + | frequency = 1.0, | ||
| + | compositions = { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | }, | ||
| + | |||
| + | -- Optional / rare vehicles | ||
| + | { | ||
| + | frequency = 0.4, | ||
| + | compositions = { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | }, | ||
| + | }; | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | |||
| + | Result: | ||
| + | * HK_2x and A3L92_4x are **always available** in career mode. | ||
| + | * HK_1x and A3L92_3x appear **only occasionally**, | ||
| + | |||
| + | ==== 8.4 Pathfinding Templates ==== | ||
| + | |||
| + | Career mode also needs timetable templates that can be used for route finding. | ||
| + | |||
| + | For the TestMap, we reference our two templates: | ||
| + | |||
| + | <code lua> | ||
| + | function TestMap: | ||
| + | |||
| + | self.cmTakeoverStations = { | ||
| + | self.stations.TS, | ||
| + | self.stations.TSA, | ||
| + | self.stations.DP, | ||
| + | }; | ||
| + | |||
| + | self.cmGroups = { | ||
| + | { | ||
| + | frequency = 1, | ||
| + | compositions = { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | }, | ||
| + | }; | ||
| + | |||
| + | -- Templates that can be used for pathfinding | ||
| + | self.pathfindingTemplates = { | ||
| + | self.TestLine_Dir1, | ||
| + | self.TestLine_Dir2, | ||
| + | }; | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | |||
| + | If you forget this, career mode may not be able to plan valid routes on your map. | ||
| ---- | ---- | ||
| Line 1059: | Line 1218: | ||
| * AI traffic will not work | * AI traffic will not work | ||
| * stations may not be recognized for routing | * stations may not be recognized for routing | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Final Step – Build & Test the Map ===== | ||
| + | |||
| + | If all steps on this page were completed successfully, | ||
| + | |||
| + | * the level exists and loads correctly | ||
| + | * tracks, signals, and stations are set up | ||
| + | * Map.lua is registered and contains stations, timetables, dispatching, | ||
| + | |||
| + | At this point, the map can be built and tested for the first time inside **SubwaySim 2**. | ||
| + | |||
| + | Continue with: | ||
| + | * [[manual: | ||
| + | |||
| + | This step explains how to: | ||
| + | * build your plugin | ||
| + | * start SubwaySim 2 with your mod enabled | ||
| + | * verify that the map loads correctly in-game | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Additional Resources ===== | ||
| + | |||
| + | For further reference and updates, the following resources are recommended: | ||
| + | |||
| + | |||
| + | |||
| + | === SDK Changelog === | ||
| + | |||
| + | Stay up to date with changes, fixes, and new features in the Modding SDK: | ||
| + | * [[manual: | ||
| + | |||
| + | === SDK Download & Test Content === | ||
| + | |||
| + | The SDK download area contains: | ||
| + | * the current Modding SDK | ||
| + | * the official **TestMap** used in this documentation | ||
| + | * additional reference content for modders | ||
| + | |||
| + | * [[manual: | ||
| + | |||
| + | The downloadable **TestMap** is provided as a **separate reference project**, distinct from the Sample Mod Map. | ||
| + | While the Sample Map demonstrates general concepts, the TestMap mirrors the map structure built step by step throughout this documentation. | ||
| {{page> | {{page> | ||
manual/subwaysim/map_construction/create_maplua.1768396118.txt.gz · Last modified: by dcs
