Awbz / OneLife

a multiplayer survival game of parenting and civilization building
http://onehouronelife.com
Other
72 stars 16 forks source link

Fertility monitor is incorrect at times #71

Open BlueDiamondAvatar opened 5 years ago

BlueDiamondAvatar commented 5 years ago

The pop up box showing whether there are fertile women or girls alive in your family tree seems to be incorrect at times. For example, it may show a large number of girls with noone aging up into fertile women, or show women alive when there are no known offshoot families and no women in sight.

See OP description in this forum post. http://onehouronelife.com/forums/viewtopic.php?pid=51319#p51319

This may be related to the ongoing family tree server issues with the main One Hour One LIfe code. https://github.com/jasonrohrer/OneLife/issues/223

Awbz commented 5 years ago

The method that the mod uses to display those numbers in-game is really quite simple:

  1. Loop through all living players known to the client.
  2. Skips checking male players, as they cannot reproduce.
  3. Checks to see if the "relationship string" starts with "YOUR". (This denotes a relative.)
  4. Increments a counter for "young" if the female's age is less than 14 and "fertile" if between 14 and 40.
for( int i=0; i<gameObjects.size(); i++ ) {
    LiveObject *thisPlayer = gameObjects.getElement( i );
    if( thisPlayer != NULL ) {
        char isPlayerMale = getObject( thisPlayer->displayID )->male;
        if( ! isPlayerMale && thisPlayer->id != ourID && thisPlayer->relationName != NULL ) {
            if( stringCompareIgnoreCase(thisPlayer->relationName, "YOUR" ) > 0 ) {
                if( thisPlayer->age < 14 ) {
                    relatedYoungFemales++;
                    }
                if ( thisPlayer->age > 13 && thisPlayer->age < 40 ) {
                    relatedFertileFemales++;
                    }
                }
            }
        }
    }

As you mentioned, it's more than likely due to the same issue(s) as the family tree server. I'm not exactly sure what's causing it, but it could be any number of edge-case scenarios (such as your mother naming another lineage's baby, or your sibling being named by a completely different family, etc.)

Unfortunately, this looks like an issue that Jason will have to resolve as the client is only consuming the available information that the server sends.