diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-06-12T18·41-0400 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2021-06-12T18·57+0000 |
commit | c19e3dae5f6087c7e446c6be620c370d9957cf7c (patch) | |
tree | 29c3c1206c615478cac96da978c96271b05e4f1b /users/grfn/xanthous/test/Spec.hs | |
parent | 80d501d553b4aa5c7f687c69cb473ea2ac299354 (diff) |
feat(xanthous): Memoize characterVisiblePositions r/2653
Memoize the return value of characterVisiblePositions to a new, semi-abstracted "memo" field on the GameState, recalcuclated if the character position ever changes. I'm 90% sure that the perf issues we were encountering were actually caused by characterVisiblePositions getting called once for *every tile* on draw, but this slightly larger change also makes the game perform relatively-usably again. Since this is only recalculated if the character position changes, if we ever get non-transparent entities moving around without the characters influence (maybe something building or knocking down walls?) we'll have an issue there where the vision won't be updated as a result of those changes if they happen while the character is taking a non-moving action - but we can cross that bridge when we come to it. Change-Id: I3fc745ddf0014d6f164f735ad7e5080da779b92a Reviewed-on: https://cl.tvl.fyi/c/depot/+/3185 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/xanthous/test/Spec.hs')
-rw-r--r-- | users/grfn/xanthous/test/Spec.hs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/users/grfn/xanthous/test/Spec.hs b/users/grfn/xanthous/test/Spec.hs index f15c393ac917..36bac640b18e 100644 --- a/users/grfn/xanthous/test/Spec.hs +++ b/users/grfn/xanthous/test/Spec.hs @@ -6,6 +6,7 @@ import qualified Xanthous.Data.EntityCharSpec import qualified Xanthous.Data.EntityMap.GraphicsSpec import qualified Xanthous.Data.EntityMapSpec import qualified Xanthous.Data.LevelsSpec +import qualified Xanthous.Data.MemoSpec import qualified Xanthous.Data.NestedMapSpec import qualified Xanthous.DataSpec import qualified Xanthous.Entities.RawsSpec @@ -30,6 +31,7 @@ test = testGroup "Xanthous" , Xanthous.Data.EntityMap.GraphicsSpec.test , Xanthous.Data.EntityMapSpec.test , Xanthous.Data.LevelsSpec.test + , Xanthous.Data.MemoSpec.test , Xanthous.Data.NestedMapSpec.test , Xanthous.DataSpec.test , Xanthous.Entities.RawsSpec.test |