feat(xanthous): Memoize characterVisiblePositions
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
This commit is contained in:
parent
80d501d553
commit
c19e3dae5f
14 changed files with 284 additions and 87 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue