Esempio n. 1
0
 // Mutable by Player
 // Add body-sensor/effector mutations here and cleanup Brain Genome
 void SetToMutatedCopyOfParentGenome(BodyGenome parent, MutationSettingsInstance settings)
 {
     appearanceGenome.SetToMutatedCopyOfParentGenome(parent.appearanceGenome, settings);
     coreGenome.SetToMutatedCopyOfParentGenome(parent.coreGenome, settings);
     unlockedTech            = unlockedTech.GetMutatedCopy();
     newlyUnlockedNeuronInfo = GetNewlyUnlockedNeurons(parent);
 }
Esempio n. 2
0
    public BodyGenome(BodyGenome parentGenome, MutationSettingsInstance mutationSettings)
    {
        unlockedTech = new UnlockedTech(parentGenome.unlockedTech);
        data         = new BodyGenomeData(unlockedTech);

        FirstTimeInitializeCritterModuleGenomes();
        SetToMutatedCopyOfParentGenome(parentGenome, mutationSettings);
    }
Esempio n. 3
0
    /// Deep copy
    public UnlockedTech(UnlockedTech original)
    {
        values = new List <TechElement>();

        for (int i = 0; i < original.values.Count; i++)
        {
            values.Add(original.values[i]);
        }
    }
Esempio n. 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            TileTexture[(int)Listof_Texture.Grass]      = Content.Load <Texture2D>("Grass");
            TileTexture[(int)Listof_Texture.CityCenter] = Content.Load <Texture2D>("Tile");
            TileTexture[(int)Listof_Texture.Panel1]     = Content.Load <Texture2D>("Panel1");
            TileTexture[(int)Listof_Texture.Button1]    = Content.Load <Texture2D>("Button1");

            TileTexture[(int)Listof_Texture.Road] = Content.Load <Texture2D>("Road1");

            TileTexture[(int)Listof_Texture.Residential] = Content.Load <Texture2D>("Residential");
            TileTexture[(int)Listof_Texture.Commercial]  = Content.Load <Texture2D>("Commercial");
            TileTexture[(int)Listof_Texture.Industrial]  = Content.Load <Texture2D>("Industrial");

            TileTexture[(int)Listof_Texture.Residential_Structure] = Content.Load <Texture2D>("Residential_1");
            TileTexture[(int)Listof_Texture.Commercial_Structure]  = Content.Load <Texture2D>("Commercial_1");
            TileTexture[(int)Listof_Texture.Industrial_Structure]  = Content.Load <Texture2D>("Industrial_1");


            TileTexture[(int)Listof_Texture.Construction] = Content.Load <Texture2D>("Construction1");

            TileTexture[(int)Listof_Texture.PowerPlant1] = Content.Load <Texture2D>("PowerPlant_2");

            TileTexture[(int)Listof_Texture.School1] = Content.Load <Texture2D>("School_1");

            TileTexture[(int)Listof_Texture.ButtonIcons] = Content.Load <Texture2D>("BuildingIcons");



            model     = Content.Load <Model>("CityCenter");
            model2    = Content.Load <Model>("Tower1");
            basicfont = Content.Load <SpriteFont>("romulus");

            _interface = new Interface(Screen_Size);
            _e         = new Encyclopedia();
            _city      = new City(new Point(200, 200), _e);
            _t         = new Tech();

            spriteBatch = new SpriteBatch(GraphicsDevice);


            for (int x = 0; x < Enum.GetNames(typeof(Listof_TechItems)).Length; x++)
            {
                UnlockedTech.Add((Listof_TechItems)x);
            }

            for (int x = 0; x < Enum.GetNames(typeof(Listof_BuildTabCategories)).Length; x++)
            {
                BuildTech.Add((Listof_BuildTabCategories)x, new HashSet <int>());
            }



            // TODO: use this.Content to load your game content here
        }
Esempio n. 5
0
    public BodyGenomeData(UnlockedTech unlockedTech)
    {
        this.unlockedTech = unlockedTech;

        hasComms         = HasTech(TechElementId.OutComms01);
        hasAnimalSensor  = HasTech(TechElementId.Social);
        useWaterStats    = HasTech(TechElementId.Water);
        useCardinals     = HasTech(TechElementId.CorpseDist);
        useDiagonals     = HasTech(TechElementId.CorpseVel);
        useNutrients     = HasTech(TechElementId.Nutrients);
        useFoodPosition  = HasTech(TechElementId.MicrobesDir);
        useFoodVelocity  = HasTech(TechElementId.PlantsVel);
        useFoodDirection = HasTech(TechElementId.PlantsDir); //***EAC CHANGE THIS!!
        useFoodStats     = HasTech(TechElementId.FoodSensors);
        useEggs          = HasTech(TechElementId.EggDir);
        useCorpse        = HasTech(TechElementId.CorpseDir);
    }
Esempio n. 6
0
    public UnlockedTech GetMutatedCopy()
    {
        var copy    = new UnlockedTech(this);
        var removed = new List <TechElement>();
        var added   = new List <TechElement>();

        // Random chance of removing a tech if it is not the prerequisite of some other tech the agent has.
        foreach (var value in values)
        {
            if (!value.IsPrerequisite(values) && RandomStatics.CoinToss(value.mutationLockChance))
            {
                removed.Add(value);
            }
        }

        foreach (var remove in removed)
        {
            values.Remove(remove);
        }

        // Random chance of adding a tech if its prerequisite is met and the agent doesn't already have it.
        foreach (var value in values)
        {
            foreach (var tech in value.nextTech)
            {
                if (RandomStatics.CoinToss(tech.mutationUnlockChance) && !values.Contains(tech))
                {
                    added.Add(tech);
                }
            }
        }

        foreach (var add in added)
        {
            copy.values.Add(add);
        }

        return(copy);
    }