4.6 Gamemodes

Based upon the game mode and the side of the field you are loaded in on, you might want to do different things. The current game mode can be referenced using the getPlayMode() function contained in the worldModel object as follows:

int _playMode = worldModel->getPlayMode();

here we store the current gamemode in _playMode

The side of the field my team has been loaded on can be obtained in a similar way using getSide() which is also contained in worldModel as follows:

    int _side = worldModel->getSide();

These two variables can then be used to make interesting decisions. For example we need to check if it is our kickoff at the start of the game which can be done as follows:

if(_playMode == PM_KICK_OFF_LEFT){
        if(worldModel->getSide() == SIDE_LEFT){
            // OUR OWN KICK OFF
        }
}
else if(_playMode == PM_KICK_OFF_RIGHT){
        if(worldModel->getSide() == SIDE_RIGHT){
            // ALSO OUR OWN KICK OFF
        }
}