Walkable areas

Started by Dor Hajaj, Sat 02/06/2018 00:47:02

Previous topic - Next topic

Dor Hajaj

Hi,

Can anyone explain why and how the following occurs?
the walkable area does not include the brick walls yet the character stands on the wall well above the walkable area. Does it have to do with the char's baseline?
Thanks!


Privateer Puddin'

Are there transparent pixels at the bottom of the character sprite?

Cassiebsg

Yes, like you already guessed, it does have to do with the character's baseline (also known as z coord).
AGS takes the lower Y to determine the characters feet, if you have transparent pixels (alpha) under the feet AGS will not care and still use that Y as where the feet are.

Solutions are:
Change the character's Z to where the feet actually are: player.z=-10; (if it's 10 pixels) place the line at game start.
Redraw the walkable area so it's not as "high".

Also it's a good idea to not draw it so close to the walls to avoid that effect when he's walking. So unless there's a very good reason (like the character is walking on a very narrow ledge and has a very small area for the feet, then always leave a few pixels free between the  floor and the walls, as we usually don't walk that close to walls anyway.  ;) It will save you a lot of "the player character is standing/waking on the wall here" comments from your beta testers later on.
There are those who believe that life here began out there...

Crimson Wizard

#3
EDIT: Sorry, I did not realize you all mean "baseline" as in line where character feet visually are, I thought you were speaking of Character.Baseline property, so I remove this part of my post.



Except for the possible reasons mentioned above, this may also happen if you are calling Character.Walk with eAnywhere parameter.
(And of course if it did not walk there, but, for example changed from another room and kept old coordinates)

Snarky

Quote from: Crimson Wizard on Sat 02/06/2018 12:15:06
Cassiebsg, Character.z and Character.Baseline are two unrelated properties. You are probably confusing Z-order and Character.z, in AGS these are different things.

Baseline only affects the order the various objects are drawn. But it does not affect position on screen at which they are drawn. We do not know if Baseline is even involved here, because we do not know if the wall is the walk-behind area and character is supposed to be behind.

Well...
I mean, they're different, but they're closely related, since unless you mess with it (and there is no good reason to do so in normal circumstances), the baseline is the Character's y-coordinate (described in the manual as "the character's feet"). Cassiebsg was using the term Dor Hajaj used, and clarifying that the setting he needed to change is the Character.Z coordinate.

Also, are the properties in fact totally independent? I assume that if you change Character.z, the baseline will still be Character.y, so effectively the baseline will be in a different position on the character sprite: no longer exactly at the bottom edge of the sprite. (The alternative would be very weird, if e.g. a character was scaled based on one y-coordinate, but hidden by walkbehind based on a different y-coordinate.)

And sure, there are some other exotic possibilities for what might be happening, but by far the most likely explanation is what Cassiebsg guessed (as in: this is a problem newbies face all the time, while if the other reasons were in play, I'm pretty sure Dor Hajaj wouldn't have asked the question this particular way). Also, we know the character is not meant to be behind the wall because we can see the intended walkable area.


Crimson Wizard

#5
Quote from: Snarky on Sat 02/06/2018 13:02:21
Quote from: Crimson Wizard on Sat 02/06/2018 12:15:06
Cassiebsg, Character.z and Character.Baseline are two unrelated properties. You are probably confusing Z-order and Character.z, in AGS these are different things.

Baseline only affects the order the various objects are drawn. But it does not affect position on screen at which they are drawn. We do not know if Baseline is even involved here, because we do not know if the wall is the walk-behind area and character is supposed to be behind.

Well...
I mean, they're different, but they're closely related, since unless you mess with it (and there is no good reason to do so in normal circumstances), the baseline is the Character's y-coordinate (described in the manual as "the character's feet"). Cassiebsg was using the term Dor Hajaj used, and clarifying that the setting he needed to change is the Character.Z coordinate.

Oh, I see now, so they did not mean Character.Baseline, but "baseline" as in line the character feet visually are? Sorry, I did not guess right, I will remove that part of answer.


Quote from: Snarky on Sat 02/06/2018 13:02:21
Also, are the properties in fact totally independent? I assume that if you change Character.z, the baseline will still be Character.y, so effectively the baseline will be in a different position on the character sprite: no longer exactly at the bottom edge of the sprite. (The alternative would be very weird, if e.g. a character was scaled based on one y-coordinate, but hidden by walkbehind based on a different y-coordinate.)

But in AGS Character.Baseline property is not a "position on the character sprite", it is not local coordinate, it is an absolute coordinate, used as a reference for the z-ordering system. Meanwhile Character.z is a local coordinate, determining visual Y offset of a sprite.
You may change Character.z, and although sprite's location on screen shifts, Baseline (and drawing z-order) stays the same. You may change Character.Baseline, the drawing order will change, but character's position on screen remains the same. So they are completely independent.

PS. Probably Character.Baseline should have been called Character.ZOrder.

Snarky

Quote from: Crimson Wizard on Sat 02/06/2018 13:14:20
But in AGS Character.Baseline property is not a "position on the character sprite", it is not local coordinate, it is an absolute coordinate, used as a reference for the z-ordering system.

You may change Character.Baseline, the drawing order will change, but character's position on screen remains the same.

I think we're just looking at this from different points of view.

You may override Character.Baseline, but that is only rarely done. By default it is the character's Y-coordinate, and changes as the character moves. So in that case it is relative to the character sprite.

And even if the two properties are independent under the hood, from a user point of view they interact: if take a screenshot of the character in a certain position, then change Character.Z and move the character to stand in apparently the same position, their actual Y-coordinate (and hence their baseline) will be different. This means that changing Character.Z could change whether a character "standing in a certain spot" (as in the screenshot at the top of this page) is in front of or behind something else.

Dor Hajaj

First of all, thank you all for the replies.

I got a bit confused. I'm using AGS for quite sometime now, but never really gave this issue any thought, i just minimized the walkable area so the character will avoid situations like this one.
It just got a bit annoying to redraw the walkable area a couple of times until I got it right.
To conclude this, what will be the best approach in your opinion?
Make sure the character's feet touch the bottom edge of each frame, or to minimize the walkable area as much as possible like I did until now?

selmiak

Quote from: Dor Hajaj on Sat 02/06/2018 20:55:10
To conclude this, what will be the best approach in your opinion?
Make sure the character's feet touch the bottom edge of each frame, or to minimize the walkable area as much as possible like I did until now?
both ;) :)

Cassiebsg

Personally I always have the characters feet as low as possible, which does not mean I do not need to adjust the z anyway. Usually a few pixels up (because we're not really 2 dimensional and our body also takes space. On top of that I also leave a few pixels between the wall edges and the floor unused to make sure the character will not "walk" into the wall in some of the walking cycle frames.
At the end of the day, you need to find out what works best for you and for the game you're coding at the time. ;)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk