Пример #1
0
    public void Refresh()
    {
        genome = cand.candidateGenome;
        brain  = genome.brainGenome;
        core   = genome.bodyGenome.coreGenome;

        float lifespan = cand.performanceData.totalTicksAlive;

        textGeneration.text = "Gen: " + genome.generationCount;
        textBodySize.text   = "Size: " + (100f * core.creatureBaseLength).ToString("F0") + ", Aspect 1:" + (1f / core.creatureAspectRatio).ToString("F0");
        textBrainSize.text  = "Brain Size: " + brain.inOutNeurons.Count + "--" + brain.links.Count;
    }
Пример #2
0
 // TBD: Set Values from Genome
 public void Initialize(CritterModuleCoreGenome genome)
 {
 }
Пример #3
0
    /// <summary>
    /// COORDINATES FOR CREATURES:
    /// Positive Y = forward, creature head
    /// X Axis = Creature width;
    /// Negative Z = world UP!  note that this is flipped
    /// </summary>

    private static void ProcessBrushPointBaseBody(ref BrushPoint point, AgentGenome genome)
    {
        CritterModuleCoreGenome gene = genome.bodyGenome.coreGenome; // for readability

        float segmentsSummedCritterLength = gene.mouthLength + gene.headLength + gene.bodyLength + gene.tailLength;
        float bindPoseY = point.initCoordsNormalized.y * segmentsSummedCritterLength;

        float widthMultiplier;
        float heightMultiplier;
        // simplify round:
        float frontCapLerpAmount = Mathf.Clamp01(point.initCoordsNormalized.y - gene.creatureFrontTaperSize) / gene.creatureFrontTaperSize;
        float backCapLerpAmount  = Mathf.Clamp01((1f - point.initCoordsNormalized.y) - gene.creatureFrontTaperSize) / gene.creatureBackTaperSize;
        float circularizeAmount  = Mathf.Max(frontCapLerpAmount, backCapLerpAmount);
        /// **** FIX THIS!! ***  circle coords depend on taper distance?
        float pointCircleCoord       = point.initCoordsNormalized.y * 2f - 1f;               // get normalized coords 0 to 1 to sample circle
        float circleSize             = Mathf.Sqrt(1f - pointCircleCoord * pointCircleCoord); // pythagorean theorem
        float circleWidthMultiplier  = Mathf.Lerp(1f, circleSize, circularizeAmount) * 0.5f; // *0.5 for radius vs. diameter
        float circleHeightMultiplier = Mathf.Lerp(1f, circleSize, circularizeAmount) * 0.5f;

        if (bindPoseY > gene.tailLength)
        {
            if (bindPoseY > gene.bodyLength + gene.tailLength)
            {
                if (bindPoseY > gene.headLength + gene.bodyLength + gene.tailLength)
                {
                    // this point is in the MOUTH Section:
                    float subSectionCoords01 = (bindPoseY - gene.tailLength - gene.bodyLength - gene.headLength) / gene.mouthLength;
                    //float mouthTipBlendLerpAmount = Mathf.Clamp01((gene.mouthEndCapTaperSize * 0.5f - (1f - subSectionCoords01)) / (gene.mouthEndCapTaperSize * 0.5f));
                    float headBlendLerpAmount = Mathf.Clamp01((gene.mouthToHeadTransitionSize * 0.5f - (subSectionCoords01)) / (gene.mouthToHeadTransitionSize * 0.5f)) * 0.5f;

                    float headSectionWidth  = gene.bodyBackWidth;
                    float mouthSectionWidth = Mathf.Lerp(gene.mouthBackWidth, gene.mouthFrontWidth, subSectionCoords01);
                    widthMultiplier = Mathf.Lerp(mouthSectionWidth, headSectionWidth, headBlendLerpAmount);
                    //widthMultiplier = Mathf.Lerp(mult, widthMultiplier, headBlendLerpAmount);
                    //widthMultiplier = Mathf.Lerp(widthMultiplier, 0f, Mathf.Pow(mouthTipBlendLerpAmount, 1f));
                    //widthMultiplier = widthMultiplier * gene.mouthLength;

                    float headSectionHeight  = gene.bodyBackHeight;
                    float mouthSectionHeight = Mathf.Lerp(gene.mouthBackHeight, gene.mouthFrontHeight, subSectionCoords01);
                    heightMultiplier = Mathf.Lerp(mouthSectionHeight, headSectionHeight, headBlendLerpAmount);
                    //heightMultiplier = Mathf.Lerp(heightMultiplier, 0f, Mathf.Pow(mouthTipBlendLerpAmount, 1f));
                    //heightMultiplier = heightMultiplier * gene.mouthLength;

                    if (bindPoseY > segmentsSummedCritterLength)
                    {
                        Debug.LogError($"bindPoseY is {bindPoseY}, which is longer than the creature {segmentsSummedCritterLength}!");
                    }
                }
                else
                {
                    // this point is in the HEAD Section:
                    float subSectionCoords01   = (bindPoseY - gene.tailLength - gene.bodyLength) / gene.headLength;
                    float bodyBlendLerpAmount  = Mathf.Clamp01((gene.headToBodyTransitionSize * 0.5f - subSectionCoords01) / (gene.headToBodyTransitionSize * 0.5f)) * 0.5f;
                    float mouthBlendLerpAmount = Mathf.Clamp01((gene.mouthToHeadTransitionSize * 0.5f - (1f - subSectionCoords01)) / (gene.mouthToHeadTransitionSize * 0.5f)) * 0.5f;

                    float bodySectionWidth  = gene.bodyFrontWidth;
                    float headSectionWidth  = Mathf.Lerp(gene.headBackWidth, gene.headFrontWidth, subSectionCoords01);
                    float mouthSectionWidth = gene.mouthBackWidth;
                    widthMultiplier = Mathf.Lerp(headSectionWidth, bodySectionWidth, bodyBlendLerpAmount);
                    widthMultiplier = Mathf.Lerp(widthMultiplier, mouthSectionWidth, mouthBlendLerpAmount);
                    //widthMultiplier = widthMultiplier * gene.headLength;

                    float bodySectionHeight  = gene.bodyFrontHeight;
                    float headSectionHeight  = Mathf.Lerp(gene.headBackHeight, gene.headFrontHeight, subSectionCoords01);
                    float mouthSectionHeight = gene.mouthBackHeight;
                    heightMultiplier = Mathf.Lerp(headSectionHeight, bodySectionHeight, bodyBlendLerpAmount);
                    heightMultiplier = Mathf.Lerp(heightMultiplier, mouthSectionHeight, mouthBlendLerpAmount);
                    //heightMultiplier = heightMultiplier * gene.headLength;
                }
            }
            else
            {
                // this point is in the BODY Section:
                float subSectionCoords01  = (bindPoseY - gene.tailLength) / gene.bodyLength;
                float tailBlendLerpAmount = Mathf.Clamp01((gene.bodyToTailTransitionSize * 0.5f - subSectionCoords01) / (gene.bodyToTailTransitionSize * 0.5f)) * 0.5f;
                float headBlendLerpAmount = Mathf.Clamp01((gene.headToBodyTransitionSize * 0.5f - (1f - subSectionCoords01)) / (gene.headToBodyTransitionSize * 0.5f)) * 0.5f;

                float tailSectionWidth = gene.tailFrontWidth;
                float bodySectionWidth = Mathf.Lerp(gene.bodyBackWidth, gene.bodyFrontWidth, subSectionCoords01);
                float headSectionWidth = gene.headBackWidth;
                widthMultiplier = Mathf.Lerp(bodySectionWidth, tailSectionWidth, tailBlendLerpAmount);
                widthMultiplier = Mathf.Lerp(widthMultiplier, headSectionWidth, headBlendLerpAmount);
                //widthMultiplier = widthMultiplier * gene.bodyLength;

                float tailSectionHeight = gene.tailFrontHeight;
                float bodySectionHeight = Mathf.Lerp(gene.bodyBackHeight, gene.bodyFrontHeight, subSectionCoords01);
                float headSectionHeight = gene.headBackHeight;
                heightMultiplier = Mathf.Lerp(bodySectionHeight, tailSectionHeight, tailBlendLerpAmount);
                heightMultiplier = Mathf.Lerp(heightMultiplier, headSectionHeight, headBlendLerpAmount);
                //heightMultiplier = heightMultiplier * gene.bodyLength;
            }
        }
        else
        {
            // this point is in the TAIL Section:
            float subSectionCoords01  = bindPoseY / gene.tailLength; // divide by zero if no tail?
            float bodyBlendLerpAmount = Mathf.Clamp01((gene.bodyToTailTransitionSize * 0.5f - (1f - subSectionCoords01)) / (gene.bodyToTailTransitionSize * 0.5f)) * 0.5f;
            //float tailTipBlendLerpAmount = Mathf.Clamp01((gene.tailEndCapTaperSize - subSectionCoords01) / (gene.tailEndCapTaperSize));

            float tailSectionWidth = Mathf.Lerp(gene.tailBackWidth, gene.tailFrontWidth, subSectionCoords01);
            float bodySectionWidth = gene.bodyBackWidth;
            widthMultiplier = Mathf.Lerp(tailSectionWidth, bodySectionWidth, bodyBlendLerpAmount);
            //widthMultiplier = Mathf.Lerp(widthMultiplier, 0f, tailTipBlendLerpAmount);
            //widthMultiplier = widthMultiplier * gene.tailLength;

            float tailSectionHeight = Mathf.Lerp(gene.tailBackHeight, gene.tailFrontHeight, subSectionCoords01);
            float bodySectionHeight = gene.bodyBackHeight;
            heightMultiplier = Mathf.Lerp(tailSectionHeight, bodySectionHeight, bodyBlendLerpAmount);
            //heightMultiplier = Mathf.Lerp(heightMultiplier, 0f, tailTipBlendLerpAmount);
            //heightMultiplier = heightMultiplier * gene.tailLength;
        }

        //Vector2 crossSectionScale = new Vector2(widthMultiplier, heightMultiplier);
        //float crossSectionWidth =

        // Now Body Modifiers are processed:
        float radiusMult = 0f;

        for (int i = 0; i < gene.shapeModifiersList.Count; i++)
        {
            CritterModuleCoreGenome.ShapeModifierData modifierData = gene.shapeModifiersList[i];
            if (modifierData.modifierTypeID == CritterModuleCoreGenome.ShapeModifierType.Extrude)    // extrude
            // Find extrude amount:
            {
                float maskValue = 1f;

                for (int j = 0; j < gene.shapeModifiersList[i].maskIndicesList.Count; j++)
                {
                    int maskIndex = gene.shapeModifiersList[i].maskIndicesList[j];
                    CritterModuleCoreGenome.MaskData maskData = gene.masksList[maskIndex];

                    float rawMaskValue = GetMaskValue(point, maskData);

                    // taper distance?:
                    float taperMask = 1f - Mathf.Clamp01(Mathf.Abs(point.initCoordsNormalized.y - maskData.origin) / modifierData.taperDistance);

                    maskValue *= rawMaskValue * taperMask;
                }
                radiusMult += maskValue * modifierData.amplitude;
                // OLD:
                //float radiusMult = maskValue * modifierData.amplitude + 1f;
                //widthMultiplier *= radiusMult;
                //heightMultiplier *= radiusMult;
            }
        }
        radiusMult        = Mathf.Min(Mathf.Max(radiusMult + 1f, 0.5f), 1.5f);
        widthMultiplier  *= radiusMult;
        heightMultiplier *= radiusMult;


        widthMultiplier  *= circleWidthMultiplier; // this includes * 0.5f from earlier to account for radius vs diameter
        heightMultiplier *= circleHeightMultiplier;

        // simplify round:

        /*
         * float pointCircleCoord = point.initCoordsNormalized.y * 2f - 1f; // get normalized coords 0 to 1 to sample circle
         * float circleWidthMultiplier = Mathf.Sqrt(1f - pointCircleCoord * pointCircleCoord);  // pythagorean theorem
         *
         * float frontCapLerpAmount = Mathf.Clamp01(point.initCoordsNormalized.y - gene.creatureFrontTaperSize) * 2f;
         * float backCapLerpAmount = Mathf.Clamp01((1f - point.initCoordsNormalized.y) - gene.creatureFrontTaperSize) * 2f;
         * float circularizeAmount = Mathf.Max(frontCapLerpAmount, backCapLerpAmount);
         *
         * widthMultiplier = Mathf.Lerp(widthMultiplier, circleWidthMultiplier, circularizeAmount) * 0.5f;  // *0.5 for radius vs. diameter
         * heightMultiplier = Mathf.Lerp(heightMultiplier, circleWidthMultiplier, circularizeAmount) * 0.5f;
         */

        float finalCreatureLength    = segmentsSummedCritterLength * gene.creatureBaseLength;
        float finalCreatureThickness = gene.creatureAspectRatio * finalCreatureLength;

        point.bindPos = new Vector3(point.initCoordsNormalized.x * widthMultiplier * finalCreatureThickness, point.initCoordsNormalized.y * finalCreatureLength - finalCreatureLength * 0.5f, point.initCoordsNormalized.z * heightMultiplier * finalCreatureThickness);
    }
Пример #4
0
    //CritterModuleFoodSensorsGenome foodGenome;

    // * WPP: break code sections into methods, call from here
    private void UpdateUI()
    {
        if (!agent)
        {
            return;
        }

        agentIndex      = agent.index;
        candidate       = agent.candidateRef;
        coreModule      = agent.coreModule;
        brain           = agent.brain;
        candidateGenome = candidate.candidateGenome;
        brainGenome     = candidateGenome.brainGenome;
        bodyGenome      = candidateGenome.bodyGenome;
        coreGenome      = bodyGenome.coreGenome;
        foodModule      = agent.foodModule;
        movementModule  = agent.movementModule;
        //foodGenome = bodyGenome.foodGenome;

        if (!agent.isInert)
        {
            // DebugTxt1 : use this for selected creature stats:
            int curCount = 0;
            int maxCount = 1;
            if (agent.isEgg)
            {
                curCount = agent.lifeStageTransitionTimeStepCounter;
                maxCount = agent.gestationDurationTimeSteps;
            }
            if (agent.isMature)
            {
                curCount = agent.ageCounter;
                maxCount = agent.maxAgeTimeSteps;
            }
            if (agent.isDead)
            {
                curCount = agent.lifeStageTransitionTimeStepCounter;
                maxCount = curCount; // agentRef._DecayDurationTimeSteps;
            }
            int    progressPercent      = Mathf.RoundToInt((float)curCount / (float)maxCount * 100f);
            string lifeStageProgressTxt = " " + agent.curLifeStage + " " + curCount + "/" + maxCount + "  " + progressPercent + "% ";

            // &&&& INDIVIDUAL AGENT: &&&&
            string debugTxtAgent = "";
            debugTxtAgent += "CRITTER# [" + agentIndex + "]     SPECIES# [" + agent.speciesIndex + "]\n\n";
            // Init Attributes:
            // Body:
            debugTxtAgent += "Base Size: " + coreGenome.creatureBaseLength.ToString("F2") + ",  Aspect: " + coreGenome.creatureAspectRatio.ToString("F2") + "\n";
            debugTxtAgent += "Fullsize Dimensions: ( " + agent.fullSizeBoundingBox.x.ToString("F2") + ", " + agent.fullSizeBoundingBox.y.ToString("F2") + ", " + agent.fullSizeBoundingBox.z.ToString("F2") + " )\n";
            debugTxtAgent += "BONUS - Damage: " + coreModule.damageBonus.ToString("F2") + ", Speed: " + coreModule.speedBonus.ToString("F2") + ", Health: " + coreModule.healthBonus.ToString("F2") + ", Energy: " + coreModule.energyBonus.ToString("F2") + "\n";
            debugTxtAgent += "DIET - Decay: " + coreModule.digestEfficiencyDecay.ToString("F2") + ", Plant: " + coreModule.digestEfficiencyPlant.ToString("F2") + ", Meat: " + coreModule.digestEfficiencyMeat.ToString("F2") + "\n";
            //string mouthType = "Active";
            //if (agentRef.mouthRef.isPassive) { mouthType = "Passive"; }
            //debugTxtAgent += "Mouth: [" + mouthType + "]\n";
            debugTxtAgent += "# Neurons: " + brain.neurons.Count + ", # Axons: " + brain.axons.Count + "\n";
            debugTxtAgent += "# In/Out Nodes: " + brainGenome.inOutNeurons.Count + ", # Hidden Nodes: " + brainGenome.hiddenNeurons.Count + ", # Links: " + brainGenome.links.Count + "\n";

            debugTxtAgent += "\nSENSORS:\n";
            debugTxtAgent += "Comms= " + bodyGenome.data.hasComms + "\n";
            debugTxtAgent += "Enviro: WaterStats: " + bodyGenome.data.useWaterStats + ", Cardinals= " + bodyGenome.data.useCardinals + ", Diagonals= " + bodyGenome.data.useDiagonals + "\n";
            //debugTxtAgent += "Food: Nutrients= " + foodGenome.useNutrients + ", Pos= " + foodGenome.usePos + ",  Dir= " + foodGenome.useDir + ",  Stats= " + foodGenome.useStats + ", useEggs: " + foodGenome.useEggs + ", useCorpse: " + foodGenome.useCorpse + "\n";
            //debugTxtAgent += "Friend: Pos= " + bodyGenome.friendGenome.usePos + ",  Dir= " + bodyGenome.friendGenome.useDir + ",  Vel= " + bodyGenome.friendGenome.useVel + "\n";
            //debugTxtAgent += "Threat: Pos= " + bodyGenome.threatGenome.usePos + ",  Dir= " + bodyGenome.threatGenome.useDir + ",  Vel= " + bodyGenome.threatGenome.useVel + ",  Stats= " + bodyGenome.threatGenome.useStats + "\n";
            // Realtime Values:
            debugTxtAgent += "\nREALTIME DATA:";
            //debugTxtAgent += "\nExp: " + agentRef.totalExperience.ToString("F2") + ",  fitnessScore: " + agentRef.masterFitnessScore.ToString("F2") + ", LVL: " + agentRef.curLevel.ToString();
            debugTxtAgent += "\n(" + lifeStageProgressTxt + ") Growth: " + (agent.sizePercentage * 100f).ToString("F0") + "%, Age: " + agent.ageCounter + " Frames\n\n";

            debugTxtAgent += "Nearest Food: [" + foodModule.nearestFoodParticleIndex +
                             "] Amount: " + foodModule.nearestFoodParticleAmount.ToString("F4") +
                             "\nPos: ( " + foodModule.nearestFoodParticlePos.x.ToString("F2") +
                             ", " + foodModule.nearestFoodParticlePos.y.ToString("F2") +
                             " ), Dir: ( " + foodModule.foodPlantDirX[0].ToString("F2") +
                             ", " + foodModule.foodPlantDirY[0].ToString("F2") + " )" +
                             "\n";
            debugTxtAgent += "\nNutrients: " + foodModule.nutrientDensity[0].ToString("F4") + ", Stamina: " + coreModule.stamina[0].ToString("F3") + "\n";
            debugTxtAgent += "Gradient Dir: (" + foodModule.nutrientGradX[0].ToString("F2") + ", " + foodModule.nutrientGradY[0].ToString("F2") + ")\n";
            //debugTxtAgent += "Total Food Eaten -- Decay: n/a, Plant: " + agentRef.totalFoodEatenPlant.ToString("F2") + ", Meat: " + agentRef.totalFoodEatenZoop.ToString("F2") + "\nFood Stored: " + agentRef.coreModule.foodStored[0].ToString() + ", Corpse Food Amount: " + agentRef.currentBiomass.ToString("F3") + "\n";

            //debugTxtAgent += "\nFullSize: " + agentRef.fullSizeBoundingBox.ToString() + ", Volume: " + agentRef.fullSizeBodyVolume.ToString() + "\n";
            //debugTxtAgent += "( " + (agentRef.sizePercentage * 100f).ToString("F0") + "% )\n";

            debugTxtAgent += "\nCurVel: " + agent.curVel.ToString("F3") + ", CurAccel: " + agent.curAccel.ToString("F3") + ", AvgVel: " + agent.avgVel.ToString("F3") + "\n";

            debugTxtAgent += "\nWater Depth: " + agent.waterDepth.ToString("F3") + ", Vel: " + (agent.avgFluidVel * 10f).ToString("F3") + "\n";
            debugTxtAgent += "Throttle: [ " + movementModule.throttleX[0].ToString("F3") + ", " + movementModule.throttleY[0].ToString("F3") + " ]\n";
            debugTxtAgent += "FeedEffector: " + coreModule.mouthFeedEffector[0].ToString("F2") + "\n";
            debugTxtAgent += "AttackEffector: " + coreModule.mouthAttackEffector[0].ToString("F2") + "\n";
            debugTxtAgent += "DefendEffector: " + coreModule.defendEffector[0].ToString("F2") + "\n";
            debugTxtAgent += "DashEffector: " + coreModule.dashEffector[0].ToString("F2") + "\n";
            debugTxtAgent += "HealEffector: " + coreModule.healEffector[0].ToString("F2") + "\n";

            //+++++++++++++++++++++++++++++++++++++ CRITTER: ++++++++++++++++++++++++++++++++++++++++++++
            string debugTxtGlobalSim = "";
            debugTxtGlobalSim += "\n\nNumChildrenBorn: " + simulation.numAgentsBorn + ", numDied: " + simulation.numAgentsDied + ", ~Gen: " + ((float)simulation.numAgentsBorn / (float)simulation.numAgents);
            debugTxtGlobalSim += "\nSimulation Age: " + simulation.simAgeTimeSteps;
            debugTxtGlobalSim += "\nYear " + simulation.curSimYear + "\n\n";
            int numActiveSpecies = masterGenomePool.currentlyActiveSpeciesIDList.Count;
            debugTxtGlobalSim += numActiveSpecies + " Active Species:\n";

            for (int s = 0; s < numActiveSpecies; s++)
            {
                int speciesID = masterGenomePool.currentlyActiveSpeciesIDList[s];
                //int parentSpeciesID = simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].parentSpeciesID;
                int numCandidates = masterGenomePool.completeSpeciesPoolsList[speciesID].candidateGenomesList.Count;
                int numLeaders    = masterGenomePool.completeSpeciesPoolsList[speciesID].leaderboardGenomesList.Count;
                //int numBorn = simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].numAgentsEvaluated;
                int speciesPopSize = 0;
                //float avgFitness = simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgPerformanceData.totalTicksAlive;
                for (int a = 0; a < simulation.numAgents; a++)
                {
                    if (simulation.agents[a].speciesIndex == speciesID)
                    {
                        speciesPopSize++;
                    }
                }
                if (masterGenomePool.completeSpeciesPoolsList[speciesID].isFlaggedForExtinction)
                {
                    debugTxtGlobalSim += "xxx ";
                }

                /*debugTxtGlobalSim += "Species[" + speciesID.ToString() + "] p(" + parentSpeciesID.ToString() + "), size: " + speciesPopSize.ToString() + ", #cands: " + numCandidates.ToString() + ", numEvals: " + numBorn.ToString() +
                 *           ",   avgFitness: " + avgFitness.ToString("F2") +
                 *           ",   avgConsumption: (" + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodEatenCorpse.ToString("F4") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodEatenPlant.ToString("F4") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodEatenZoop.ToString("F4") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodEatenEgg.ToString("F4") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodEatenCreature.ToString("F4") +
                 *           "),   avgBodySize: " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgBodySize.ToString("F3") +
                 *           ",   avgTalentSpec: (" + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgSpecAttack.ToString("F2") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgSpecDefend.ToString("F2") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgSpecSpeed.ToString("F2") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgSpecUtility.ToString("F2") +
                 *           "),   avgDiet: (" + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodSpecDecay.ToString("F2") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodSpecPlant.ToString("F2") + ", " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFoodSpecMeat.ToString("F2") +
                 *           "),   avgNumNeurons: " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgNumNeurons.ToString("F1") +
                 *           ",   avgNumAxons: " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgNumAxons.ToString("F1") +
                 *           ", total: " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgFitnessScore.ToString("F2") +
                 *           ", avgExp: " + simManager.masterGenomePool.completeSpeciesPoolsList[speciesID].avgExperience.ToString() + "\n\n";*/
            }

            /*debugTxtGlobalSim += "\n\nAll-Time Species List:\n";
             * for (int p = 0; p < simManager.masterGenomePool.completeSpeciesPoolsList.Count; p++) {
             *  string extString = "Active!";
             *  if (simManager.masterGenomePool.completeSpeciesPoolsList[p].isExtinct) {
             *      extString = "Extinct!";
             *  }
             *  debugTxtGlobalSim += "Species[" + p.ToString() + "] p(" + simManager.masterGenomePool.completeSpeciesPoolsList[p].parentSpeciesID.ToString() + ") " + extString + "\n";
             * }*/

            textDebugTrainingInfo1.text = debugTxtAgent;
            textDebugTrainingInfo3.text = debugTxtGlobalSim;
        }

        string debugTxtResources = "";

        debugTxtResources += "GLOBAL RESOURCES:\n";
        debugTxtResources += "\nSunlight: " + environmentSettings._BaseSolarEnergy;
        debugTxtResources += "\nOxygen: " + simResourceManager.curGlobalOxygen;
        debugTxtResources += "\n     + " + simResourceManager.oxygenProducedByAlgaeReservoirLastFrame + " ( algae reservoir )";
        debugTxtResources += "\n     + " + simResourceManager.oxygenProducedByPlantParticlesLastFrame + " ( algae particles )";
        debugTxtResources += "\n     - " + simResourceManager.oxygenUsedByDecomposersLastFrame + " ( decomposers )";
        debugTxtResources += "\n     - " + simResourceManager.oxygenUsedByAnimalParticlesLastFrame + " ( zooplankton )";
        debugTxtResources += "\n     - " + simResourceManager.oxygenUsedByAgentsLastFrame + " ( agents )";
        debugTxtResources += "\nNutrients: " + simResourceManager.curGlobalNutrients;
        debugTxtResources += "\n     + " + simResourceManager.nutrientsProducedByDecomposersLastFrame + " ( decomposers )";
        debugTxtResources += "\n     - " + simResourceManager.nutrientsUsedByAlgaeReservoirLastFrame + " ( algae reservoir )";
        debugTxtResources += "\n     - " + simResourceManager.nutrientsUsedByPlantParticlesLastFrame + " ( algae particles )";
        debugTxtResources += "\nDetritus: " + simResourceManager.curGlobalDetritus;
        debugTxtResources += "\n     + " + simResourceManager.wasteProducedByAlgaeReservoirLastFrame + " ( algae reservoir )";
        debugTxtResources += "\n     + " + simResourceManager.wasteProducedByPlantParticlesLastFrame + " ( algae particles )";
        debugTxtResources += "\n     + " + simResourceManager.wasteProducedByAnimalParticlesLastFrame + " ( zooplankton )";
        debugTxtResources += "\n     + " + simResourceManager.wasteProducedByAgentsLastFrame + " ( agents )";
        debugTxtResources += "\n     - " + simResourceManager.detritusRemovedByDecomposersLastFrame + " ( decomposers )";
        debugTxtResources += "\nDecomposers: " + simResourceManager.curGlobalDecomposers;
        debugTxtResources += "\nAlgae (Reservoir): " + simResourceManager.curGlobalAlgaeReservoir;
        debugTxtResources += "\nAlgae (Particles): " + simResourceManager.curGlobalPlantParticles;
        debugTxtResources += "\nZooplankton: " + simResourceManager.curGlobalAnimalParticles;
        debugTxtResources += "\nLive Agents: " + simResourceManager.curGlobalAgentBiomass;
        debugTxtResources += "\nDead Agents: " + simResourceManager.curGlobalCarrionVolume;
        debugTxtResources += "\nEggSacks: " + simResourceManager.curGlobalEggSackVolume;
        debugTxtResources += "\nGlobal Mass: " + simResourceManager.curTotalMass;
        Vector4 resourceGridSample = simulation.SampleTexture(vegetationManager.resourceGridRT1, theCursorCzar.curMousePositionOnWaterPlane / SimulationManager._MapSize);
        Vector4 simTansferSample   = simulation.SampleTexture(vegetationManager.resourceSimTransferRT, theCursorCzar.curMousePositionOnWaterPlane / SimulationManager._MapSize) * 100f;

        //Debug.Log("curMousePositionOnWaterPlane: " + curMousePositionOnWaterPlane.ToString());
        debugTxtResources += "\nresourceGridSample: (" + resourceGridSample.x.ToString("F4") + ", " + resourceGridSample.y.ToString("F4") + ", " + resourceGridSample.z.ToString("F4") + ", " + resourceGridSample.w.ToString("F4") + ")";
        debugTxtResources += "\nsimTansferSample: (" + simTansferSample.x.ToString("F4") + ", " + simTansferSample.y.ToString("F4") + ", " + simTansferSample.z.ToString("F4") + ", " + simTansferSample.w.ToString("F4") + ")";

        textDebugTrainingInfo2.text = debugTxtResources;

        if (debugTextureViewerArray == null)
        {
            CreateDebugRenderViewerArray();
        }

        debugTextureViewerMat.SetPass(0);
        debugTextureViewerMat.SetVector("_Zoom", _Zoom);
        debugTextureViewerMat.SetFloat("_Amplitude", _Amplitude);
        debugTextureViewerMat.SetVector("_ChannelMask", _ChannelMask);
        debugTextureViewerMat.SetInt("_ChannelSoloIndex", _ChannelSoloIndex);
        debugTextureViewerMat.SetFloat("_IsChannelSolo", _IsChannelSolo);
        debugTextureViewerMat.SetFloat("_Gamma", _Gamma);
        //debugTextureViewerMat.
        if (debugTextureViewerArray[_DebugTextureIndex])
        {
            debugTextureViewerMat.SetTexture("_MainTex", debugTextureViewerArray[_DebugTextureIndex]);
            int      channelID       = 4;
            string[] channelLabelTxt = new string[5];
            channelLabelTxt[0] = " (X Solo)";
            channelLabelTxt[1] = " (Y Solo)";
            channelLabelTxt[2] = " (Z Solo)";
            channelLabelTxt[3] = " (W Solo)";
            channelLabelTxt[4] = " (Color)";
            if (_IsChannelSolo > 0.5f)
            {
                channelID = _ChannelSoloIndex;
            }
            textDebugTextureName.text = debugTextureViewerArray[_DebugTextureIndex].name + channelLabelTxt[channelID];
        }

        textDebugTextureZoomX.text            = _Zoom.x.ToString();
        textDebugTextureZoomY.text            = _Zoom.y.ToString();
        textDebugTextureAmplitude.text        = _Amplitude.ToString();
        textDebugTextureSoloChannelIndex.text = _ChannelSoloIndex.ToString();
        textDebugTextureGamma.text            = _Gamma.ToString();
    }
Пример #5
0
 /// Reconstructs all modules as new
 public void FirstTimeInitializeCritterModuleGenomes()
 {
     appearanceGenome = new CritterModuleAppearanceGenome();
     coreGenome       = new CritterModuleCoreGenome();
 }