News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Ill-placed waiting vehicles

Started by Ichou, March 05, 2017, 01:59:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ichou

(Perhaps I should have posted it to bug reports.)

Hi, everyone.
I have an issue about vehicles' drawing place.
First, look at the picture.

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?

prissi

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.

Ichou


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.

prissi

Trains have exactly the same stopping issue at signals.

DrSuperGood

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.

Ters

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.

Ichou

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.

  • Drawing problem
    To be drawn same as before, 'upward' vehicles must be drawn following the 'back' point, and 'downward' vehicles must follow the 'front' point.
    Then vehicles will be drawn twice, or not drawn, at curves where they turn from downward to upward, or upward to downward.
    I think there is some sort of ways to choose which to draw.
  • Occupying problem
    A train with just a length of 1 tile may occupy another void tile. It's different from current Simutrans.
    But I think it's not a problem because in the real world buffer space between cars is needed.

prissi

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.

Ichou

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.

DrSuperGood

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?

Ichou

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.

Ichou

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.

Ichou

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.

Isaac Eiland-Hall

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. :)

Ichou

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.

jamespetts

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?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ichou

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.