Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
An option could be to check average speed or some other data that may already be available via the API (or at least determine average based on current vehicle speeds). Any suggestions?
That also could help avoiding that more and more vehicles are added to an already gridlocked line by resetting the rate calculation to the "vanilla conservative estimate" then and when.
Another idea, based on the above:
One vehicle (of hundred, so 10 for a thousand) is taken as a random sample and the time it needs to move the entire line and its average speed is measured - and compared to the "vanilla conservative estimate" to see how much the values differ.
The more they differ, the more likely it is that a line is gridlocked.
This means that line is locked for adding more vehicles to it, the script even will remove empty vehicles gradually until the above mentioned difference goes away.
But then it's not set to be "free" again to have the same issue occur again, it will be flagged as "potential gridlock affinity".
For instance, if average speed for a truck line is less than 10% (arbitrary number) of the (average) max speed for the vehicles on the line, then pause the adding of further vehicles.
This could however have some odd side effects that are yet to be discovered...
Roads with one lane in one direction and two lanes in the other direction - or 2 | 3 - that can be connected perfectly fitting to a "normal" road optically, for junctions.
And not only with tarmac and from 1980 upwards; already with sand roads in 1850.
There are none.
And they're needed.
The way to find individual vehicle speed is pretty straight-forward (using the non-documented "game.interface.getEntity(id)" functionality. For instance:
>> game.interface.getEntity(144368)
(Note: list reduced)
speed = 13.46692943573,
Getting the modelId can be done via the (documented getComponent):
>> api.engine.getComponent(144368, api.type.ComponentType.TRANSPORT_VEHICLE)
{
(Note: list reduced)
transportVehicleConfig = {
vehicles = {
[1] = {
part = {
modelId = 3762,
However, how can I obtain information for that modelId? There's no documentation for this.
It is expected that top speed should be possible to obtain via the modelId.
A vehicle is considered to be standing still if speed =< 1 (m/s?)
If more than 33% of EN-ROUTE vehicles (i.e. not at a station or in depot) of a line are standing still, then don't add more vehicles.
Once this has been tested more, can expand it to count for how long the threshold (i.e. 33%) has been exceeded, and start removing vehicles if the counter has been increasing for more than, say, 10 updates in a row. However, this could lead to congestion being masked (and the mod to seem broken), and thus not rectified, so some level of congestion is probably acceptable.
local CONGESTION_THRESHOLD = 0.33 -- If the ratio of (EN_ROUTE) vehicles with zero speed exceeds this, then the line is considered congested.
Edit: I'm considering to change the 'is_congested' data to be a moving average 'congestion_ratio' instead. Makes it a bit easier to debug and can more easily be used in 'rules.lua'.
Edit:
yes, it is