News:

SimuTranslator
Make Simutrans speak your language.

Road–River Crossing not work

Started by Andarix, May 20, 2026, 06:26:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andarix

In version 121.0 r8870, road-river crossings are built.

None of the versions I tested subsequently build road-river crossings anymore.

makie

It works, it is speed limited and it is intended.

Set a higher speed limit in the .dat of the ford.
Or do you mean automatically building bridges?


victor_18993

I have now tested this directly on the current trunk (r12254).

Road–river construction is working as intended.

The current rules are:

- For a normal player, a road may cross water using a ford only if the pakset provides a road/water crossing descriptor whose maximum speed is high enough for both the road and the water way.
- For the public player, a road/water crossing with at least 25 km/h road speed is sufficient even when the road itself is faster. This is also relevant to map generation/intercity roads.
- If no suitable crossing descriptor exists, Simutrans correctly refuses to build the ford.
- Road bridges are independent of the ford/crossing rules and can still be built across the water normally.

I tested all of these cases, including both direct and route-planned road construction.

One important detail is that pak64 currently contains no road/water crossing descriptor at all. Therefore, with pak64 alone, no ford can be built unless such a crossing is provided by an addon. A bridge can still be used normally.

So this is not a current engine bug.

The historical change in r9410 intentionally made crossing selection depend on the crossing speed, and r11983 later added the public-player >=25 km/h exception.

If the original report referred to a specific pakset or construction tool, please let me know which one and I can verify that exact case as well.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

victor_18993

I investigated this further, including the Squirrel AI case.

The behaviour is intentional and the important distinction is between the public player and normal/AI players.

Since r9410, a normal player may use a road/water crossing only when the crossing descriptor is fast enough for the road and water way.

Later, r11983 added a special exception for the public player: it may use a road/water crossing with a road speed of at least 25 km/h even when the road itself is faster.

This exception does NOT apply to Squirrel AI players. An AI player follows the same crossing-speed rules as a normal human company.

I verified the scripting path as well:

- a Squirrel construction request successfully builds a valid ford;
- a ford that is too slow is correctly rejected;
- the same slow ford is accepted by the public player because of the r11983 exception;
- if no suitable ford exists, the normal road builder does not automatically switch to a bridge;
- however, Squirrel can explicitly build a road bridge, and the AI code already has support for doing this.

So the Squirrel API is not missing the capability, and there is no current engine bug here.

This also explains why generated maps may show crossings that an AI company cannot reproduce with a faster road: map generation uses the public player, which has the special exception.

One remaining question from the original report is which pakset and AI/tool were being used. If you can provide those details, we can compare that exact configuration with the rules above.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

Andarix

That's the crux of the matter. The automatic pathfinding doesn't switch to a bridge. Consequently, the path is discarded before the script AI even receives the path coordinates.

In my opinion, forcing specific speeds is unnecessary. What is needed is a mechanism like the one for headquarters that allows the ford to be upgraded via the info window.

This would likely make sense for all intersections.

victor_18993

Quote from: Andarix on Today at 06:17:02 AMThat's the crux of the matter. The automatic pathfinding doesn't switch to a bridge. Consequently, the path is discarded before the script AI even receives the path coordinates.

In my opinion, forcing specific speeds is unnecessary. What is needed is a mechanism like the one for headquarters that allows the ford to be upgraded via the info window.

This would likely make sense for all intersections.
Okay, I understand exactly the implementation you need. Let me review it and see what fit it might have. Thanks.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

makie

#6
Quote from: victor_18993 on Today at 01:45:39 AMOne important detail is that pak64 currently contains no road/water crossing descriptor at all. Therefore, with pak64 alone, no ford can be built unless such a crossing is provided by an addon. A bridge can still be used normally.
We had that too. In pak128.german, we deliberately omitted fords so they wouldn't get built—at least until the speed mechanics were included in the program. That was the condition for including fords.

Quote from: Andarix on Today at 06:17:02 AMThat's the crux of the matter. The automatic pathfinding doesn't switch to a bridge. Consequently,
In my view, the best solution is this: if the pathfinder cannot find or build a ford, they should try a bridge or an underpass. This applies not only to fords but also to railway crossings. And this shouldn't just apply to the AI; it should also work when the player wants to build a track automatically—by simply clicking the start and end points. The bridge or tunnel should automatically selected to best match the track's speed rating. After all, a player wouldn't do it any differently when building manually. Laying out routes across the terrain is truly tedious and exhausting on a touchscreen; a well-functioning automated system would—as a side benefit—solve the problem of the big menu full filled with roads, bridges, and tunnels, since you would no longer need to construct routes in small details, piece by piece.
Quote from: victor_18993 on Today at 01:45:39 AMThe historical change in r9410 intentionally made crossing selection depend on the crossing speed, and r11983 later added the public-player >=25 km/h exception.
If it works this way, then this poor workaround r11983 in the program can be removed.

prissi

This explaination is too short. In order to have more crossing types, selection by speed was enforced.

Several player complained about car crossing high speed lines => Hence, no crossing, if there is not crossing which has this maximum speed.

Andarix complained about no fords => Added fords during world generation for public_player.

If you want more fords, just make a ford with a maximum speed of the fastest road that should cross. Very easy.

makie

Quote from: prissi on Today at 09:29:35 AMThis explaination is too short. In order to have more crossing types, selection by speed was enforced.

Several player complained about car crossing high speed lines => Hence, no crossing, if there is not crossing which has this maximum speed.

Andarix complained about no fords => Added fords during world generation for public_player.
The thing with the fords is just a crutch.

The problem is that the pathfinder cannot handle bridges and tunnels, and the (script)AI struggles with that.
It is nonsense to open up the fords and crossings for that.

QuoteIf you want more fords, just make a ford with a maximum speed of the fastest road that should cross. Very easy.
No, there will be no fords for motorways, nor crossings for high-speed railway in pak128.german.
Not even for friendly to the AI-player.

There are bridges and tunnels for that.

Andarix

Quote from: prissi on Today at 09:29:35 AM...
Andarix complained about no fords => Added fords during world generation for public_player.
....

You want a well-functioning scripted AI. That isn't possible with the current behavior because the scripted AI simply lacks the necessary information.

As a player, I practically don't care whether there are fords or not.

But for the scripted AI, it's a different story, since it doesn't have eyes.

Right now, a more capable scripted AI doesn't seem to be a priority, given that restrictions severely handicapping it aren't being lifted. Consequently, I'll likely put the scripted AI aside for the foreseeable future. I doubt players use it at all, anyway.
At least for as long as more effort goes into working against the scripted AI rather than for it.