add game types that are useful for training AIs
This commit is contained in:
parent
f4b6f16e54
commit
a85e31932c
3 changed files with 49 additions and 1 deletions
src
|
@ -690,6 +690,7 @@ static void GameTypeLeftVsRight()
|
|||
*/
|
||||
static void GameTypeManVsMachine()
|
||||
{
|
||||
Map.NoFogOfWar = true;
|
||||
for (int i = 0; i < PlayerMax - 1; ++i) {
|
||||
if (Players[i].Type != PlayerPerson && Players[i].Type != PlayerComputer) {
|
||||
continue;
|
||||
|
@ -738,6 +739,42 @@ static void GameTypeManTeamVsMachine()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** Machine vs Machine
|
||||
*/
|
||||
static void GameTypeMachineVsMachine()
|
||||
{
|
||||
Map.Reveal();
|
||||
for (int i = 0; i < PlayerMax - 1; ++i) {
|
||||
if (Players[i].Type == PlayerComputer) {
|
||||
for (int j = i + 1; j < PlayerMax - 1; ++j) {
|
||||
if (Players[j].Type == PlayerComputer) {
|
||||
CommandDiplomacy(i, DiplomacyEnemy, j);
|
||||
CommandDiplomacy(j, DiplomacyEnemy, i);
|
||||
} else {
|
||||
CommandDiplomacy(i, DiplomacyNeutral, j);
|
||||
CommandDiplomacy(j, DiplomacyNeutral, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** Machine vs Machine Training
|
||||
*/
|
||||
static void GameTypeMachineVsMachineTraining()
|
||||
{
|
||||
Assert(!IsNetworkGame());
|
||||
GameTypeMachineVsMachine();
|
||||
FastForwardCycle = LONG_MAX;
|
||||
SyncHash = 0;
|
||||
InitSyncRand();
|
||||
for (int i = 0; i < MyRand() % 100; i++) {
|
||||
SyncRand();
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Game creation
|
||||
----------------------------------------------------------------------------*/
|
||||
|
@ -871,6 +908,13 @@ void CreateGame(const std::string &filename, CMap *map)
|
|||
break;
|
||||
case SettingsGameTypeManTeamVsMachine:
|
||||
GameTypeManTeamVsMachine();
|
||||
break;
|
||||
case SettingsGameTypeMachineVsMachine:
|
||||
GameTypeMachineVsMachine();
|
||||
break;
|
||||
case SettingsGameTypeMachineVsMachineTraining:
|
||||
GameTypeMachineVsMachineTraining();
|
||||
break;
|
||||
|
||||
// Future game type ideas
|
||||
#if 0
|
||||
|
|
|
@ -101,7 +101,9 @@ enum GameTypes {
|
|||
SettingsGameTypeTopVsBottom,
|
||||
SettingsGameTypeLeftVsRight,
|
||||
SettingsGameTypeManVsMachine,
|
||||
SettingsGameTypeManTeamVsMachine
|
||||
SettingsGameTypeManTeamVsMachine,
|
||||
SettingsGameTypeMachineVsMachine,
|
||||
SettingsGameTypeMachineVsMachineTraining
|
||||
|
||||
// Future game type ideas
|
||||
#if 0
|
||||
|
|
|
@ -80,5 +80,7 @@ enum GameTypes {
|
|||
SettingsGameTypeLeftVsRight,
|
||||
SettingsGameTypeManVsMachine,
|
||||
SettingsGameTypeManTeamVsMachine,
|
||||
SettingsGameTypeMachineVsMachine,
|
||||
SettingsGameTypeMachineVsMachineTraining,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue