Jibble

Author Topic: Solid characters passing one another. SOLVED  (Read 321 times)

Solid characters passing one another. SOLVED
« on: 08 Oct 2021, 14:28 »
Hello,

I've looked into this problem I'm having with two characters which are set to "Solid" are passing through one another, but I cant see where I'm going wrong and need a fresh mind perspective.
I know I'm missing something simple as I've not had an issue in the past with other characters.

The two characters in question are on the same walkable area with the same baselines. the strange thing is if I click on a area to walk which is passed "cChar1" (NPC) then "cChar2" (Main player) starts to walk in the direction passed cChar1 and stops at the point where I'm assuming the solid characters have been detected yet if I click again then cChar2 simply walks straight though cChar1.

Thanks in advance.
« Last Edit: 16 Oct 2021, 22:18 by Pax Animo »
I'm a slow learner but I like to ask questions.

Peckham 1503 11/21 Devlog available.
https://pax-animo.itch.io/pecham-1503

Re: Solid characters passing one another.
« Reply #1 on: 08 Oct 2021, 15:45 »
You can press Ctrl+A during the game and you should see the walkable areas and the holes that the characters' solidity cuts out of them. Depending on the character's .BlockingWidth and .BlockingHeight and the sprites of the walk view, they might actually pass each other.

Re: Solid characters passing one another.
« Reply #2 on: 08 Oct 2021, 16:11 »
You can press Ctrl+A during the game and you should see the walkable areas and the holes that the characters' solidity cuts out of them. Depending on the character's .BlockingWidth and .BlockingHeight and the sprites of the walk view, they might actually pass each other.

Much appreciated, I at least now know where to start on figuring out how to make it work for me. (probably starting with their sprites)
I'm a slow learner but I like to ask questions.

Peckham 1503 11/21 Devlog available.
https://pax-animo.itch.io/pecham-1503

Re: Solid characters passing one another.
« Reply #3 on: 10 Oct 2021, 14:21 »
Note that the default blocking height is only five pixels AFAIK. That may be reasonable in 320x200 games but is not reasonable in high resolutions.

A perspective drawing emulates three dimensions.with only two dimensions.  Let's call the three dimensions  left/right, high/low, upstage/downstage (the latter means to the back/to the front). And let's call the two dimensions X and Y.

The Y dimension of the perspective drawing is the one that does “double duty”: When a character is jumping, their Y component will decrease and when the character is walking upstage, their Y component will decrease, too. So if you have two points in a perspective drawing, one directly above the other, then you simply don't know whether the one is farther upstage than the other or whether the one is floating higher above the other.

So in this context, the term “Blocking height” is potentially misleading: What is meant is a distance in the upstage/downstage dimension, not in the high/low dimension.

Here's an illustration.


Let's call the rectangle that the solid object is standing on (in the left/right, upstage/downstage dimensions) the “footprint rectangle”

Note that AGS treats walking characters as if they didn't have any footprint rectangle at all.  Instead, characters are represented by just the mid point of their baseline. Every character can walk anywhere so long as the mid point of their baseline stays within the walkable area. When the midpoint of the baseline of a character is right at the edge of the walkable area, then their real extensions will already be off.

This is important because the footprint rectangle of the “solid” object is cut out of the walkable area. To prevent collisions you need to guess how big the footprint rectangle of the biggest potentially colliding character will be, and then enlarge the footprint rectangle of the “solid” object so that even that character can't collide, even when the midpoint of the baseline of that character is right on the edge of the cut out area.

Let's say that your biggest character has a sprite width of 100 pixels. Then the “blocking width” of all solid objects or characters must be 100 pixels larger than their own footprint width would be (50 additional pixels to the right of the sprite and 50 additional pixels to the left of the sprite). Let's say that your biggest character has an extension in the upstage/downstage direction of 100 pixels. Then the “blocking height” of all solid objects or characters must be 100 pixels larger than their own footprint height would be.

Finally, note that according to AGS, the “blocking height” extends as far below the baseline as it does above. In my opinion, this is a design mistake. It would mean that the deeper an object extends upstage, the deeper it extends downstage, too, and this is patently false.

What's right instead is that the baseline is right at the lower edge of the footprint rectangle. Although we need to extend the footprint rectangle in the upstage/downstage dimension somewhat to compensate for the footprint rectangle of colliding characters, only this additional, extending amount extends as far upstage as it does downstage.
« Last Edit: 11 Oct 2021, 01:28 by fernewelten »

newwaveburritos

  • Party Weekend
    • newwaveburritos worked on one or more games that was nominated for an AGS Award!
Re: Solid characters passing one another.
« Reply #4 on: 10 Oct 2021, 23:26 »
Thanks for the great explanation, fernewelten.  This explains a lot of the difficulties I was having in myself with this issue.

Re: Solid characters passing one another.
« Reply #5 on: 14 Oct 2021, 11:44 »
fernewelten,

Much apricated for your time to explain more in depth on the issue.

For me a "BlockingWidth" adjustment fixed my issues, as the characters use the same walkable areas, I'm guessing it wouldn't be so simple for other situations.
« Last Edit: 29 Oct 2021, 22:24 by Pax Animo »
I'm a slow learner but I like to ask questions.

Peckham 1503 11/21 Devlog available.
https://pax-animo.itch.io/pecham-1503