PlaceOnWalkableArea - how does it work? (SOLVED)

Started by EnterTheStory (aka tolworthy), Wed 08/10/2008 09:17:09

Previous topic - Next topic

EnterTheStory (aka tolworthy)

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'?

Dualnames

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.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

EnterTheStory (aka tolworthy)

#2
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.

Pumaman

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.

EnterTheStory (aka tolworthy)

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.

SMF spam blocked by CleanTalk