Walk Down and Behind Hills - Walk Behinds

Started by Blackthorne, Thu 06/06/2013 13:22:50

Previous topic - Next topic

Blackthorne

I'm sure this has been asked before.  In fact, I know it has - I looked it up, and found some threads (6-9 years old!) about it, but I wanted to ask again here, because I'm sure you fine people know how to do this properly.

I have a background that has multiple hills in the background - how would I program my ego walking down the hill, behind it, and reappearing in the "distance" on the hill behind that?  I know there's multiple ways to do this, but I wanted to see what the best way to accomplish this might be.


Bt
-----------------------------------
"Enjoy Every Sandwich" - Warren Zevon

http://www.infamous-quests.com

Snarky

#1
There's no clean way to do it. You have to handle (at least) three things:

-Walkbehinds
-Reversing the up-down walkcycles
-Scaling

You can't really do pathfinding properly (since AGS only "thinks" in two dimensions), so you're going to have to script the movement. Therefore, I'd do it as a blocking, cutscene-style transition between foreground hill and background hill, in three main parts:

1.
-Player triggers "go over the hill" action (either explicitly or by moving onto some region close to the hill): start blocking action
-PC walks to defined coordinates at top of hill

2.
-Set hill walkbehind baseline to bottom of screen (so character will be hidden behind it)
-If necessary, change scaling on hill walkable area, so character will get smaller while moving down
-Flip up/down PC walkcycles, so character looks to be walking away when moving down
-PC walks to defined  "bottom of hill" coordinates

3.
-Change walkable area scaling again, so character will be appear small when reappearing
-Flip up/down walkcycles back to normal
-PC walks to defined "far hill" coordinates, end blocking action

(And the reverse to move the other way, obviously.) Depending on the shape of your hills and how players will interact, it might be useful to divide the hill walkable areas into different sections (separating overlapping parts from the rest) and enable and disable them depending on whether they're currently "reachable" (in state 1, 2 and 3).

Crimson Wizard

#2
I remember I saw a video made by Khris:
http://www.youtube.com/watch?v=qWL3h2WwMYU

Ask him how he did that. :)
(not video, but craters :))

Blackthorne

Yeah, I planned on having them as blocked actions, heh, I knew that much at least.  And I figured I'd have to have a view with the up and down switched.

Thanks for the help, Snarky.  I appreciate it.


Bt
-----------------------------------
"Enjoy Every Sandwich" - Warren Zevon

http://www.infamous-quests.com

Ali

#4
SSH wrote A Module for it, which handled reverse scaling, but it's a bit outdated and it only works for 4 directions (see my comment in the thread). I'm sure it could be updated and modified. (Old versions of AGS used to allow reverse scaling, it's a shame that went away!).

Aside from the scaling issue, you don't need to make them blocked actions if you don't want to. It just requires careful walkable areas. 
Make sure they walk over the hill with a vertical zig-zag path:



Create a region matching the green area, and flip the normal view and walkbehind baseline when the character steps on/off.


Snarky

I seem to remember that the module absolutely requires those disjoint walkable areas, and proper pathfinding certainly does, so it doesn't work if any of them have to overlap (like if the character is walking straight away from the camera, or if most of the front of the hill is walkable. In my experience, one of those things is usually the case, so I haven't found the module useful in practice.

I didn't know AGS had eliminated the ability to to reverse scaling. WTF?! Such a useful feature! So I guess then you have to turn on IgnoreAreaScaling or whatever it's called and calculate the scaling yourself.

As for Khris's solution, I think the title of the video makes it pretty clear how he does it: he just adjusts the Z-coordinate to lower the character according to where it is in the crater (probably using some function of distance to the center), with a walkbehind for the front edge of the crater. It's ingenious, but it really only works in this particular perspective (mostly top-down view, no scaling, elevation limited to a fraction of character height).

SMF spam blocked by CleanTalk