Options
All
  • Public
  • Public/Protected
  • All
Menu

Standard path following strategy.

This strategy controls the path discovery from a Game_Character source to either a point or Game_Character target.

It will use REA* when possible to generate better-than optimal paths and fallback to simple A* when it fails to derive a full path from that approach.

This strategy completes once the source character reaches the desired target EXACTLY. Touching an event does not count as completing the full path. It will keep looking for paths until it is completed.

To avoid running the full pathfinding algorithm at every frame, the strategy will only recalculate it when it receives a failure signal (i.e. onFail) or the target's position changes (so be cautious when using it on moving events).

Paths are limited to 128 steps for REA* and 32 for plain A* to avoid lagging. Some optimizations are applied to avoid running to far when the target is close to the source.

see

LoopingStrategy

Hierarchy

  • StandardStrategy

Implements

Index

Constructors

constructor

Methods

aStarSearchLimit

onFail

onFinish

  • onFinish(map: StandardMap, __namedParameters: [number, number]): boolean

path

reaStarSearchLimit

  • reaStarSearchLimit(source: Point2, target: Point2): number

reaStarThreshold

  • reaStarThreshold(): number
  • Minimum distance between points such that REA* should be applied.

    Simple A* is actually more efficient for short paths depending on the room size.

    Returns number

refresh

  • Recalculates the path to the target.

    Parameters

    • map: StandardMap

      Graph on which to calculate the path.

    • Default value fallback: boolean = false

      Whether to apply fallback behavior (i.e. plain A*).

    Returns void

shouldRefresh

  • shouldRefresh(): boolean

update

Generated using TypeDoc