Skip to content

Commit aadf282

Browse files
committed
+ sensors remember last match
+ tooltips for sensor and muscles corrected
1 parent a98fa1b commit aadf282

File tree

7 files changed

+34
-9
lines changed

7 files changed

+34
-9
lines changed

source/Base/Resources.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Const
44
{
5-
std::string const ProgramVersion = "4.0.0";
5+
std::string const ProgramVersion = "4.0.1";
66

77
std::string const BasePath = "resources/";
88

source/EngineGpuKernels/Cell.cuh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ struct SensorFunction
7171
float minDensity;
7272
int color;
7373
int targetedCreatureId;
74+
75+
//temp
76+
float memoryChannel1;
77+
float memoryChannel2;
78+
float memoryChannel3;
7479
};
7580

7681
struct NerveFunction

source/EngineGpuKernels/ConstructorProcessor.cuh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ ConstructorProcessor::constructCellIntern(
647647
result->cellFunctionData.sensor.angle = GenomeDecoder::readAngle(constructor);
648648
result->cellFunctionData.sensor.minDensity = (GenomeDecoder::readFloat(constructor) + 1.0f) / 2;
649649
result->cellFunctionData.sensor.color = GenomeDecoder::readByte(constructor) % MAX_COLORS;
650+
result->cellFunctionData.sensor.memoryChannel1 = 0;
651+
result->cellFunctionData.sensor.memoryChannel2 = 0;
652+
result->cellFunctionData.sensor.memoryChannel3 = 0;
653+
650654
} break;
651655
case CellFunction_Nerve: {
652656
result->cellFunctionData.nerve.pulseMode = GenomeDecoder::readByte(constructor);

source/EngineGpuKernels/ObjectFactory.cuh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ __inline__ __device__ void ObjectFactory::changeCellFromTO(DataTO const& dataTO,
152152
cell->cellFunctionData.sensor.minDensity = cellTO.cellFunctionData.sensor.minDensity;
153153
cell->cellFunctionData.sensor.color = cellTO.cellFunctionData.sensor.color;
154154
cell->cellFunctionData.sensor.targetedCreatureId = cellTO.cellFunctionData.sensor.targetedCreatureId;
155+
cell->cellFunctionData.sensor.memoryChannel1 = 0;
156+
cell->cellFunctionData.sensor.memoryChannel2 = 0;
157+
cell->cellFunctionData.sensor.memoryChannel3 = 0;
155158
} break;
156159
case CellFunction_Nerve: {
157160
cell->cellFunctionData.nerve.pulseMode = cellTO.cellFunctionData.nerve.pulseMode;
@@ -299,6 +302,9 @@ __inline__ __device__ Cell* ObjectFactory::createRandomCell(float energy, float2
299302
cell->cellFunctionData.sensor.minDensity = _data->numberGen1.random(1.0f);
300303
cell->cellFunctionData.sensor.color = _data->numberGen1.random(MAX_COLORS - 1);
301304
cell->cellFunctionData.sensor.targetedCreatureId = 0;
305+
cell->cellFunctionData.sensor.memoryChannel1 = 0;
306+
cell->cellFunctionData.sensor.memoryChannel2 = 0;
307+
cell->cellFunctionData.sensor.memoryChannel3 = 0;
302308
} break;
303309
case CellFunction_Nerve: {
304310
} break;

source/EngineGpuKernels/SensorProcessor.cuh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,19 @@ SensorProcessor::searchNeighborhood(SimulationData& data, SimulationStatistics&
123123
activity.channels[1] = static_cast<float>((lookupResult >> 40) & 0xff) / 256; //density
124124
activity.channels[2] = static_cast<float>(lookupResult >> 48) / 256; //distance
125125
activity.channels[3] = convertDataToAngle(static_cast<int8_t>((lookupResult >> 32) & 0xff)) / 360.0f; //angle: between -0.5 and 0.5
126+
cell->cellFunctionData.sensor.memoryChannel1 = activity.channels[1];
127+
cell->cellFunctionData.sensor.memoryChannel2 = activity.channels[2];
128+
cell->cellFunctionData.sensor.memoryChannel3 = activity.channels[3];
126129
auto targetCreatureId = lookupResult & 0xffffffff;
127130
if (targetCreatureId != 0xffffffff) {
128131
cell->cellFunctionData.sensor.targetedCreatureId = toInt(targetCreatureId);
129132
}
130133
statistics.incNumSensorMatches(cell->color);
131134
} else {
132135
activity.channels[0] = 0; //nothing found
136+
activity.channels[1] = cell->cellFunctionData.sensor.memoryChannel1;
137+
activity.channels[2] = cell->cellFunctionData.sensor.memoryChannel2;
138+
activity.channels[3] = cell->cellFunctionData.sensor.memoryChannel3;
133139
}
134140
}
135141
__syncthreads();

source/Gui/SimulationParametersWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ void _SimulationParametersWindow::processBase(
996996
.textWidth(RightColumnWidth)
997997
.colorDependence(true)
998998
.min(0.1f)
999-
.max(3.0f)
999+
.max(4.0f)
10001000
.defaultValue(origSimParameters.cellFunctionInjectorRadius)
10011001
.tooltip("The maximum distance over which an injector cell can infect another cell."),
10021002
simParameters.cellFunctionInjectorRadius);

source/Gui/Tooltips.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace Const
3131
std::string const SensorTooltip =
3232
"Sensor cells scan their environment for concentrations of cells of a certain color and provide distance and angle to the "
3333
"closest match.\n\n" ICON_FA_CHEVRON_RIGHT " Input channel #0: abs(value) > threshold activates sensor\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #0: "
34-
"0 (no match) or 1 (match)\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #1: density of the match\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #2: distance "
35-
"of the match\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #3: angle of the match";
34+
"0 (no match) or 1 (match)\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #1: density of the last match\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #2: distance "
35+
"of the last match\n\n" ICON_FA_CHEVRON_RIGHT " Output channel #3: angle of the last match";
3636

3737
std::string const NerveTooltip =
3838
"By default, a nerve cell forwards activity states by receiving activity as input from connected cells (and summing it if "
@@ -55,7 +55,9 @@ namespace Const
5555
"Muscle cells can perform different movements and deformations based on input and configuration.\n\n" ICON_FA_CHEVRON_RIGHT " Input channel "
5656
"#0: The strength of the movement, bending or expansion/contraction. A negative sign corresponds to the opposite "
5757
"action.\n\n" ICON_FA_CHEVRON_RIGHT " Input channel #1: This channel is solely utilized for acceleration due to bending. If the sign of channel #1 "
58-
"differs from the sign of channel #0, no acceleration will be obtained during the bending process.";
58+
"differs from the sign of channel #0, no acceleration will be obtained during the bending process.\n\n " ICON_FA_CHEVRON_RIGHT
59+
" Input channel #3: This channel is used for muscles in movement mode. It allows to determine the relative angle of the movement. A value of -0.5 "
60+
"correspond to -180 deg and +0.5 to +180 deg.";
5961

6062
std::string const DefenderTooltip =
6163
"A defender cell does not need to be activated. Its presence reduces the strength of an enemy attack involving attacker "
@@ -315,9 +317,9 @@ namespace Const
315317
"constructor next cell, e.g. no energy, required connection check failed, completeness check failed), 1 (next cell construction "
316318
"successful)\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: 0 (no match) or 1 (match)\n\n" ICON_FA_CHEVRON_RIGHT " Attacker: a value which is proportional to the gained "
317319
"energy\n\n" ICON_FA_CHEVRON_RIGHT " Injector: 0 (no cells found) or 1 (injection in process or completed)",
318-
"The following cell functions write their output to channel #1:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: density of the match",
319-
"The following cell functions write their output to channel #2:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: distance of the match",
320-
"The following cell functions write their output to channel #3:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: angle of the match",
320+
"The following cell functions write their output to channel #1:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: density of the last match",
321+
"The following cell functions write their output to channel #2:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: distance of the last match",
322+
"The following cell functions write their output to channel #3:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT " Sensor: angle of the last match",
321323
"The following cell functions write their output to channel #4:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
322324
"The following cell functions write their output to channel #5:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
323325
"The following cell functions write their output to channel #6:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
@@ -334,7 +336,9 @@ namespace Const
334336
"solely utilized for acceleration due to bending. If the sign of channel #1 differs from the sign of channel #0, no acceleration will be obtained "
335337
"during the bending process.",
336338
"The following cell functions obtain their input from channel #2:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
337-
"The following cell functions obtain their input from channel #3:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
339+
"The following cell functions obtain their input from channel #3:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron\n\n" ICON_FA_CHEVRON_RIGHT
340+
" Muscle: This channel is used for muscles in movement mode. It allows to determine the relative angle of the movement. A value of -0.5 correspond to "
341+
"-180 deg and +0.5 to +180 deg.",
338342
"The following cell functions obtain their input from channel #4:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
339343
"The following cell functions obtain their input from channel #5:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",
340344
"The following cell functions obtain their input from channel #6:\n\n" ICON_FA_CHEVRON_RIGHT " Neuron",

0 commit comments

Comments
 (0)