precompute graph to be used for dijkstra's algorithm, resulting in CPU usage that never exceed 7/home/humza/Downloads/sml/oh-my-stars/fcore/path-finding.sml with 5 enemies and eliminating lag

This commit is contained in:
2025-01-31 04:32:53 +00:00
parent f3a0b2bc81
commit e23e2f0997
9 changed files with 87 additions and 332 deletions

View File

@@ -2,7 +2,8 @@ structure GameUpdate =
struct
fun update (game, input) =
let
val {player, walls, wallTree, platforms, platformTree, enemies} = game
val {player, walls, wallTree, platforms, platformTree, enemies, graph} =
game
val player = Player.runPhysicsAndInput (game, input)
@@ -18,6 +19,7 @@ struct
, wallTree
, platforms
, platformTree
, graph
)
in
{ player = player
@@ -26,6 +28,7 @@ struct
, platforms = platforms
, platformTree = platformTree
, enemies = enemies
, graph = graph
}
end
end