diff --git a/source/EngineGpuKernels/AttackerProcessor.cuh b/source/EngineGpuKernels/AttackerProcessor.cuh index 8a88cbbfa..b2ba1fbd4 100644 --- a/source/EngineGpuKernels/AttackerProcessor.cuh +++ b/source/EngineGpuKernels/AttackerProcessor.cuh @@ -71,7 +71,7 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data, auto color = calcMod(cell->color, MAX_COLORS); auto otherColor = calcMod(otherCell->color, MAX_COLORS); - if (cudaSimulationParameters.features.advancedAttackerControl && otherCell->detectedByCreatureId != (cell->creatureId & 0xff)) { + if (cudaSimulationParameters.features.advancedAttackerControl && otherCell->detectedByCreatureId != (cell->creatureId & 0xffff)) { energyToTransfer *= (1.0f - cudaSimulationParameters.cellFunctionAttackerSensorDetectionFactor[color]); } @@ -87,7 +87,7 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data, (1.0f + cellFunctionAttackerGenomeComplexityBonus * (otherCell->genomeComplexity - cell->genomeComplexity)); } if (cudaSimulationParameters.features.advancedAttackerControl - && ((otherCell->mutationId == cell->mutationId) || (otherCell->ancestorMutationId == static_cast(cell->mutationId & 0xffff))) + && ((otherCell->mutationId == cell->mutationId) || (otherCell->ancestorMutationId == static_cast(cell->mutationId & 0xff))) && cell->mutationId != 0) { energyToTransfer *= (1.0f - cudaSimulationParameters.cellFunctionAttackerSameMutantPenalty[color][otherColor]); } diff --git a/source/EngineGpuKernels/ConstructorProcessor.cuh b/source/EngineGpuKernels/ConstructorProcessor.cuh index 995dcb296..97706af1d 100644 --- a/source/EngineGpuKernels/ConstructorProcessor.cuh +++ b/source/EngineGpuKernels/ConstructorProcessor.cuh @@ -640,7 +640,7 @@ ConstructorProcessor::constructCellIntern( result->livingState = LivingState_UnderConstruction; result->creatureId = constructor.offspringCreatureId; result->mutationId = constructor.offspringMutationId; - result->ancestorMutationId = static_cast(hostCell->mutationId & 0xffff); + result->ancestorMutationId = static_cast(hostCell->mutationId & 0xff); result->cellFunction = constructionData.cellFunction; result->color = constructionData.color; result->inputExecutionOrderNumber = constructionData.inputExecutionOrderNumber; diff --git a/source/EngineGpuKernels/Object.cuh b/source/EngineGpuKernels/Object.cuh index f50a1fa89..d36ac3206 100644 --- a/source/EngineGpuKernels/Object.cuh +++ b/source/EngineGpuKernels/Object.cuh @@ -220,7 +220,7 @@ struct Cell LivingState livingState; uint32_t creatureId; uint32_t mutationId; - uint16_t ancestorMutationId; //only the first 16 bits from host mutation id + uint8_t ancestorMutationId; //only the first 8 bits from ancestor mutation id float genomeComplexity; //cell function @@ -234,7 +234,7 @@ struct Cell CellFunctionUsed cellFunctionUsed; //process data - uint8_t detectedByCreatureId; //only the first 8 bits from the creature id + uint16_t detectedByCreatureId; //only the first 16 bits from the creature id //annotations CellMetadataDescription metadata; diff --git a/source/EngineGpuKernels/SensorProcessor.cuh b/source/EngineGpuKernels/SensorProcessor.cuh index 732780bf4..a64b50e3b 100644 --- a/source/EngineGpuKernels/SensorProcessor.cuh +++ b/source/EngineGpuKernels/SensorProcessor.cuh @@ -320,7 +320,7 @@ __inline__ __device__ void SensorProcessor::flagDetectedCells(SimulationData& da } if (restrictToMutants == SensorRestrictToMutants_RestrictToOtherMutants && (cell->mutationId == otherCell->mutationId || otherCell->mutationId == 0 || otherCell->mutationId == 1 - || static_cast(cell->mutationId & 0xffff) == otherCell->ancestorMutationId)) { + || static_cast(cell->mutationId & 0xff) == otherCell->ancestorMutationId)) { continue; } if (restrictToMutants == SensorRestrictToMutants_RestrictToFreeCells && otherCell->mutationId != 1) { @@ -343,7 +343,7 @@ __inline__ __device__ void SensorProcessor::flagDetectedCells(SimulationData& da // continue; //} - otherCell->detectedByCreatureId = static_cast(cell->creatureId & 0xff); + otherCell->detectedByCreatureId = static_cast(cell->creatureId & 0xffff); } } } diff --git a/source/EngineGpuKernels/TOs.cuh b/source/EngineGpuKernels/TOs.cuh index dd4ebc54d..120d4ed43 100644 --- a/source/EngineGpuKernels/TOs.cuh +++ b/source/EngineGpuKernels/TOs.cuh @@ -174,7 +174,7 @@ struct CellTO LivingState livingState; uint32_t creatureId; uint32_t mutationId; - uint16_t ancestorMutationId; //only the first 16 bits from host mutation id + uint8_t ancestorMutationId; //only the first 8 bits from ancestor mutation id float genomeComplexity; //cell function @@ -185,7 +185,7 @@ struct CellTO CellFunctionTO cellFunctionData; ActivityTO activity; uint32_t activationTime; - uint8_t detectedByCreatureId; //only the first 8 bits from the creature id + uint16_t detectedByCreatureId; //only the first 16 bits from the creature id CellFunctionUsed cellFunctionUsed; CellMetadataTO metadata; diff --git a/source/EngineInterface/Descriptions.h b/source/EngineInterface/Descriptions.h index 900841209..629aea8b6 100644 --- a/source/EngineInterface/Descriptions.h +++ b/source/EngineInterface/Descriptions.h @@ -384,7 +384,7 @@ struct CellDescription LivingState livingState = LivingState_Ready; int creatureId = 0; int mutationId = 0; - int ancestorMutationId = 0; + uint8_t ancestorMutationId = 0; float genomeComplexity = 0; //cell function @@ -394,7 +394,7 @@ struct CellDescription CellFunctionDescription cellFunction; ActivityDescription activity; int activationTime = 0; - uint8_t detectedByCreatureId = 0; //only the first 8 bits from the creature id + int detectedByCreatureId = 0; //only the first 16 bits from the creature id CellFunctionUsed cellFunctionUsed = CellFunctionUsed_No; CellMetadataDescription metadata; diff --git a/source/EngineInterface/SerializerService.cpp b/source/EngineInterface/SerializerService.cpp index 6a5cd42ff..839e13947 100644 --- a/source/EngineInterface/SerializerService.cpp +++ b/source/EngineInterface/SerializerService.cpp @@ -117,11 +117,12 @@ namespace auto constexpr Id_Cell_CreatureId = 11; auto constexpr Id_Cell_MutationId = 12; auto constexpr Id_Cell_GenomeComplexity_Deprecated = 13; - auto constexpr Id_Cell_DetectedByCreatureId = 14; + //auto constexpr Id_Cell_DetectedByCreatureId = 14; auto constexpr Id_Cell_CellFunctionUsed = 15; -// auto constexpr Id_Cell_AncestorMutationId = 16; + auto constexpr Id_Cell_AncestorMutationId = 16; auto constexpr Id_Cell_GenomeComplexity = 17; - auto constexpr Id_Cell_AncestorMutationId = 18; + //auto constexpr Id_Cell_AncestorMutationId = 18; + auto constexpr Id_Cell_DetectedByCreatureId = 19; auto constexpr Id_Activity_Origin = 0; auto constexpr Id_Activity_TargetX = 1; @@ -793,13 +794,13 @@ namespace cereal loadSave(task, auxiliaries, Id_Cell_LivingState, data.livingState, defaultObject.livingState); loadSave(task, auxiliaries, Id_Cell_CreatureId, data.creatureId, defaultObject.creatureId); loadSave(task, auxiliaries, Id_Cell_MutationId, data.mutationId, defaultObject.mutationId); - loadSave(task, auxiliaries, Id_Cell_AncestorMutationId, data.ancestorMutationId, defaultObject.ancestorMutationId); + loadSave(task, auxiliaries, Id_Cell_AncestorMutationId, data.ancestorMutationId, defaultObject.ancestorMutationId); loadSave>( task, auxiliaries, Id_Cell_InputExecutionOrderNumber, data.inputExecutionOrderNumber, defaultObject.inputExecutionOrderNumber); loadSave(task, auxiliaries, Id_Cell_OutputBlocked, data.outputBlocked, defaultObject.outputBlocked); loadSave(task, auxiliaries, Id_Cell_ActivationTime, data.activationTime, defaultObject.activationTime); loadSave(task, auxiliaries, Id_Cell_GenomeComplexity, data.genomeComplexity, defaultObject.genomeComplexity); - loadSave(task, auxiliaries, Id_Cell_DetectedByCreatureId, data.detectedByCreatureId, defaultObject.detectedByCreatureId); + loadSave(task, auxiliaries, Id_Cell_DetectedByCreatureId, data.detectedByCreatureId, defaultObject.detectedByCreatureId); loadSave(task, auxiliaries, Id_Cell_CellFunctionUsed, data.cellFunctionUsed, defaultObject.cellFunctionUsed); processLoadSaveMap(task, ar, auxiliaries);