Package dev.twilite.game.simulation
Interface SimulationTask<I>
- Type Parameters:
I- plugin-defined input for the current run
public interface SimulationTask<I>
Hook points for adding domain-specific simulation rules.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbegin(I input, SimulationGrid grid) Called once before path expansion begins, afteronTick(Object, SimulationGrid).default voidend(I input, SimulationGrid grid) Called after all reachable nodes have been visited and before the best result is selected.default voidonTick(I input, SimulationGrid grid) Called once before path expansion begins.default booleanstep(I input, SimulationGrid grid, Coord from, Coord to, int tick) Decides whether expansion may traverse the edge fromfromtotoontick.default voidvisit(I input, SimulationGrid grid, SimulationNode node) Called for each reachable tile after expansion.
-
Method Details
-
onTick
Called once before path expansion begins.Use this for per-tick updates that do not need the generated reachable tile set.
- Parameters:
input- plugin-defined state for this rungrid- mutable simulation grid for this run
-
begin
Called once before path expansion begins, afteronTick(Object, SimulationGrid).Tasks may block static nodes here so expansion cannot enter them.
- Parameters:
input- plugin-defined state for this rungrid- mutable simulation grid for this run
-
step
Decides whether expansion may traverse the edge fromfromtotoontick.- Parameters:
input- plugin-defined state for this rungrid- mutable simulation grid for this runfrom- current coordinateto- candidate destination coordinatetick- simulated tick whentowould be reached- Returns:
trueto allow this edge,falseto reject it
-
visit
Called for each reachable tile after expansion.Use this to add penalty, score, or mark reachable nodes to avoid based on their tick and path state.
- Parameters:
input- plugin-defined state for this rungrid- mutable simulation grid for this runnode- reachable candidate node to evaluate
-
end
Called after all reachable nodes have been visited and before the best result is selected.- Parameters:
input- plugin-defined state for this rungrid- mutable simulation grid for this run
-