Constrained/penalized distance function
Posted
by
sigma.z.1980
on Game Development
See other posts from Game Development
or by sigma.z.1980
Published on 2012-04-06T08:59:09Z
Indexed on
2012/04/06
11:42 UTC
Read the original article
Hit count: 371
Assume a character is located on a n by n grid and has to reach a certain entry on that grid. Its current position is (x1,y1). Also on the same grid is an enemy with coordinates (x2,y2). Each step algorithm randomly generates new candidate locations for the hero (if there are k candidates then there is a kx2 matrix of new potential locations.
What I need is some distance objective function to compare the candidates. I'm currently using d1 - c * d2, where d1 is distance to the objective (measure in terms of number of pixels for each axis), d2 is distance to the enemy and c is some coefficient (this is very much like a set-up for Lagrangian). It's not working very well though. I'd be quite keen to learn how what constrained distance function are used for similar cases.
Any suggestions are very much appreciated.
© Game Development or respective owner