Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: EnterTheStory (aka tolworthy) on Wed 08/10/2008 09:17:09

Title: PlaceOnWalkableArea - how does it work? (SOLVED)
Post by: EnterTheStory (aka tolworthy) on Wed 08/10/2008 09:17:09
I'm using 2.72 and PlaceOnWalkableArea is usually reliable. Except in a very wide room (600 game pixels) with a continuous floor that has a lot of thin parts and concave shapes. I place a character at (45,100), the nearest floor is at (45,110), but PlaceOnWalkableArea puts the character a (460,145)!

Does anyone know how PlaceOnWalkableArea calculates 'nearest'?
Title: Re: PlaceOnWalkableArea - how does it work?
Post by: Dualnames on Wed 08/10/2008 09:24:39
Why do this? And go like use :charactername.ChangeRoom(charactername.Room,45,110);

Usually it's best to use place on walkable area when you just want the character to be placed in a walkable area, but not in a certain point.
Title: Re: PlaceOnWalkableArea - how does it work?
Post by: EnterTheStory (aka tolworthy) on Wed 08/10/2008 09:47:16
Quote from: Dualnames on Wed 08/10/2008 09:24:39Why do this?

Because the game is complex. There are over 80 rooms, with up to ten walk-on points in each. I'm constantly tweaking walkable areas and WalkTo points. I often have characters walk on from off-screen. They are often accompanied by friends a few pixels away. Scales need to be decided based on the nearest floor, and all this has to be automated. It would take far too long to specify exact positions in every case. It's more practical to define entrances within a few pixels and rely on PlaceOnWalkableArea to catch any problems.
Title: Re: PlaceOnWalkableArea - how does it work?
Post by: Pumaman on Wed 08/10/2008 20:33:31
For performance reasons PlaceOnWalkableArea doesn't scan every pixel of the walkable area. In 2.72 it only scans every 5th pixel, so if you have a walkable area narrower than that it might not see it.

In AGS 3.0 this was improved to scan every 2 pixels in the immediate area around the character to avoid this sort of problem.
Title: Re: PlaceOnWalkableArea - how does it work?
Post by: EnterTheStory (aka tolworthy) on Wed 08/10/2008 22:10:42
Quote from: Pumaman on Wed 08/10/2008 20:33:31
For performance reasons PlaceOnWalkableArea doesn't scan every pixel of the walkable area. In 2.72 it only scans every 5th pixel, so if you have a walkable area narrower than that it might not see it.
Thanks. That's exactly the information I needed! Much appreciated.