Author Topic: Patches to pedestrian behavior  (Read 1879 times)

0 Members and 1 Guest are viewing this topic.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Patches to pedestrian behavior
« 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?
« Last Edit: June 15, 2017, 10:41:06 AM by Dwachs »
Parsley, sage, rosemary, and maggikraut.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15682
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Patches to pedestrian behavior
« Reply #1 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?
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 Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #2 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.
Parsley, sage, rosemary, and maggikraut.

Online Leartin

  • Devotee
  • *
  • Posts: 796
  • Total likes: 287
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Patches to pedestrian behavior
« Reply #3 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?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8796
  • Total likes: 319
  • Helpful: 229
  • Languages: De,EN,JP
Re: Patches to pedestrian behavior
« Reply #4 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?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #5 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.
Parsley, sage, rosemary, and maggikraut.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Patches to pedestrian behavior
« Reply #6 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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Patches to pedestrian behavior
« Reply #7 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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #8 on: June 15, 2017, 04:43:25 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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Patches to pedestrian behavior
« Reply #9 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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #10 on: June 17, 2017, 08:28:52 PM »
which pakset?
Parsley, sage, rosemary, and maggikraut.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Patches to pedestrian behavior
« Reply #11 on: June 18, 2017, 05:00:49 PM »
pak64, pak96.comic & pak192.comic.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #12 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?
Parsley, sage, rosemary, and maggikraut.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Patches to pedestrian behavior
« Reply #13 on: June 18, 2017, 09:02:28 PM »
Maybe, this way the pakset can create bicycles that run at the side of the road.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Patches to pedestrian behavior
« Reply #14 on: June 19, 2017, 04:52:23 AM »
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.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Patches to pedestrian behavior
« Reply #15 on: June 20, 2017, 05:13:03 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.

Online Leartin

  • Devotee
  • *
  • Posts: 796
  • Total likes: 287
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Patches to pedestrian behavior
« Reply #16 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?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #17 on: June 23, 2017, 05:15:01 AM »
There is one offset parameter per pedestrian.
Parsley, sage, rosemary, and maggikraut.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #18 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?
Parsley, sage, rosemary, and maggikraut.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Patches to pedestrian behavior
« Reply #19 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?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Patches to pedestrian behavior
« Reply #20 on: July 04, 2017, 05:17:16 AM »
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.

Online Leartin

  • Devotee
  • *
  • Posts: 796
  • Total likes: 287
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Patches to pedestrian behavior
« Reply #21 on: July 04, 2017, 10:10:12 AM »
@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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #22 on: July 05, 2017, 06:12:20 PM »
ok, included in r8255. Thanks for testing and commenting.
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT

Re: Patches to pedestrian behavior
« Reply #23 on: July 29, 2017, 01:32:42 PM »
I do not know if this is a pakset error.  ???



Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: Patches to pedestrian behavior
« Reply #24 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.
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT

Re: Patches to pedestrian behavior
« Reply #25 on: July 29, 2017, 01:54:10 PM »
Thanks for your quick reply.  ;D