Skip to content

Commit

Permalink
Merge pull request #161 from jasonrohrer/master
Browse files Browse the repository at this point in the history
v358 merge
  • Loading branch information
Awbz committed Sep 21, 2020
2 parents f07ce0a + c40ff71 commit 3aae4f6
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 38 deletions.
29 changes: 29 additions & 0 deletions documentation/changeLog.txt
Expand Up @@ -4,6 +4,35 @@ http://onehouronelife.com/updateLog.php




Version 358 2020-September-21

--Fixed so that filtering for /DIESEL ENGINE doesn't cause you to /DIE.
Fixes #667

--Improved tutorial by NOT locking hint hallway for 20 minutes, and adding a
new tutorial stone explaining where the hints are.





Server Fixes

--New food settings to ease new players into the difficulty of the game. New
players get slower food decrement time. This bonus has a half life of
10 hours of playtime. Does not affect tutorial players, who still get the
same "hard" food timing that the tutorial was designed for.

--Fixed so that wide objects (like parked truck) can't be accessed on their
extended side if that side extends over a blocking object (like a truck
parked at the edge of a fence, overhanging the fence, can't be stolen through
the fence). Fixes #669.





Version 356 2020-September-18

--Support for variable dummy objects that have numeral sprites which count up.
Expand Down
69 changes: 39 additions & 30 deletions gameSource/LivingLifePage.cpp
Expand Up @@ -25147,6 +25147,27 @@ static void showPlayerLabel( LiveObject *inPlayer, const char *inLabel,



static char commandTyped( char *inTyped, const char *inCommandTransKey ) {
const char *command = translate( inCommandTransKey );

if( strstr( inTyped, command ) == inTyped ) {

char *trimmedCommand = trimWhitespace( inTyped );

unsigned int lengthTrim = strlen( trimmedCommand );

delete [] trimmedCommand;

if( lengthTrim == strlen( command ) ) {
return true;
}
}
return false;
}




void LivingLifePage::keyDown( unsigned char inASCII ) {

registerTriggerKeyCommand( inASCII, this );
Expand Down Expand Up @@ -25529,9 +25550,8 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
sendToServerSocket( message );
delete [] message;
}
else if( strstr( typedText,
translate( "dieCommand" ) )
== typedText &&
else if( commandTyped( typedText, "dieCommand" )
&&
computeCurrentAge( ourLiveObject ) < 2 ) {
// die command issued from baby
char *message =
Expand All @@ -25540,9 +25560,7 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
sendToServerSocket( message );
delete [] message;
}
else if( strstr( typedText,
translate( "fpsCommand" ) )
== typedText ) {
else if( commandTyped( typedText, "fpsCommand" ) ) {
showFPS = !showFPS;
frameBatchMeasureStartTime = -1;
framesInBatch = 0;
Expand All @@ -25556,9 +25574,7 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
endCountingSpritesDrawn();
}
}
else if( strstr( typedText,
translate( "netCommand" ) )
== typedText ) {
else if( commandTyped( typedText, "netCommand" ) ) {
showNet = !showNet;
netBatchMeasureStartTime = -1;
messagesInPerSec = -1;
Expand All @@ -25570,9 +25586,8 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
bytesInCount = 0;
bytesOutCount = 0;
}
else if( strstr( typedText,
translate( "pingCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"pingCommand" ) ) {

waitingForPong = true;
lastPingSent ++;
Expand All @@ -25587,14 +25602,12 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
pongDeltaTime = -1;
pingDisplayStartTime = -1;
}
else if( strstr( typedText,
translate( "disconnectCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"disconnectCommand" ) ) {
forceDisconnect = true;
}
else if( strstr( typedText,
translate( "familyCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"familyCommand" ) ) {

const char *famLabel =
translate( "familyLabel" );
Expand All @@ -25613,9 +25626,8 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
}
}
}
else if( strstr( typedText,
translate( "leaderCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"leaderCommand" ) ) {

const char *leaderLabel =
translate( "leaderLabel" );
Expand All @@ -25638,9 +25650,8 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
}
sendToServerSocket( (char*)"LEAD 0 0#" );
}
else if( strstr( typedText,
translate( "followerCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"followerCommand" ) ) {

const char *followerLabel =
translate( "followerLabel" );
Expand Down Expand Up @@ -25683,9 +25694,8 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
displayGlobalMessage( message );
delete [] message;
}
else if( strstr( typedText,
translate( "allyCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"allyCommand" ) ) {

const char *allyLabel =
translate( "allyLabel" );
Expand Down Expand Up @@ -25740,9 +25750,8 @@ void LivingLifePage::keyDown( unsigned char inASCII ) {
displayGlobalMessage( message );
delete [] message;
}
else if( strstr( typedText,
translate( "unfollowCommand" ) )
== typedText ) {
else if( commandTyped( typedText,
"unfollowCommand" ) ) {
sendToServerSocket( (char*)"UNFOL 0 0#" );
}
else {
Expand Down
2 changes: 1 addition & 1 deletion gameSource/game.cpp
@@ -1,4 +1,4 @@
int versionNumber = 356;
int versionNumber = 358;
int dataVersionNumber = 0;

int binVersionNumber = versionNumber;
Expand Down
7 changes: 5 additions & 2 deletions gameSource/languages/English.txt
Expand Up @@ -706,6 +706,9 @@ tutorial_1903 "PRESS [UP ARROW] UNTIL YOU RETURN TO /HATCHET##PRESS [ENTER] TO
tutorial_20 "A FINAL CHALLENGE: MAKE A HATCHET TO CHOP KINDLING.##GET THE FIRE GOING AGAIN. LIGHT THE TORCH."


tutorial_2001 "ARE YOU FEELING REALLY STUCK?##WALK LEFT THROUGH THIS DOOR FOR HINTS."


tutorial_21 "TUTORIAL COMPLETE. AFTER YOU DIE, YOU'LL BE BORN FOR REAL.##A DEADLY PIT OF RATTLESNAKES IS PROVIDED FOR YOUR CONVENIENCE."


Expand All @@ -730,7 +733,7 @@ tutorial_2701 "THIS OPTIONAL AREA WILL NOT HELP YOU PASS THE TUTORIAL.##GO BACK



tutorial_28 "HEAD SOUTH FOR HINTS, BUT ONLY IF YOU'RE REALLY STUCK. YOU CAN'T OPEN##THIS DOOR UNLESS YOU'VE BEEN TRYING FOR TWENTY MINUTES."
tutorial_28 "HEAD SOUTH FOR HINTS, BUT ONLY IF YOU'RE REALLY STUCK.##YOU SHOULD TRY TO FIGURE IT OUT ON YOUR OWN FIRST."



Expand All @@ -744,7 +747,7 @@ tutorial_32 "A HATCHET CAN MAKE KINDLING OUT OF BRANCHES.##PUT KINDLING ON HOT C

tutorial_33 "STICK A LONG STRAIGHT SHAFT INTO THE FIRE.##YOU GET A FIREBRAND."

tutorial_34 "YOU CAN USE THE FIREBRAND TO GO BACK AND LIGHT THE TORCH.##(HINT: IT LITERALLY SAYS THE WORD TORCH ON IT.)"
tutorial_34 "YOU CAN USE THE FIREBRAND TO GO BACK AND LIGHT THE TORCH.##(HINT: IT LITERALLY SAYS THE WORD 'TORCH' ON IT.)"



Expand Down
9 changes: 9 additions & 0 deletions scripts/syncMapChangeLogs.sh
@@ -1,8 +1,17 @@


# delete old files from game server
ssh bigserver2.onehouronelife.com 'find checkout/OneLife/server/mapChangeLogs/*.txt -mtime +14 -delete'


# copy from game server to here
rsync -avz -e ssh --progress bigserver2.onehouronelife.com:checkout/OneLife/server/mapChangeLogs/*.txt ~/mapChangeLogs/


# delete old files locally
find ~/mapChangeLogs/ -mtime +14 -delete


# copy from here to public data server
# send all but latest file, which is not public knowledge yet (still being
# updated with new data)
Expand Down
73 changes: 68 additions & 5 deletions server/server.cpp
Expand Up @@ -153,6 +153,12 @@ static double foodScaleFactorFloor = 0.5;
static double foodScaleFactorHalfLife = 50;
static double foodScaleFactorGamma = 1.5;

static double newPlayerFoodDecrementSecondsBonus = 8;
static int newPlayerFoodEatingBonus = 5;
// first 10 hours of living
static double newPlayerFoodBonusHalfLifeSeconds = 36000;



static double indoorFoodDecrementSecondsBonus = 20.0;

Expand Down Expand Up @@ -1093,6 +1099,12 @@ typedef struct LiveObject {
Craving cravingFood;
int cravingFoodYumIncrement;
char cravingKnown;

// to give new players a boost
// set these at birth based on how long they have played so far
int personalEatBonus;
double personalFoodDecrementSecondsBonus;


} LiveObject;

Expand Down Expand Up @@ -3344,6 +3356,8 @@ double computeFoodDecrementTimeSeconds( LiveObject *inPlayer ) {
// all player temp effects push us up above min
value += minFoodDecrementSeconds;

value += inPlayer->personalFoodDecrementSecondsBonus;

inPlayer->indoorBonusTime = 0;

if( inPlayer->isIndoors &&
Expand Down Expand Up @@ -6860,6 +6874,8 @@ static int getEatBonus( LiveObject *inPlayer ) {
generation / eatBonusHalfLife )
+ eatBonusFloor );

b += inPlayer->personalEatBonus;

return b;
}

Expand Down Expand Up @@ -8325,6 +8341,14 @@ int processLoggedInPlayer( int inAllowOrForceReconnect,
foodScaleFactorGamma =
SettingsManager::getFloatSetting( "foodScaleFactorGamma", 1.5 );

newPlayerFoodEatingBonus =
SettingsManager::getIntSetting( "newPlayerFoodEatingBonus", 5 );
newPlayerFoodDecrementSecondsBonus =
SettingsManager::getFloatSetting( "newPlayerFoodDecrementSecondsBonus",
8 );
newPlayerFoodBonusHalfLifeSeconds =
SettingsManager::getFloatSetting( "newPlayerFoodBonusHalfLifeSeconds",
36000 );

babyBirthFoodDecrement =
SettingsManager::getIntSetting( "babyBirthFoodDecrement", 10 );
Expand Down Expand Up @@ -9918,6 +9942,27 @@ int processLoggedInPlayer( int inAllowOrForceReconnect,
}
}

newObject.personalEatBonus = 0;
newObject.personalFoodDecrementSecondsBonus = 0;

if( ! newObject.isTutorial &&
isUsingStatsServer() &&
! newObject.lifeStats.error ) {

int sec = newObject.lifeStats.lifeTotalSeconds;

double halfLifeFactor =
pow( 0.5, sec / newPlayerFoodBonusHalfLifeSeconds );


newObject.personalEatBonus =
lrint( halfLifeFactor * newPlayerFoodEatingBonus );

newObject.personalFoodDecrementSecondsBonus =
lrint( halfLifeFactor * newPlayerFoodDecrementSecondsBonus );
}


if( forceSpawn ) {
newObject.forceSpawn = true;
newObject.xs = forceSpawnInfo.pos.x;
Expand Down Expand Up @@ -15457,7 +15502,7 @@ static void leaderDied( LiveObject *inLeader ) {
if( inLeader->followingID == -1 &&
directFollowers.size() > 0 ) {

LiveObject *fittestFollower = NULL;
LiveObject *fittestFollower = directFollowers.getElementDirect( 0 );
double fittestFitness = 0;

for( int i=0; i<directFollowers.size(); i++ ) {
Expand Down Expand Up @@ -20989,8 +21034,20 @@ int main() {
if( isGridAdjacent( testX, m.y,
nextPlayer->xd,
nextPlayer->yd ) ) {
isAdjacent = true;
break;
// don't count wide object
// as adjacent if it hangs
// out over another blocking
// object (prevent wide truck
// from being stolen through
// fence)
int blockOID =
getMapObject( testX, m.y );
if( blockOID == 0 ||
! getObject( blockOID )->
blocksWalking ) {
isAdjacent = true;
break;
}
}
}
if( ! isAdjacent )
Expand All @@ -21000,8 +21057,14 @@ int main() {
if( isGridAdjacent( testX, m.y,
nextPlayer->xd,
nextPlayer->yd ) ) {
isAdjacent = true;
break;
int blockOID =
getMapObject( testX, m.y );
if( blockOID == 0 ||
! getObject( blockOID )->
blocksWalking ) {
isAdjacent = true;
break;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions server/settings/newPlayerFoodBonusHalfLifeSeconds.ini
@@ -0,0 +1 @@
36000
1 change: 1 addition & 0 deletions server/settings/newPlayerFoodDecrementSecondsBonus.ini
@@ -0,0 +1 @@
12
1 change: 1 addition & 0 deletions server/settings/newPlayerFoodEatingBonus.ini
@@ -0,0 +1 @@
0

0 comments on commit 3aae4f6

Please sign in to comment.