Skip to content

Commit

Permalink
move complex genome protection to attacker tab + renaming it to 'Comp…
Browse files Browse the repository at this point in the history
…lex creature protection'
  • Loading branch information
chrxh committed Nov 22, 2024
1 parent 0b3cd8b commit 5eb1233
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion source/EngineGpuKernels/AttackerProcessor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data,
energyToTransfer *= (1.0f - cudaSimulationParameters.cellFunctionAttackerSensorDetectionFactor[color]);
}

if (cudaSimulationParameters.features.advancedAttackerControl && otherCell->genomeComplexity > cell->genomeComplexity) {
if (otherCell->genomeComplexity > cell->genomeComplexity) {
auto cellFunctionAttackerGenomeComplexityBonus = SpotCalculator::calcParameter(
&SimulationParametersSpotValues::cellFunctionAttackerGenomeComplexityBonus,
&SimulationParametersSpotActivatedValues::cellFunctionAttackerGenomeComplexityBonus,
Expand Down
6 changes: 3 additions & 3 deletions source/Gui/RadiationSourcesWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace
{
auto const RightColumnWidth = 140.0f;
auto const RightColumnWidth = 150.0f;
}

void RadiationSourcesWindow::initIntern(SimulationFacade simulationFacade)
Expand Down Expand Up @@ -76,7 +76,7 @@ void RadiationSourcesWindow::processBaseTab()
auto editedStrength = strength;
if (AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Strength")
.name("Relative strength")
.textWidth(RightColumnWidth)
.min(0.0f)
.max(1.0f)
Expand Down Expand Up @@ -132,7 +132,7 @@ bool RadiationSourcesWindow::processSourceTab(int index)
auto origStrengths = editService.getRadiationStrengths(parameters);
if (AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Strength")
.name("Relative strength")
.textWidth(RightColumnWidth)
.min(0.0f)
.max(1.0f)
Expand Down
62 changes: 31 additions & 31 deletions source/Gui/SimulationParametersWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,18 +886,6 @@ void SimulationParametersWindow::processBase()
"zero is entered in row 2 (red) and column 3 (green), it means that red cells cannot eat green cells.")
.defaultValue(toVector<MAX_COLORS, MAX_COLORS>(origParameters.baseValues.cellFunctionAttackerFoodChainColorMatrix)),
parameters.baseValues.cellFunctionAttackerFoodChainColorMatrix);
AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Energy cost")
.textWidth(RightColumnWidth)
.colorDependence(true)
.min(0)
.max(1.0f)
.format("%.5f")
.logarithmic(true)
.defaultValue(origParameters.baseValues.cellFunctionAttackerEnergyCost)
.tooltip("Amount of energy lost by an attempted attack of a cell in form of emitted energy particles."),
parameters.baseValues.cellFunctionAttackerEnergyCost);
AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Attack strength")
Expand All @@ -920,6 +908,27 @@ void SimulationParametersWindow::processBase()
.defaultValue(origParameters.cellFunctionAttackerRadius)
.tooltip("The maximum distance over which an attacker cell can attack another cell."),
parameters.cellFunctionAttackerRadius);
AlienImGui::InputFloatColorMatrix(
AlienImGui::InputFloatColorMatrixParameters()
.name("Complex creature protection")
.textWidth(RightColumnWidth)
.min(0)
.max(20.0f)
.defaultValue(toVector<MAX_COLORS, MAX_COLORS>(origParameters.baseValues.cellFunctionAttackerGenomeComplexityBonus))
.tooltip("The larger this parameter is, the less energy can be gained by attacking creatures with more complex genomes."),
parameters.baseValues.cellFunctionAttackerGenomeComplexityBonus);
AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Energy cost")
.textWidth(RightColumnWidth)
.colorDependence(true)
.min(0)
.max(1.0f)
.format("%.5f")
.logarithmic(true)
.defaultValue(origParameters.baseValues.cellFunctionAttackerEnergyCost)
.tooltip("Amount of energy lost by an attempted attack of a cell in form of emitted energy particles."),
parameters.baseValues.cellFunctionAttackerEnergyCost);
AlienImGui::Checkbox(
AlienImGui::CheckboxParameters()
.name("Destroy cells")
Expand Down Expand Up @@ -1227,15 +1236,6 @@ void SimulationParametersWindow::processBase()
*/
if (parameters.features.advancedAttackerControl) {
if (AlienImGui::BeginTreeNode(AlienImGui::TreeNodeParameters().text("Addon: Advanced attacker control"))) {
AlienImGui::InputFloatColorMatrix(
AlienImGui::InputFloatColorMatrixParameters()
.name("Complex genome protection")
.textWidth(RightColumnWidth)
.min(0)
.max(20.0f)
.defaultValue(toVector<MAX_COLORS, MAX_COLORS>(origParameters.baseValues.cellFunctionAttackerGenomeComplexityBonus))
.tooltip("The larger this parameter is, the less energy can be gained by attacking creatures with more complex genomes."),
parameters.baseValues.cellFunctionAttackerGenomeComplexityBonus);
AlienImGui::InputFloatColorMatrix(
AlienImGui::InputFloatColorMatrixParameters()
.name("Same mutant protection")
Expand Down Expand Up @@ -2159,6 +2159,16 @@ bool SimulationParametersWindow::processSpot(int index)
.disabledValue(toVector<MAX_COLORS, MAX_COLORS>(parameters.baseValues.cellFunctionAttackerFoodChainColorMatrix)),
spot.values.cellFunctionAttackerFoodChainColorMatrix,
&spot.activatedValues.cellFunctionAttackerFoodChainColorMatrix);
AlienImGui::InputFloatColorMatrix(
AlienImGui::InputFloatColorMatrixParameters()
.name("Complex creature protection")
.textWidth(RightColumnWidth)
.min(0)
.max(20.0f)
.defaultValue(toVector<MAX_COLORS, MAX_COLORS>(origSpot.values.cellFunctionAttackerGenomeComplexityBonus))
.disabledValue(toVector<MAX_COLORS, MAX_COLORS>(parameters.baseValues.cellFunctionAttackerGenomeComplexityBonus)),
spot.values.cellFunctionAttackerGenomeComplexityBonus,
&spot.activatedValues.cellFunctionAttackerGenomeComplexityBonus);
AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Energy cost")
Expand Down Expand Up @@ -2213,16 +2223,6 @@ bool SimulationParametersWindow::processSpot(int index)
*/
if (parameters.features.advancedAttackerControl) {
if (AlienImGui::BeginTreeNode(AlienImGui::TreeNodeParameters().text("Addon: Advanced attacker control"))) {
AlienImGui::InputFloatColorMatrix(
AlienImGui::InputFloatColorMatrixParameters()
.name("Complex genome protection")
.textWidth(RightColumnWidth)
.min(0)
.max(20.0f)
.defaultValue(toVector<MAX_COLORS, MAX_COLORS>(origSpot.values.cellFunctionAttackerGenomeComplexityBonus))
.disabledValue(toVector<MAX_COLORS, MAX_COLORS>(parameters.baseValues.cellFunctionAttackerGenomeComplexityBonus)),
spot.values.cellFunctionAttackerGenomeComplexityBonus,
&spot.activatedValues.cellFunctionAttackerGenomeComplexityBonus);
AlienImGui::InputFloatColorMatrix(
AlienImGui::InputFloatColorMatrixParameters()
.name("New complex mutant protection")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void LegacyAuxiliaryDataParserService::updateParametersAndFeaturesForLegacyFiles
advancedAttackerControlForSpot = true;
}
}
if (advancedAttackerControlForSpot || !equals(parameters.baseValues.cellFunctionAttackerGenomeComplexityBonus, 0.0f)
if (advancedAttackerControlForSpot
|| !equals(parameters.cellFunctionAttackerSameMutantPenalty, 0.0f) || !equals(parameters.cellFunctionAttackerSensorDetectionFactor, 0.0f)
|| !equals(parameters.baseValues.cellFunctionAttackerGeometryDeviationExponent, 0.0f)
|| !equals(parameters.baseValues.cellFunctionAttackerConnectionsMismatchPenalty, 0.0f)
Expand Down

0 comments on commit 5eb1233

Please sign in to comment.