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

0 Members and 1 Guest are viewing this topic.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4164
  • Total likes: 147
  • Helpful: 147
  • 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: 15258
  • Total likes: 361
  • Helpful: 159
  • 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: 4164
  • Total likes: 147
  • Helpful: 147
  • 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.

Offline Leartin

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: 8698
  • Total likes: 300
  • Helpful: 228
  • 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: 4164
  • Total likes: 147
  • Helpful: 147
  • 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: 4577
  • Total likes: 167
  • Helpful: 106
  • 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: 2548
  • Total likes: 279
  • 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: 4164
  • Total likes: 147
  • Helpful: 147
  • 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: 2548
  • Total likes: 279
  • 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: 4164
  • Total likes: 147
  • Helpful: 147
  • 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: 2548
  • Total likes: 279
  • 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: 4164
  • Total likes: 147
  • Helpful: 147
  • 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: 2548
  • Total likes: 279
  • 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: 4577
  • Total likes: 167
  • Helpful: 106
  • 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: 2548
  • Total likes: 279
  • 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.

Offline Leartin

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: 4164
  • Total likes: 147
  • Helpful: 147
  • 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.