Calculating a movement, attack or vision radius is among the most computationally intensive code paths in Athena Crisis. While its performance does not affect normal gameplay, it matters massively when the AI figures out what to optimize for. This is further exacerbated by the fact that results of radius calculations cannot be cached for long, as any action executed against map state may change the radius that is returned. For example, defeating a unit that is blocking a path may make more movement and attack options available for other units in the same turn.
This task is focused on speeding up Radius.tsx
by 2x or more. Given how critical the code path is, it is acceptable to make the code in this file slightly less readable (but still reasonably maintainable), and possibly also optimize some of the downstream algorithms β as long as it doesn't change the layout of MapData
. It is preferred not to modify the return types given how widely they are used across the codebase, but I am open to it based on a proof-of-concept and some discussion of the trade-offs.
Radius.tsx
are acceptable if the performance improvements warrant it.pnpm vitest bench
.calculateRadius
and movement radius. Speeding up attack or vision calculation by 2x while not speeding up movement radius calculation at all does not meet the objective of this task. However, speeding up movement radius calculation by 1.5x (for example) and speeding up attack and vision calculation by more beyond that might be worth it.Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too