Thursday, June 20, 2013

Visualizing the multiplier field

Okay, the last few posts were pretty dry. Today brings almost-the-beginning-of-summer AND pretty pictures. Hooray!


Multiplier field with one attractor: the ToLeftOf Building constraint
Two attractors: ToLeftOf Building and ToLeftOf Goal
One repeller: To Building (weight = -10)
So what's going on here? For the reasons explained in the previous post, I wanted to model the constraint system after physical potential fields, allowing me to superimpose them nicely. Once I changed the code to allow for multiple constraints, I was able to test this.

For each attractor, there are three ways to change the shape of the dip it makes in the field, which is currently defined as $M(r) = w \left(1 - \frac{1}{k_1 + k_2 r}\right)$. These constants (and their current values) are:

  • $w$ (user defined): The constraint weight affects the depth of a dip.
  • $k_1 = 0.5$: This affects the cutoff of the dip (preventing it from going to infinity). Especially visible at the top of the repeller above.
  • $k_2 = 0.2$: This affects the width of the dip.
And, of course, the path planning works. Sometimes.
Path planning still sometimes gives unexpected results, but I believe this is just due to the low density and bad triangulation of the navigation mesh graph. I may spend a little time in the near future trying to manually subdivide the graph we have now.

1 comment:

  1. Re: "bad triangulation":

    worst case scenario, we can export the mesh into Maya and manually tweak it -- so, this is not a deal-breaker

    ReplyDelete