Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Murchad on Tue 08/07/2014 21:56:08

Title: Problem with multiple walkable areas and scaling
Post by: Murchad on Tue 08/07/2014 21:56:08
Hello friends. I have some problem. I tried to find the answer on the forum, but could.nt find it. I hope I didn't missed it somewhere.

I'll explain what is my problem on this sketch.

(http://i59.tinypic.com/w9y1wo.png)
Title: Re: Problem with multiple walkable areas and scaling
Post by: Crimson Wizard on Tue 08/07/2014 22:35:29
Something that just appeared in my head: you can try using blocking invisible room objects to block the disabled areas. This is not a very elegant solution, but I am afraid current version of AGS does not provide much options here (the future version of AGS we are planning will allow up to 256 walk areas, but that is under development now).

Another way is to use Regions. They have "walk on" event that triggers when player character walks on it. You can script it so that character will walk back to main area. Although this is not exactly like "disabled area".
Title: Re: Problem with multiple walkable areas and scaling
Post by: Murchad on Tue 08/07/2014 23:40:03
This first solution is working in this case, so thanks a lot for help :)
Title: Re: Problem with multiple walkable areas and scaling
Post by: AnasAbdin on Thu 10/07/2014 09:02:57
I'd create four walkable areas like the third example. Then it's a matter of math. Get the y coordinates of the top and bottom edges of the all walkable areas and calculate the scaling needed for each of the walkable areas according to the distances between the y coordinates to create three different continues scaling.

For example:
Blue walkable area: 30-40
Red and Yellow: 40-50
Green: 50-100

and then you can turn off any walkable area you need with:
Code (ags) Select
RemoveWalkableArea(areanum);
Title: Re: Problem with multiple walkable areas and scaling
Post by: Slasher on Thu 10/07/2014 10:30:42
Hi,

this is indeed a good question and it brings up a mathematical question regarding using continuous scaling true [n] [n] and relating to walkable area length.

Has anyone ever figured out the maths, if it is of course possible to work out?

Other than that it's a case of trying [n] till it looks right.

;)

Title: Re: Problem with multiple walkable areas and scaling
Post by: HandsFree on Thu 10/07/2014 10:44:06
I've seen a very practical solution for this. Maybe it's frowned on by the experts but if you just put one pixel of each walkable area in the front of the screen (somewhere out of the way/at the side if possible) and one pixel at the back, you can set the scaling for all walkable areas the same. 100% to 30% in op's example.
Title: Re: Problem with multiple walkable areas and scaling
Post by: AnasAbdin on Thu 10/07/2014 10:49:03
HandsFree That's a very smart solution (for this case). I love it 8-)

Edit:
(http://i.imgur.com/DlbADnB.png)
Title: Re: Problem with multiple walkable areas and scaling
Post by: Crimson Wizard on Thu 10/07/2014 10:51:15
The scaling formula in AGS is very simple. Basically, you take height of all area in pixels (Hpx) and range in "scaling units" (dS) (between top & bottom of scaling area).

Hpx / dS = pixels per scaling unit.

For example, if you have scaling from 100 to 0, and area of height 200, then you will have: 200 / 100 = 2 pixels per 1 scaling unit. If you have area height = 50, then it is 50 / 100 = 0.5 pixels per scaling unit, or 1 pixel per 2 scaling units.
And so forth.
Knowing this factor you can assign scaling for separate areas.


Quote from: HandsFree on Thu 10/07/2014 10:44:06
I've seen a very practical solution for this. Maybe it's frowned on by the experts but if you just put one pixel of each walkable area in the front of the screen (somewhere out of the way/at the side if possible) and one pixel at the back, you can set the scaling for all walkable areas the same. 100% to 30% in op's example.
I think this is a very nice workaround!
Title: Re: Problem with multiple walkable areas and scaling
Post by: Murchad on Thu 10/07/2014 22:29:26
Quote from: Crimson Wizard on Thu 10/07/2014 10:51:15
Quote from: HandsFree on Thu 10/07/2014 10:44:06
I've seen a very practical solution for this. Maybe it's frowned on by the experts but if you just put one pixel of each walkable area in the front of the screen (somewhere out of the way/at the side if possible) and one pixel at the back, you can set the scaling for all walkable areas the same. 100% to 30% in op's example.
I think this is a very nice workaround!

Looks nice. Thanks :)
Title: Re: Problem with multiple walkable areas and scaling
Post by: Snarky on Thu 10/07/2014 23:41:26
Quote from: AnasAbdin on Thu 10/07/2014 10:49:03
HandsFree That's a very smart solution (for this case). I love it 8-)

Edit:
(http://i.imgur.com/DlbADnB.png)


Yes, it's quite clever. Of course, with this approach you don't even need the yellow and blue (in fact, isn't that exactly the benefit?), it can all just be green.
Title: Re: Problem with multiple walkable areas and scaling
Post by: Khris on Fri 11/07/2014 11:30:49
HandsFree, that's awesome! I'll take me a few hours to not be pissed I didn't think of that :-D
Title: Re: Problem with multiple walkable areas and scaling
Post by: HandsFree on Fri 11/07/2014 11:49:42
It's not my invention either. I saw it in the King's Quest 4 remake, done by Akril.