about summary refs log tree commit diff
path: root/users/grfn/xanthous/xanthous.cabal
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-06-12T18·41-0400
committergrfn <grfn@gws.fyi>2021-06-12T18·57+0000
commitc19e3dae5f6087c7e446c6be620c370d9957cf7c (patch)
tree29c3c1206c615478cac96da978c96271b05e4f1b /users/grfn/xanthous/xanthous.cabal
parent80d501d553b4aa5c7f687c69cb473ea2ac299354 (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 '')
-rw-r--r--users/grfn/xanthous/xanthous.cabal15
1 files changed, 10 insertions, 5 deletions
diff --git a/users/grfn/xanthous/xanthous.cabal b/users/grfn/xanthous/xanthous.cabal
index 9648933b76..3afbf8db77 100644
--- a/users/grfn/xanthous/xanthous.cabal
+++ b/users/grfn/xanthous/xanthous.cabal
@@ -4,7 +4,7 @@ cabal-version: 1.12
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: b46f24dcf24decf8e16be6f62943648aaafc9272d923945f97d5c26a370ad235
+-- hash: f642cb264ff0785d5883884fa8db14adb92ce3d897cfc22e69555089dbc8dfd2
 
 name:           xanthous
 version:        0.1.0.0
@@ -44,6 +44,7 @@ library
       Xanthous.Data.EntityMap
       Xanthous.Data.EntityMap.Graphics
       Xanthous.Data.Levels
+      Xanthous.Data.Memo
       Xanthous.Data.NestedMap
       Xanthous.Data.VectorBag
       Xanthous.Entities.Character
@@ -61,6 +62,7 @@ library
       Xanthous.Game.Draw
       Xanthous.Game.Env
       Xanthous.Game.Lenses
+      Xanthous.Game.Memo
       Xanthous.Game.Prompt
       Xanthous.Game.State
       Xanthous.Generators
@@ -142,7 +144,6 @@ library
     , filepath
     , generic-arbitrary
     , generic-lens
-    , generic-monoid
     , groups
     , hgeometry
     , hgeometry-combinatorial
@@ -166,6 +167,7 @@ library
     , raw-strings-qq
     , reflection
     , semigroupoids
+    , semigroups
     , splitmix
     , stache
     , streams
@@ -198,6 +200,7 @@ executable xanthous
       Xanthous.Data.EntityMap
       Xanthous.Data.EntityMap.Graphics
       Xanthous.Data.Levels
+      Xanthous.Data.Memo
       Xanthous.Data.NestedMap
       Xanthous.Data.VectorBag
       Xanthous.Entities.Character
@@ -215,6 +218,7 @@ executable xanthous
       Xanthous.Game.Draw
       Xanthous.Game.Env
       Xanthous.Game.Lenses
+      Xanthous.Game.Memo
       Xanthous.Game.Prompt
       Xanthous.Game.State
       Xanthous.Generators
@@ -295,7 +299,6 @@ executable xanthous
     , filepath
     , generic-arbitrary
     , generic-lens
-    , generic-monoid
     , groups
     , hgeometry
     , hgeometry-combinatorial
@@ -319,6 +322,7 @@ executable xanthous
     , raw-strings-qq
     , reflection
     , semigroupoids
+    , semigroups
     , splitmix
     , stache
     , streams
@@ -344,6 +348,7 @@ test-suite test
       Xanthous.Data.EntityMap.GraphicsSpec
       Xanthous.Data.EntityMapSpec
       Xanthous.Data.LevelsSpec
+      Xanthous.Data.MemoSpec
       Xanthous.Data.NestedMapSpec
       Xanthous.DataSpec
       Xanthous.Entities.RawsSpec
@@ -415,7 +420,6 @@ test-suite test
     , filepath
     , generic-arbitrary
     , generic-lens
-    , generic-monoid
     , groups
     , hgeometry
     , hgeometry-combinatorial
@@ -440,6 +444,7 @@ test-suite test
     , raw-strings-qq
     , reflection
     , semigroupoids
+    , semigroups
     , splitmix
     , stache
     , streams
@@ -523,7 +528,6 @@ benchmark benchmark
     , filepath
     , generic-arbitrary
     , generic-lens
-    , generic-monoid
     , groups
     , hgeometry
     , hgeometry-combinatorial
@@ -547,6 +551,7 @@ benchmark benchmark
     , raw-strings-qq
     , reflection
     , semigroupoids
+    , semigroups
     , splitmix
     , stache
     , streams