Move towards serializing saves/loads faster

This commit is contained in:
2022-08-19 11:12:43 +01:00
parent c74d3b04bf
commit 9df0fa8692
38 changed files with 542 additions and 384 deletions
+38 -9
View File
@@ -1,5 +1,6 @@
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Dodge.Data.CWorld (
module Dodge.Data.CWorld,
@@ -46,6 +47,8 @@ module Dodge.Data.CWorld (
module Dodge.Data.WorldEffect,
) where
import TH.Derive
import Data.Store
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -99,16 +102,29 @@ import qualified IntMapHelp as IM
import MaybeHelp
import Picture.Data
data CWCam = CWCam
{ _cwcCenter :: Point2
, _cwcRot :: Float
, _cwcZoom :: Float -- smaller values zoom out
, _cwcItemZoom :: Float
, _cwcDefaultZoom :: Float
, _cwcViewFrom :: Point2
, _cwcViewDistance :: Float
, _cwcBoundBox :: [Point2]
, _cwcBoundDist :: (Float, Float, Float, Float) -- NSEW, S and W negative
}
data CWorld = CWorld
{ _cameraCenter :: Point2
, _cameraRot :: Float
, _cameraZoom :: Float -- smaller values zoom out
, _itemZoom :: Float
, _defaultZoom :: Float
, _cameraViewFrom :: Point2
, _viewDistance :: Float
, _boundBox :: [Point2]
, _boundDist :: (Float, Float, Float, Float) -- NSEW, S and W negative
--{ _cameraCenter :: Point2
--, _cameraRot :: Float
--, _cameraZoom :: Float -- smaller values zoom out
--, _itemZoom :: Float
--, _defaultZoom :: Float
--, _cameraViewFrom :: Point2
--, _viewDistance :: Float
--, _boundBox :: [Point2]
--, _boundDist :: (Float, Float, Float, Float) -- NSEW, S and W negative
{ _cwCam :: CWCam
, _creatures :: IM.IntMap Creature
, _crZoning :: IM.IntMap (IM.IntMap IS.IntSet)
, _creatureGroups :: IM.IntMap CrGroupParams
@@ -176,6 +192,14 @@ data CWorld = CWorld
, _worldClock :: Int
, _genParams :: GenParams
, _deathDelay :: Maybe Int
, _cwSeed :: Int
}
data CWGen = CWGen
{ _cwgParams :: GenParams
, _cwgWorldBounds :: Bounds
, _cwgGameRooms :: [GameRoom] -- consider using an IntMap
, _cwgRoomClipping :: [ConvexPoly]
}
data WorldBeams = WorldBeams
@@ -188,5 +212,10 @@ data WorldBeams = WorldBeams
deriveJSON defaultOptions ''CWorld
deriveJSON defaultOptions ''WorldBeams
deriveJSON defaultOptions ''CWCam
makeLenses ''CWorld
makeLenses ''WorldBeams
makeLenses ''CWCam
-- $($(derive [d|
-- instance Deriving (Store CWorld)
-- |]))