diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-17 15:28:22 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-17 15:28:22 -0400 |
commit | 5324adfe51f1348fc97fe2ee0ca4e4bbd2a6ad64 (patch) | |
tree | 6b3ff32f9ad2764405fd73a70e15c960a076ed00 /src/game.h | |
parent | e0fd87411eb5368fee47e268ae03d073293e58c3 (diff) | |
download | ether-5324adfe51f1348fc97fe2ee0ca4e4bbd2a6ad64.tar.gz ether-5324adfe51f1348fc97fe2ee0ca4e4bbd2a6ad64.tar.bz2 ether-5324adfe51f1348fc97fe2ee0ca4e4bbd2a6ad64.zip |
lotta performance improvements
the two main things: 1) When ticking three times after a lighting change, we no longer iterate over the entire map. Instead, we keep a list of the tiles that have changed and the ones adjacent to them, and we iterate over that list. 2) The map tile type is now stored in a separate array from the rest of the tile data. This is because the tile type is the only thing needed for the cellular automata tick, and thus the only thing that we need to actually copy.
Diffstat (limited to 'src/game.h')
-rw-r--r-- | src/game.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/game.h b/src/game.h index 637a033..c75d43b 100644 --- a/src/game.h +++ b/src/game.h | |||
@@ -71,7 +71,7 @@ public: | |||
71 | bool dirtyRender = true; | 71 | bool dirtyRender = true; |
72 | size_t numLamps = 0; | 72 | size_t numLamps = 0; |
73 | size_t numDust = 0; | 73 | size_t numDust = 0; |
74 | std::vector<MapData> mapDoubleBuffer; | 74 | std::vector<Tile> mapDoubleBuffer; |
75 | 75 | ||
76 | int player_x = 0; | 76 | int player_x = 0; |
77 | int player_y = 0; | 77 | int player_y = 0; |
@@ -111,6 +111,8 @@ public: | |||
111 | 111 | ||
112 | private: | 112 | private: |
113 | 113 | ||
114 | void tickDirty(bool onlyDark); | ||
115 | |||
114 | void tick( | 116 | void tick( |
115 | int x1, | 117 | int x1, |
116 | int y1, | 118 | int y1, |