Character drawn behind object behind walkbehind area

Started by AnasAbdin, Sun 22/11/2015 06:41:06

Previous topic - Next topic

AnasAbdin

Let me phrase this the best I can :-[

I have an object that has a baseline less than a walkbehind area.
The object MUST be drawn behind the walkbehind.
The character shouldn't get affected by the walkbehind.
However, the character should be drawn behind the object.

I gave the character a baseline less than the object's baseline. And tried this:

Code: ags
cEgo.IgnoreWalkbehinds = true;


but still, the object is always drawn behind the character.
Is there a way to solve this?
Thanks ???

Cassiebsg

Not exactly sure how to solve the problem, since I barely understand it... (roll)
But just thought I would mention that IgnoreWalkbehinds does not work with Direct3D, and thus you should not use it.
There are those who believe that life here began out there...

Khris

I'm probably misunderstanding, but does the walkbehind even factor into the problem?

It sounds like you have a character supposed to be covered by an object, but the character appears on top, even though their baseline is a lower Y.

Could you post a screenshot to clarify?

AnasAbdin

#3
Quote from: Khris on Sun 22/11/2015 13:03:12
It sounds like you have a character supposed to be covered by an object, but the character appears on top, even though their baseline is a lower Y.

This is the case but ONLY when the character is set to ignoreWalkbehinds.
I can make the character appear in front of the object, or behind it. I'm trying to make the character appear behind the object without being affected by the walkbehind that is supposed to cover parts of the object only.


This is the typical character baseline < object baseline < walkbehind baseline


This is the object baseline < character baseline < walkbehind baseline


This is object baseline < walkbehind baseline < character baseline


This is what I'm trying to achieve:
character.ignoreWalbehind() baseline < object baseline < walkbehind baseline

So simply, I'm trying to achieve typical baseline standards while the character is ignoring walkbehinds.

Slasher

Food for thought

couldn't you set the baseline of the walkbehind to the bottom of the book and have players feet below that baseline so it ignores walkbehind and set players baseline lower than book so he goes behind it and ignores walkbehind?


AnasAbdin

The player and the object should move freely anywhere in the room. So.. not sure how this should work :-\

Cassiebsg

Maybe I'm thinking this too complicated and there's a way to code it since I'm an inexperience coder, but couldn't you have two views/objects/characters, and display the one when the character's coordinates are "above" the object and the other when it's "behind"?

Still haven't figured how exactly what you're doing... :-[

Another way, that just occurred to me, could maybe replace the "walkbehind" with an object in that place. Not sure if it would solve anything though.
There are those who believe that life here began out there...

selmiak

Quote from: AnasAbdin on Sun 22/11/2015 14:33:15
This is what I'm trying to achieve:
character.ignoreWalbehind() baseline < object baseline < walkbehind baseline

So simply, I'm trying to achieve typical baseline standards while the character is ignoring walkbehinds.

But there your walkbehind is in front of the object. So when the character is behind the object it is only logical that he is also behind the walkbehind. Every part of the walkbehind! But in your image he is in front of the walkbehind on the right end. So logically this makes no sense at all. Please explain what you are doing.
Coding this is probably a mess so I'd just make 2 different versions of the ojects, one with and one without the walkbehind drawn onto it and change images acordingly (with regions?) and set the baseline of the walkbehind so that it fits...

AnasAbdin

Quote from: Cassiebsg on Sun 22/11/2015 16:21:27
Another way, that just occurred to me, could maybe replace the "walkbehind" with an object in that place. Not sure if it would solve anything though.

I was thinking to do that as a last resort. But finding another way without using extra sprites would be much appreciated ;)

Quote from: selmiak on Sun 22/11/2015 16:30:23
But there your walkbehind is in front of the object. So when the character is behind the object it is only logical that he is also behind the walkbehind.

the character is behind both the object and the walkbehind, but he is supposed to ignore the walkbehind but not ignoring the object...

Snarky

It's not possible because it doesn't make sense. AGS, like any reasonable 2.5D engine, assumes that Z-order (distance) is transitive: If A (the walkbehind) is in front of B (the object) and B is in front of C (the astronaut), then A is in front of C. You'll have to somehow draw the bit that violates this property manually on a dynamic sprite to fake it (e.g. draw the walkbehind on the object).

Khris

I think selmiak was referring to the fact that this makes no sense if you look at this screenshot as a collection of layers, which is basically what AGS does.

You're trying to do this:

Afaik, AGS will cut the background into layers according to the walkbehinds, then sort stuff depending on the current baseline and draw the screen in that order. I don't know how exactly the engine handles this internally, but a character ignoring a walkbehind probably means the character will get sorted on top of them.
So I'm pretty sure its impossible to get AGS to do this, unless you implement the walkbehind as object and draw the character yourself, each loop, pixel by pixel.

Retro Wolf


AnasAbdin

Well.. thanks guys for your replies. I'll probably have to create a sprite of the background where the walkbehind is supposed to be.

Crimson Wizard

#13
Quote from: Khris on Sun 22/11/2015 17:23:03
I think selmiak was referring to the fact that this makes no sense if you look at this screenshot as a collection of layers, which is basically what AGS does.
Yes, what Khris and selmiak said.

That is why I keep telling this to everyone who asks about IgnoreWalkbehinds: do not use IgnoreWalkbehinds, ever.
This property only works with software renderer (DirectX 5), simply because it uses a kind of hack to make it work.
This property is not supported for Direct3D renderer, and will not be supported in future.

More on this topic:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48907.msg636468618#msg636468618


AnasAbdin

Thanks Crimson for the advice ;)
and sorry for hurting your brain Retro Wolf ???

selmiak

#15
I'm still puzzled. If he is behind the object, which is also behind the walkbehind already, he is already covered by the object, so it doesn't matter if he is ignoring the walkbehind. Or do you want to cut out something from the object where the character sprite and the walkbehind cross? Some ghostly effects or so? wtf are you doooooing? you are playing with powerful forces when you destroy the fabric of space! mathematically this probably ends in a division by zero ;)

edit:
Looking at your pix again, if you did cut that blue layer in your example pic in photoshop already then it is the same in AGS. You need some more layers. If you didn't cut anything in PS on that blue layer then just arange it that way in AGS... *scratches head*

selmiak

Quote from: AnasAbdin on Sun 22/11/2015 17:07:09
Quote from: Cassiebsg on Sun 22/11/2015 16:21:27
Another way, that just occurred to me, could maybe replace the "walkbehind" with an object in that place. Not sure if it would solve anything though.

I was thinking to do that as a last resort. But finding another way without using extra sprites would be much appreciated ;)

If this is a solution then do it this way. semitransparent PNGs are better than walkbehinds just because you can have smoother edges. I still don't get why the character is partially in front of something when being behind something that is behind that something he is supposed to be in front of :-D

AnasAbdin

Quote from: selmiak on Mon 23/11/2015 00:59:02
you are playing with powerful forces when you destroy the fabric of space!

Exactly (nod)
When you create a game about intergalactic travel, wormholes and black holes... physics & math become impossible :P

SMF spam blocked by CleanTalk