News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Patches to pedestrian behavior

Started by Dwachs, June 14, 2017, 07:14:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dwachs

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?
Parsley, sage, rosemary, and maggikraut.

jamespetts

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

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Leartin

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?

prissi

So pedetrians on a diagonal road will only walk on the left side? Or will they cross every second tile?

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Ters

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.

An_dz

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.

Dwachs

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"
Parsley, sage, rosemary, and maggikraut.

An_dz

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.

Dwachs

Parsley, sage, rosemary, and maggikraut.

An_dz

pak64, pak96.comic & pak192.comic.

Dwachs

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?
Parsley, sage, rosemary, and maggikraut.

An_dz

Maybe, this way the pakset can create bicycles that run at the side of the road.

Ters

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.

An_dz

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.

Leartin

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?

Dwachs

There is one offset parameter per pedestrian.
Parsley, sage, rosemary, and maggikraut.

Dwachs

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?
Parsley, sage, rosemary, and maggikraut.

An_dz

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?

Ters

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.

Leartin

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.

Dwachs

ok, included in r8255. Thanks for testing and commenting.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

I do not know if this is a pakset error.  ???



Dwachs

This is a pakset error (I suppose), the pedestrians are most likely not correctly positioned in the graphics.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT