mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 01:35:42 +00:00
Faster placement (#4491)
* shorter time budget during setup phase * revert build file changes
This commit is contained in:
@@ -28,6 +28,23 @@ auto CalculateTimeBudget(
|
||||
const auto settingsGetter = settings->GetGetter();
|
||||
const auto castleCoords = AllCastleCoords(state->hex_map());
|
||||
|
||||
// Check if we're in setup phase
|
||||
const bool isSetupPhase = state->status()->state() ==
|
||||
net::eagle0::shardok::storage::fb::GameStatus_::State_SET_UP;
|
||||
|
||||
// During setup, use the setup-specific time budget
|
||||
if (isSetupPhase) {
|
||||
const auto budget = std::chrono::duration<double>(
|
||||
settingsGetter.Backing().lookahead_time_budget_setup());
|
||||
const auto remainingBudget = std::chrono::duration_cast<std::chrono::milliseconds>(budget);
|
||||
const size_t minDepth = settingsGetter.Backing().min_lookahead_turns();
|
||||
|
||||
return AITimeBudget{
|
||||
.remainingBudget = remainingBudget,
|
||||
.minDepthRequired = minDepth,
|
||||
.isCloseToEnemy = false}; // Not relevant during setup
|
||||
}
|
||||
|
||||
// Determine proximity (≤4 hex distance) - applies to both attackers and defenders
|
||||
bool isClose = false;
|
||||
const auto *units = state->units();
|
||||
|
||||
@@ -215,5 +215,6 @@ holyWaveVigorCost 10 double
|
||||
minLookaheadTurns 1 int8
|
||||
lookaheadTimeBudgetCloseInSeconds 3 double
|
||||
lookaheadTimeBudgetFarInSeconds 1.5 double
|
||||
lookaheadTimeBudgetSetup 0.5 double
|
||||
aiMinimumFleeOddsThreshold 30 int16
|
||||
aiDesperateFleeThreshold 10 int16
|
||||
|
@@ -48,11 +48,28 @@ protected:
|
||||
AddPlayerInfo(fbb, 1, false, 1000),
|
||||
AddPlayerInfo(fbb, 2, true, 1000)});
|
||||
|
||||
// Create a game status with GAME_RUNNING state
|
||||
auto endGameCondition = net::eagle0::shardok::storage::fb::EndGameCondition();
|
||||
endGameCondition.mutate_victory_type(
|
||||
net::eagle0::shardok::storage::fb::VictoryType_UNKNOWN_VICTORY_TYPE);
|
||||
endGameCondition.mutate_draw_details(
|
||||
net::eagle0::shardok::storage::fb::DrawType_UNKNOWN_DRAW_TYPE);
|
||||
endGameCondition.mutate_victory_details(
|
||||
net::eagle0::shardok::storage::fb::VictoryCondition_UNKNOWN_VICTORY_CONDITION);
|
||||
auto winningIdsVec = std::vector<PlayerId>{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
|
||||
auto winningIdsOff = fbb.CreateVector(winningIdsVec);
|
||||
auto statusB = net::eagle0::shardok::storage::fb::GameStatusBuilder(fbb);
|
||||
statusB.add_state(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
|
||||
statusB.add_end_game_condition(&endGameCondition);
|
||||
statusB.add_winning_shardok_ids(winningIdsOff);
|
||||
auto statusOff = statusB.Finish();
|
||||
|
||||
net::eagle0::shardok::storage::fb::GameStateBuilder gsb(fbb);
|
||||
gsb.add_units(unitsOffset);
|
||||
gsb.add_hex_map(hexMapOffset);
|
||||
gsb.add_player_infos(playerInfoOffset);
|
||||
gsb.add_current_round(5);
|
||||
gsb.add_status(statusOff);
|
||||
|
||||
fbb.Finish(gsb.Finish());
|
||||
return GameStateW(fbb);
|
||||
|
||||
Reference in New Issue
Block a user