Put the Monte Carlo mode behind an advanced preference and update changelog

This commit is contained in:
Jyrki Vesterinen 2016-07-17 15:27:31 +03:00
parent d83e017689
commit 6766e05747
6 changed files with 43 additions and 1 deletions

View file

@ -49,6 +49,15 @@ Version 1.13.4+dev:
loggers activated in the gui print just like loggers activated in the
command line (i.e. messages appear in the console)
* Fix bug #24762: Editor actions are out of sync after resizing.
* Performance:
* Added an advanced preference (Preferences -> Advanced ->
Allow damage calculation with Monte Carlo simulation) that, when enabled,
allows the damage calculation to operate by simulating a few thousand fights
instead of calculating exact probabilities of each outcome (when a heuristic
determines that it's probably faster). This method is inexact, but in very
complex battles (extremely high HP, drain, slow, berserk, etc.) it's
significantly faster than the default damage calculation method, and may be
necessary for acceptable performance.
* WML engine:
* Add color= attribute to [message].
* Add [else], search_recall_list=, auto_recall= to [role]

View file

@ -188,6 +188,14 @@
type=custom
[/advanced_preference]
[advanced_preference]
field=damage_prediction_allow_monte_carlo_simulation
name= _ "Allow damage calculation with Monte Carlo simulation"
description= _ "Allow the damage calculation window to simulate fights instead of using exact probability calculations"
type=boolean
default=no
[/advanced_preference]
#ifdef __UNUSED__
[advanced_preference]
field=joystick_support_enabled

View file

@ -32,6 +32,16 @@ Version 1.13.4+dev:
* Added "Registered users only" checkbox to multiplayer configuration dialog which
when checked, only allows registered users to join the game
* Performance:
* Added an advanced preference (Preferences -> Advanced ->
Allow damage calculation with Monte Carlo simulation) that, when enabled,
allows the damage calculation to operate by simulating a few thousand fights
instead of calculating exact probabilities of each outcome (when a heuristic
determines that it's probably faster). This method is inexact, but in very
complex battles (extremely high HP, drain, slow, berserk, etc.) it's
significantly faster than the default damage calculation method, and may be
necessary for acceptable performance.
Version 1.13.4:
* Language and i18n:
* Updated translations: British English, Russian.

View file

@ -40,6 +40,7 @@
#include "actions/attack.hpp"
#include "game_config.hpp"
#include "preferences.hpp"
#include "random_new.hpp"
#include <array>
#include <cmath>
@ -1986,7 +1987,8 @@ void combatant::fight(combatant &opp, bool levelup_considered)
const std::vector<combat_slice> opp_split = split_summary(opp.u_, opp.summary);
if (fight_complexity(split.size(), opp_split.size(), u_, opp.u_) >
MONTE_CARLO_SIMULATION_THRESHOLD)
MONTE_CARLO_SIMULATION_THRESHOLD &&
preferences::damage_prediction_allow_monte_carlo_simulation())
{
// A very complex fight. Use Monte Carlo simulation instead of exact
// probability calculations.

View file

@ -1041,5 +1041,15 @@ void set_disable_loadingscreen_animation(bool value)
set("disable_loadingscreen_animation", value);
}
bool damage_prediction_allow_monte_carlo_simulation()
{
return get("damage_prediction_allow_monte_carlo_simulation", false);
}
void set_damage_prediction_allow_monte_carlo_simulation(bool value)
{
set("damage_prediction_allow_monte_carlo_simulation", value);
}
} // end namespace preferences

View file

@ -263,6 +263,9 @@ namespace preferences {
bool disable_loadingscreen_animation();
void set_disable_loadingscreen_animation(bool value);
bool damage_prediction_allow_monte_carlo_simulation();
void set_damage_prediction_allow_monte_carlo_simulation(bool value);
} // end namespace preferences
#endif