The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Dwachs on June 14, 2017, 07:14:51 PM

Title: Patches to pedestrian behavior
Post by: Dwachs on June 14, 2017, 07:14:51 PM
This is a series of three patches for pedestrian movement.

1) Adds animations to pedestrian movements. See Leartins request here: http://forum.simutrans.com/index.php?topic=16645.0 , to test you can use the attached pak192.comic animated pedestrian.

2) Changes pedestrian movement to look more pleasant. Pedestrians will never turn left to go diagonally. Diagonal movement is only when turning to the right. There is a dat parameter taking the offset of pedestrian into account to modify length of diagonal paths on tiles. Pedestrians will now also walk on the left side of the road. They will never travel on long diagonals, rather they will cross the road.

The suicidal behavior of pedestrians is not touched. They will cross streets regardless of traffic.

3) There are graphical glitches with road vehicles and pedestrians on the same tile, even when going into the same direction. This is addressed by the third patch. It implements same basic sorting of stuff on a tile by a a paramater called 'disp_lane' (lane of display). Road vehicles and pedestrian are on different 'lanes'. As a side effect, the routine objlist_t::intern_add_moving is much simplified.

I consider (1) and (2) pretty much finished and ready for inclusion. Do you have any comments?
Title: Re: Patches to pedestrian behavior
Post by: jamespetts on June 14, 2017, 09:27:50 PM
Without having reviewed the code, may I check whether the pedestrians refusing to turn left translates to pedestrians refusing to turn right when drive_on_left is enabled?
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 15, 2017, 08:42:53 AM
Pedestrians are not influenced by drive_on_left. Turing left means that the pedestrians move in the longer diagonal direction on the tile, which just looks ugly. For instance, if the road graphics shows a nice curve, then the pedestrians would cross through the curve thus leaving the sidewalk. I was not able to make this look pretty.
Title: Re: Patches to pedestrian behavior
Post by: Leartin on June 15, 2017, 08:53:36 AM
You said you changed it so pedestrians can be on both sides on the road. So does that mean pedestrians on the right side only turn right and pedestrians on the left side only turn left? Otherwise, wouldn't pedestrians on the left turning right use the long diagonal?
Title: Re: Patches to pedestrian behavior
Post by: prissi on June 15, 2017, 10:04:41 AM
So pedetrians on a diagonal road will only walk on the left side? Or will they cross every second tile?
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 15, 2017, 10:45:34 AM
Pedestrian will not turn left to go diagonally through a tile, they will turn left to cross street. Pedestrians will never take the long diagonal, as this looks ugly. On a diagonal road the pedestrians will follow a zigzag pattern, which is barely visible as they do not go very far before 'dying'.

Hope this makes things clearer.
Title: Re: Patches to pedestrian behavior
Post by: Ters on June 15, 2017, 01:58:48 PM
If you can just drop the drop the "will not turn left" and just go with "never take the long diagonal" and "walk both ways on both sides", then I think I get it.
Title: Re: Patches to pedestrian behavior
Post by: An_dz on June 15, 2017, 03:01:05 PM
What Dwachs is saying is that when the pedestrian is walking north (up) on the west (left) side of the road and goes to the a road to the west (left) they won't fire the stupid diagonal animation, instead they will make as a normal person and just start walking on the left road. As he describes it seems to affects all directions as this only affects when the pedestrian turn to ITS left.

Basically the patch now makes that pedestrians will walk on both directions normally and on both sides of the road.

I'll compile a build and check how they work more closely to see if there are any bugs.
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 15, 2017, 04:43:25 PM
Quote from: Ters on June 15, 2017, 01:58:48 PM
If you can just drop the drop the "will not turn left" and just go with "never take the long diagonal" and "walk both ways on both sides", then I think I get it.
Yes, I mean this:  "never take the long diagonal" and "walk both ways on both sides"
Title: Re: Patches to pedestrian behavior
Post by: An_dz on June 17, 2017, 03:23:34 PM
There's one problem, not compatible with current pedestrians. They are misaligned, when they walk on the "old" side of the road it's not too much, but when they walk on the other side they walk inside the buildings.
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 17, 2017, 08:28:52 PM
which pakset?
Title: Re: Patches to pedestrian behavior
Post by: An_dz on June 18, 2017, 05:00:49 PM
pak64, pak96.comic & pak192.comic.
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 18, 2017, 06:25:59 PM
Ups, seems that the initialization of the offset went missing.

Edit: updated patches attached.

The initialization of the offset is in pedestrian_reader.cc. Should this be made some parameter that it can be configured by paksets?
Title: Re: Patches to pedestrian behavior
Post by: An_dz on June 18, 2017, 09:02:28 PM
Maybe, this way the pakset can create bicycles that run at the side of the road.
Title: Re: Patches to pedestrian behavior
Post by: Ters on June 19, 2017, 04:52:23 AM
Quote from: An_dz on June 18, 2017, 09:02:28 PM
Maybe, this way the pakset can create bicycles that run at the side of the road.

As long as the bicycles function as pedestrians, just with less offsets, cars will not initiate overtaking behavior, but realistically try to hit the cyclist with their side mirrors. However, cyclist will as I understand it go both ways on either side of the road, which is less realistic.
Title: Re: Patches to pedestrian behavior
Post by: An_dz on June 20, 2017, 05:13:03 AM
Quote from: Ters on June 19, 2017, 04:52:23 AM
As long as the bicycles function as pedestrians, just with less offsets, cars will not initiate overtaking behavior, but realistically try to hit the cyclist with their side mirrors. However, cyclist will as I understand it go both ways on either side of the road, which is less realistic.
At least on your Norwegian view of realism, to me you just described Brazil.
Title: Re: Patches to pedestrian behavior
Post by: Leartin on June 20, 2017, 06:21:28 AM
If there is ONE parameter for the offset, I don't think it enables bikes. You'd either need to have a parameter per pax, so you can define a different one for each pax, or create bikes as some kind of entity which behaves just like pax, but is twice as quick and has it's own offset.

What I wonder - could similar code be used for cars and ships as well? If so, could we get the offset defined by the way, so that cars would be more spread out on a broad street and closer together on a more narrow mountain path, and ships in a channel would stay on their side, but on the ocean are in the middle of the tile?
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 23, 2017, 05:15:01 AM
There is one offset parameter per pedestrian.
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on June 30, 2017, 04:30:01 PM
Do you have any requests about the patch? Otherwise I would like to submit it.

Would it be necessary to include a flag to forbid that some 'pedestrians' will move on the left side of the road?
Title: Re: Patches to pedestrian behavior
Post by: An_dz on July 03, 2017, 10:42:07 PM
I can't see a reason for such. And since the initialisation bug was fixed I think you can commit it.

@Leartin? You are the one who can think of impossible possibilities ;D, do you want such flag?
Title: Re: Patches to pedestrian behavior
Post by: Ters on July 04, 2017, 05:17:16 AM
Quote from: Dwachs on June 30, 2017, 04:30:01 PM
Would it be necessary to include a flag to forbid that some 'pedestrians' will move on the left side of the road?

Around here, it would be illegal for cyclists to drive on the left side of a road, and usually illegal for pedestrians to walk on the right side, if there is no pavement/sidewalk, but that is no big deal.
Title: Re: Patches to pedestrian behavior
Post by: Leartin on July 04, 2017, 10:10:12 AM
Quote from: An_dz on July 03, 2017, 10:42:07 PM@Leartin? You are the one who can think of impossible possibilities ;D, do you want such flag?

Woo! I got a reputation :D

I can't think of anything that would require such a flag in a pedestrian, unless the lane-switching could lead to some glitches for some unknown reasons, but that would need to be seen in testing. If anything, it would need to go in the way or a wayobject, perhaps in the sidewalk (but wasn't there talk about turning that in a wayobj, too?) since those objects determine through their graphic whether the laws Ters mentioned apply, and/or if there even is visible space for people to walk. Eg. the one-way-patch will probably bring some two-thick-roads somehow, where the center between them would not usually be accessible for pedestrians. So, combining pedestrians following the one-way-rule and having a no-left-flag on those roads would make sense.

On the other hand, even I feel like that's too much for too little. It's just pedestrians, an eleborate particle effect. All three changes just make that particle effect look better, which is important since looking good is it's sole purpose. Anything that does not really aid in making them look good is time better invested in things that don't just need to look good.
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on July 05, 2017, 06:12:20 PM
ok, included in r8255. Thanks for testing and commenting.
Title: Re: Patches to pedestrian behavior
Post by: Yona-TYT on July 29, 2017, 01:32:42 PM
I do not know if this is a pakset error.  ???

(http://files.simutrans.com/index.php/apps/files_sharing/ajax/publicpreview.php?x=1440&y=372&a=true&file=erro_pedestral.png&t=o2rtfMPOfNTb81p&scalingup=0)
Title: Re: Patches to pedestrian behavior
Post by: Dwachs on July 29, 2017, 01:46:15 PM
This is a pakset error (I suppose), the pedestrians are most likely not correctly positioned in the graphics.
Title: Re: Patches to pedestrian behavior
Post by: Yona-TYT on July 29, 2017, 01:54:10 PM
Thanks for your quick reply.  ;D