From 59e226a29ac1f627073a343f2778f23dfa09eb28 Mon Sep 17 00:00:00 2001 From: Jason Rohrer Date: Sat, 27 Jul 2019 13:34:45 -0700 Subject: [PATCH] Server biomes random generator reseeds itself after every map wipe. A different map every time, with one of 4 billion possible seeds. Made server wait 8 seconds after signalling apocalypse, to give clients plenty of time to white-out. --- documentation/changeLog.txt | 6 +++++ server/makeFileList | 3 ++- server/map.cpp | 54 ++++++++++++++++++++++++++++++++++++- server/map.h | 4 +++ server/server.cpp | 4 ++- 5 files changed, 68 insertions(+), 3 deletions(-) diff --git a/documentation/changeLog.txt b/documentation/changeLog.txt index ec61ccc22..a05028c2f 100644 --- a/documentation/changeLog.txt +++ b/documentation/changeLog.txt @@ -51,6 +51,12 @@ Server Fixes most kinds of useful trees (at least ones that are sensibly hardwood, like maple, poplar, and rubber). +--Server biomes random generator reseeds itself after every map wipe. A + different map every time, with one of 4 billion possible seeds. + +--Made server wait 8 seconds after signalling apocalypse, to give clients + plenty of time to white-out. + diff --git a/server/makeFileList b/server/makeFileList index a91997e11..ae99c1c43 100644 --- a/server/makeFileList +++ b/server/makeFileList @@ -95,4 +95,5 @@ NEEDED_MINOR_GEMS_OBJECTS = \ ${PRINT_LOG_O} \ ${PRINT_UTILS_O} \ ${DOUBLE_PAIR_O} \ - ${STRING_TREE_O} + ${STRING_TREE_O} \ + ${CRC32_O} diff --git a/server/map.cpp b/server/map.cpp index 68a9612bc..3daaa4443 100644 --- a/server/map.cpp +++ b/server/map.cpp @@ -26,6 +26,8 @@ //#include "lineardb.h" #include "lineardb3.h" +#include "minorGems/util/crc32.h" + /* #define DB KISSDB @@ -232,6 +234,8 @@ static int barrierOn = 1; static int longTermCullEnabled = 1; +static unsigned int biomeRandSeed = 723; + static SimpleVector barrierItemList; @@ -830,7 +834,7 @@ static int computeMapBiomeIndex( int inX, int inY, for( int i=0; i= 7 ) { + Time::getCurrentTime() - apocalypseStartTime >= 8 ) { if( ! postApocalypseStarted ) { AppLog::infoF( "Enough warning time, %d players still alive", @@ -8149,6 +8149,8 @@ void apocalypseStep() { AppLog::infoF( "Apocalypse wipeMapFiles took %f sec", Time::getCurrentTime() - startTime ); + reseedMap( true ); + initMap(); AppLog::infoF( "Apocalypse initMap took %f sec",