The International Simutrans Forum

Development => Extension Requests => Topic started by: Leartin on January 26, 2016, 04:02:23 PM

Title: Roads: Different length of outer and inner curve
Post by: Leartin on January 26, 2016, 04:02:23 PM
Current Situation:
The length of a diagonal piece of way is measured by it's center. This makes a lot of sense since most vehicles use the center of the road, and even when not, in sum diagonal pieces in different directions cancel each other in terms of total way length.
However, it leads to cars and especially pedestrians to "teleport" whenever they travel on a curve (change from straight to diagonal direction),
since they, too, move along the center of their way and have just an offset graphic.

Request:
Less jumping by changing the actual travel distance and time on diagonal roads.

How:
Start by getting rid of the graphical offset and replace it with a parameter.
The parameter should be a number that gives the offset in pixel in NE/SW direction. This is because that offset would be the biggest number, NW/SE would be half that number, and NS/EW half of both of those in the respective directions.

However, this is not for each vehicle, but once for the pakset settings or for each road. The vehicles who are to be offsetted automatically gain "use_auto_offset = 1" or something (backwards-compatibility)

Whenever a vehicle traverses a NE/SW diagonal, instead of the usual diagonal length, it uses that length plus/minus offset parameter.
Whenever a vehicle traverses a NW/SE diagonal, instead of the usual diagonal length, it uses that length plus/minus 2x offset parameter.


Further implications one might realize based on this:
slightly different offset for each invidiual vehicle to not drive them exactly the same amount of pixels away from the edge (but probably only useful in really high-scale paks)
Similarly, using the same alterations of offset for pedestrians makes them use the full sidewalk
someday, if multilane-ways are realized, they might profit from centered car images.
...but that's just the future.

For now, the idea is getting rid of teleporting vehicles. Pretty please!
Title: Re: Roads: Different length of outer and inner curve
Post by: Dwachs on January 26, 2016, 08:24:18 PM
I like the request. Honestly, I wonder why nobody else proposed something like this before.

For the implementation / dat files, it could be done by a scaling factor ranging from 0 .. 100: 100 = vehicles is in the centre of the way, 0 = vehicle is at the border of the tile.

If implemented it should be implemented per vehicle.

Also there is the question if you have a train or truck + trailer with vehicles with different positions on the track/road....
Title: Re: Roads: Different length of outer and inner curve
Post by: Vladki on January 26, 2016, 08:59:03 PM
There is a similar offset unit for signals on left side, which is in range 0..16, where 0 is centre (no shift) and 16 is border. Yes it is a bit coarse, but it will be nice to be consistent.
Title: Re: Roads: Different length of outer and inner curve
Post by: Leartin on January 26, 2016, 10:55:21 PM
Quote from: Dwachs on January 26, 2016, 08:24:18 PMFor the implementation / dat files, it could be done by a scaling factor ranging from 0 .. 100: 100 = vehicles is in the centre of the way, 0 = vehicle is at the border of the tile.
Quote from: Vladki on January 26, 2016, 08:59:03 PMThere is a similar offset unit for signals on left side, which is in range 0..16, where 0 is centre (no shift) and 16 is border. Yes it is a bit coarse, but it will be nice to be consistent.

I don't understand the advantage of using such scale instead of a pixel value, especially if the scale is finer than pixels. Wouldn't that just mean that the human pak-creater would have to calculate which number to use to get the right amount of pixels, while the game again has to calculate back to the pixel amount? Is this just a code design principle (seperation of graphics and function), or is there an actual advantage I can't see?
Btw. 16 would mean 6 pixel steps in pak192, that is indeed a bit coarse.



Quote from: Dwachs on January 26, 2016, 08:24:18 PMIf implemented it should be implemented per vehicle.
I wouldn't complain, but what is the advantage?
Title: Re: Roads: Different length of outer and inner curve
Post by: prissi on January 26, 2016, 11:31:53 PM
I think this could be bound to the waytype, since only road can have this behaviour (maybe water too).

Vehiclewise may not a good idea, since some vehicle would jump and other not, and stop suddenly before a "slower" diagonal vehilce.
Title: Re: Roads: Different length of outer and inner curve
Post by: Leartin on January 27, 2016, 06:07:17 AM
Quote from: prissi on January 26, 2016, 11:31:53 PM
I think this could be bound to the waytype, since only road can have this behaviour (maybe water too).

Special case for pedestrians, where the teleporting is most prominent since they are furthest outside.
Title: Re: Roads: Different length of outer and inner curve
Post by: prissi on January 27, 2016, 09:11:38 PM
Sure, if we touch this, one can easily do this.