Author Topic: Ill-placed waiting vehicles  (Read 1808 times)

0 Members and 1 Guest are viewing this topic.

Offline Ichou

Ill-placed waiting vehicles
« 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.

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?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: Ill-placed waiting vehicles
« Reply #1 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.

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #2 on: March 06, 2017, 04:17:25 AM »

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.

Quote
So 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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: Ill-placed waiting vehicles
« Reply #3 on: March 06, 2017, 05:32:50 AM »
Trains have exactly the same stopping issue at signals.

Offline DrSuperGood

Re: Ill-placed waiting vehicles
« Reply #4 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4900
  • Total likes: 217
  • Helpful: 108
  • Languages: EN, NO
Re: Ill-placed waiting vehicles
« Reply #5 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.

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #6 on: March 06, 2017, 06:57:39 AM »
Quote
a 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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: Ill-placed waiting vehicles
« Reply #7 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.

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #8 on: March 07, 2017, 11:43:06 AM »
Quote
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.
Quote
The 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.

Offline DrSuperGood

Re: Ill-placed waiting vehicles
« Reply #9 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?

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #10 on: March 08, 2017, 12:06:25 AM »
Quote
Surely 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.

Quote
The 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.

Quote
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.
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.

Quote
This 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.

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #11 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.

Quote
Surely 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.

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #12 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.

Offline Isaac.Eiland-Hall

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3440
  • Total likes: 332
  • Helpful: 91
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Ill-placed waiting vehicles
« Reply #13 on: March 09, 2017, 08:51:05 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. :)

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #14 on: March 13, 2017, 06:21:38 AM »
I'm sorry to be too late.

Quote
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.
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.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 16148
  • Total likes: 446
  • Helpful: 178
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Ill-placed waiting vehicles
« Reply #15 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?
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.

Offline Ichou

Re: Ill-placed waiting vehicles
« Reply #16 on: March 13, 2017, 11:07:22 AM »
Quote
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?
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.