Warehouse
"Practical wisdom is only learnt in the school of experience." -Samuel Smiles
PROJECTS NEWS MESSAGES MAILING LIST  
Please help me
id like some help please
 
• Please help me

hello all. i am new to this forum so i start by introducing myself.(no need to read tho) i am a gamme developer in 15 years and i am curently using the Lingo languadge to program. i have come far on my engine and i only need to make the AI scripts.

i have a problem. i have been reading almost 10 different tutorials of the a* algorithm. i have not really got how it works. if someone know's a script or anything please help me. the maps are somewhere 25x16 tiles.
but every npc and player moves on only a half tile at a time. i need some way i could make the npc's move round block to get to the npc's destination.

1 posts.
Thursday 19 October, 08:39
Reply
• Resp

If the map is 20x16 but they move in steps of half a tile at a time,
this is the same as though the space of states is a 39x31 map of
quarter-tiles. In order to properly pathfind, each tile need to have
it's passability (and optionally, cost) determinable. To do so, you
merely need to map the state in the quarter-tile space to the
passability of full-tiles.

-OO
X*O
xx-

Perhaps we use the upper-left quarter as the index of the characters
location in respect to full-tile space, i.e. that it occupies the
full-tiles which it's index quarter tile, it's quarter tile to the
right, down and down-right occupy. If we assume the xs are the
quarters of the character where X is the index quarter, we see that
the X quarter is impassable because one of it's associated quarters
are occupied by a quarter of the full-tile O. In other words, you
determine the passability for a specific quarter by imagining that
the character stands there and occupies all of the full-tiles which
the 4 quarter-tiles of the character would occupy.

quarter_passable_i,j = passable(full_tile_for_{i+s},{j+t}) for all
s,t in {0,1}.
where full_tile_for_i,j = (floor(i / 2), floor(j/2)) for instance

6 posts.
Monday 30 October, 12:49
Reply