Tune RandomTileTickRate, and include random tile counter in chunk serialization.

This commit is contained in:
2025-02-28 01:05:53 -05:00
parent 7ae6003e23
commit 84765fbaf4
2 changed files with 6 additions and 7 deletions

View File

@@ -79,6 +79,7 @@ namespace CaveGame::Core
[[nodiscard]] std::array<TileID, ChunkSize * ChunkSize> DataContiguous() const;
void write(Buffer& buf) {
write_u32(buf, tiles_with_random_tick_count);
write_f32(buf, cell.x);
write_f32(buf, cell.y);
@@ -89,15 +90,13 @@ namespace CaveGame::Core
}
}
void read(Buffer& buf)
{
void read(Buffer& buf) {
tiles_with_random_tick_count = read_u32(buf);
cell.x = read_f32(buf);
cell.y = read_f32(buf);
for (int x = 0; x < ChunkSize; x++)
{
for (int y = 0; y < ChunkSize; y++)
{
for (int x = 0; x < ChunkSize; x++) {
for (int y = 0; y < ChunkSize; y++) {
SetTile(x, y, (TileID) read_u8(buf));
}
}

View File

@@ -37,7 +37,7 @@ namespace CaveGame::Core {
Event<> OnNextDay;
Event<> OnAutosave;
constexpr static unsigned int RandomTileTickCoefficient = 100;
constexpr static unsigned int RandomTileTickCoefficient = 128;
constexpr static float PeriodicAutosaveIntervalSeconds = 30.f;
World() = default;
~World() = default;