The International Simutrans Forum

Development => Extension Requests => Topic started by: Ichou on March 05, 2017, 01:59:57 PM

Title: Ill-placed waiting vehicles
Post by: Ichou on March 05, 2017, 01:59:57 PM
(Perhaps I should have posted it to bug reports.)

Hi, everyone.
I have an issue about vehicles' drawing place.
First, look at the picture.
(http://simutrans-germany.com/files/upload/Ill-placed_cars.PNG)
One of the two waiting cars at the crossings is placed just on the crossing. It looks to be likely to cause a crash.(Of course, there is no crash in Simutrans.)
You might think it's caused by a wrong offset, but offset is right because it stops at stations properly.

This ill-placed problem occurs only to northward or westward vehicles.
And the same problem occurs to trains. Maybe monorail, maglev, and other kinds, too.

So someone can fix it?
Title: Re: Ill-placed waiting vehicles
Post by: prissi on March 05, 2017, 03:03:52 PM
It does not stop at the station properly. It should stop closer to the border to the new tile.

To avoid drawing issue, vehicle going north or east are offseted by half a tile. This is taken into account for stations. However, when driving the check, whether the next tile is free, is not done in the middle of a tile, but when enetring the new tile. So there will be a little overhang into the crossing. But that bus is not well alinged, there is a template somewhere.
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 06, 2017, 04:17:25 AM
(http://simutrans-germany.com/files/upload/Ill-placed_cars2.PNG)
Then how about a bus of an even number of cars?
When the offset is good for crossings, then it doesn't fall within the stop.

QuoteSo there will be a little overhang into the crossing.
Then how about managing a train of N cars using N+1 points?
It seems to solve this problem.
Title: Re: Ill-placed waiting vehicles
Post by: prissi on March 06, 2017, 05:32:50 AM
Trains have exactly the same stopping issue at signals.
Title: Re: Ill-placed waiting vehicles
Post by: DrSuperGood on March 06, 2017, 05:47:11 AM
I believe this is a visual only problem. The actual convoys are stopped in the correct tile, just their art work is offset into the next tile.

First one needs to confirm that the bus artwork is correctly aligned. It is pointless looking for a bug in the code if the bug is with the artwork.

If there is still a problem, a possible solution might be to force a offset for convoy artwork that is facing certain directions. The convoy is still physically in the same place but would appear hopefully at a more appropriate offset. This might result in visual bugs when going around corners.
Title: Re: Ill-placed waiting vehicles
Post by: Ters on March 06, 2017, 06:31:34 AM
The artwork obviously the same for the bus at the red light and the bus at the stop. If the artwork is modified, it seems logical that the bus will no longer align with the bus stop. There must be some discrepancy in the code. Maybe there is some code to compensate for misaligned artwork at stops, but that seems strange.

Not that there isn't a lot of misaligned artwork around. Pak64 could really need some touchups there.
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 06, 2017, 06:57:39 AM
Quotea possible solution might be to force a offset for convoy artwork that is facing certain directions.
As I said, I think just changing offset or operation like this cannot solve the problem because offsets suit crossings don't suit stations and what suit stations don't suit crossings.

So I propose managing with such points: where existing at the beginning, at the end of trains, and at the connecting points of cars.
Then each car will have 2 points: 'front' point and 'back' point.

I think this idea has 2 conceivable problems.
Title: Re: Ill-placed waiting vehicles
Post by: prissi on March 06, 2017, 02:42:57 PM
Problem with stopping earlier in front or crossings or signals is, that then vehicles would drive on, before they are on the crossing. Hence suddenly some other vehicle may cut the crossing in front. Or if somewhat reserving the crossing, then crossing would take 1.5 longer in N or E than W or S direction, and those vehicles would considerably block more.

The reason for that position comes from the drawing algorithm. Any object (especially on bridges or elevated ways) must not trail into the tile it entered, or it risks its back half being cut off.
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 07, 2017, 11:43:06 AM
QuoteHence suddenly some other vehicle may cut the crossing in front. Or if somewhat reserving the crossing, then crossing would take 1.5 longer in N or E than W or S direction, and those vehicles would considerably block more.
QuoteThe reason for that position comes from the drawing algorithm.
I understood it, and understood that an intuitive and simple solution is impossible.

So I'm suggesting a new way manage trains.(Please read my previous post)
My idea's the most important advantage is that we can use the same traffic/reserving algorithm as the current. Thus you don't have to change the code about it.
Title: Re: Ill-placed waiting vehicles
Post by: DrSuperGood on March 07, 2017, 03:07:44 PM
Surely one would only need to monitor the front point of the vehicle? That way it could never bleed into another tile as to do so it would have to enter the other tile for its front to be in that other tile. The front point would be defined based on orientation of the image. The front point is used to position the image such that first the sub tile position is calculated (where in the tile the front point should be) and then the image is reproduced such that its front point is on the calculated tile front point.

This traffic light and bus seems a lot worse than I recall seeing with trains. Maybe its a traffic light bug allowing it into the intersection tile by mistake? Or maybe a bug with a compund road convoy not aligning art correctly?
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 08, 2017, 12:06:25 AM
QuoteSurely one would only need to monitor the front point of the vehicle?
About stopping at stations or crossings, yes. But we have to monitor both front and back points to reserve/unreserve tiles.

QuoteThe front point would be defined based on orientation of the image.
Yes, the front point would be the same location to the orientation of the train.
But strictly, the points define the location of images, the images don't define the points.

QuoteThe front point is used to position the image such that first the sub tile position is calculated (where in the tile the front point should be) and then the image is reproduced such that its front point is on the calculated tile front point.
It might work well.
But I think we have to consider both front and back points of each car, in order to avoid clipping images problems like what prissi said.

QuoteThis traffic light and bus seems a lot worse than I recall seeing with trains.
Maybe there is no difference. I intentionally chose a car whose body is long.
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 08, 2017, 02:01:05 PM
I'm sorry DrSuperGod, just now I maybe got what you really meant, and found I'd done a misunderstanding.(I'd thought you were confirming my idea, but I found that you proposed your own idea.)
So let me reply again.

QuoteSurely one would only need to monitor the front point of the vehicle?The front point would be defined based on orientation of the image.
I think it would occur clipping images problem, such as what prissi said. That's because objects are drawn from NW(back) tiles to SE(front) tiles.
But I think there is some possibility to avoid this problem, by drawing images with an appropriate order.
However. I have no idea how to realize the appropriate order.
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 09, 2017, 02:18:21 PM
I'm sorry to post three times in a row.

By the way, what is the reason there are no problems about images of vehicles and frontimgs of ways?
If images are drawn from NW tiles to SE tiles, it seems that there are some clipping problems between vehicles and frontimgs.
Title: Re: Ill-placed waiting vehicles
Post by: Isaac Eiland-Hall on March 09, 2017, 08:51:05 PM
Quote from: Ichou on March 09, 2017, 02:18:21 PM
I'm sorry to post three times in a row.

Just to note, this is not a problem. The rule is that you cannot reply to yourself if it has been less than 24 hours. In each case, it was more than 24 hours (by minutes, the second time! hehe), so you are not in violation of the rules in the slightest. :)
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 13, 2017, 06:21:38 AM
I'm sorry to be too late.

QuoteJust to note, this is not a problem. The rule is that you cannot reply to yourself if it has been less than 24 hours.
Yes, I knew it at that time, but in Japan, humbling is a good manner. So I wrote such a thing subconsciously.

As you know, current Simutrans can nicely show the images of vehicles and frontimages of ways and can avoid the clipping problem.
So I think a similar way can nicely avoid the clipping problem of the images of vehicles and backimages of ways.
Title: Re: Ill-placed waiting vehicles
Post by: jamespetts on March 13, 2017, 10:40:09 AM
I wonder whether these issues are ultimately responsible for the gaps between railway vehicles when some are reversed and others are not in Simutrans-Extended?
Title: Re: Ill-placed waiting vehicles
Post by: Ichou on March 13, 2017, 11:07:22 AM
QuoteI wonder whether these issues are ultimately responsible for the gaps between railway vehicles when some are reversed and others are not in Simutrans-Extended?
I've not taken it into account at all.
Maybe you can decide whether adopt it or not because you are the developer of Simutrans-Extended.