mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
AI: improved performance and fixed crashes on use cases with too much target options like "deals 5 damage divided as you choose" (related to #11285):
* added DebugUtil.AI_ENABLE_DEBUG_MODE for better IDE's debugging AI code; * it's a target amount optimizations; * it's use a grouping of possible targets due same static and dynamic stats (name, abilities, rules, damage, etc); * instead of going through all possible combinations, AI uses only meaningful targets from particular groups;
This commit is contained in:
parent
b4fa6ace66
commit
f17cbbe72b
9 changed files with 349 additions and 50 deletions
|
|
@ -70,7 +70,7 @@ public class ComputerPlayer extends PlayerImpl {
|
|||
protected int PASSIVITY_PENALTY = 5; // Penalty value for doing nothing if some actions are available
|
||||
|
||||
// debug only: set TRUE to debug simulation's code/games (on false sim thread will be stopped after few secs by timeout)
|
||||
protected boolean COMPUTER_DISABLE_TIMEOUT_IN_GAME_SIMULATIONS = false;
|
||||
protected boolean COMPUTER_DISABLE_TIMEOUT_IN_GAME_SIMULATIONS = DebugUtil.AI_ENABLE_DEBUG_MODE;
|
||||
|
||||
// AI agents uses game simulation thread for all calcs and it's high CPU consumption
|
||||
// More AI threads - more parallel AI games can be calculate
|
||||
|
|
@ -82,7 +82,7 @@ public class ComputerPlayer extends PlayerImpl {
|
|||
// * use your's CPU cores for best performance
|
||||
// TODO: add server config to control max AI threads (with CPU cores by default)
|
||||
// TODO: rework AI implementation to use multiple sims calculation instead one by one
|
||||
final static int COMPUTER_MAX_THREADS_FOR_SIMULATIONS = 5;
|
||||
final static int COMPUTER_MAX_THREADS_FOR_SIMULATIONS = DebugUtil.AI_ENABLE_DEBUG_MODE ? 1 : 5;
|
||||
|
||||
private final transient Map<Mana, Card> unplayable = new TreeMap<>();
|
||||
private final transient List<Card> playableNonInstant = new ArrayList<>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue