0

Shuffle around wall IDs, change wall check

Previously, walls were all numbered at 21000+. This is bad because
our blockmap is an array, so this caused our blockmap to take up
80 MiB of RAM in each worker process.

This commit changes the wall numbering, and exploits some bitmasking
to have the wall check run in constant time no matter how many walls
there are. This is done with a simple mask and xor to check the prefix.

RAM usage for the blockmap thus drops to like 44 MiB.

This is in preparation for adding more walls for 1.16.
This commit is contained in:
Nicolas F
2020-07-13 19:15:47 +02:00
parent a3e4812ca9
commit fcb3f2644d
6 changed files with 60 additions and 68 deletions

View File

@@ -28,6 +28,8 @@ bool block_class_is_subset(
const mc_block_t block_class[],
size_t block_class_len);
bool block_class_is_wall(mc_block_t block);
extern const mc_block_t block_class_stair[];
extern const size_t block_class_stair_len;
@@ -46,7 +48,4 @@ extern const size_t block_class_ancil_len;
extern const mc_block_t block_class_alt_height[];
extern const size_t block_class_alt_height_len;
extern const mc_block_t block_class_wall[];
extern const size_t block_class_wall_len;
#endif