Exemplo n.º 1
0
    /*
     * set ecosystem parameters,
     * create resources,
     * create map,
     * add resource to map
     * */
    public void createEcosystem(int mapWidth)
    {
        ecosystem = new Ecosystem();

        ecoCreator = new EcosystemEditor(ecosystem);

        // set basic ecosystem parameters
        EcoCreationHelper.setEcoParams(ecoCreator, 10, 32, 50, true, false, false);

        // create grass
        EcoCreationHelper.addResource(ecoCreator, "energy", 200, 250, 1, .5f, 8f);
        ecoCreator.saveResource();


        EcoCreationHelper.addResource(ecoCreator, "vitamin", 1f, 20, 1, .1f, 1f);
        ecoCreator.saveResource();

        ecoCreator.saveResourceOptions(); // adds all resources to ecosystem resources


        // generate map
        ecoCreator.createMap();
        // TODO: account for asymetric maps
        ecoCreator.mapEditor.generateMap(mapWidth, mapWidth);
        // islands: 300, .8, 50, 30
        // barriers: 300, .8, 100, 30 (creature pop 2000 for barely survive)
        //ecoCreator.mapEditor.addClusteredResource("grass", 1f, 100, 30);
        ecoCreator.mapEditor.addLERPXResource("energy", 1f);
        ecoCreator.mapEditor.addUniformResource("vitamin", .5f);
        ecoCreator.saveEditedMap(); // saves to tentative map
        ecoCreator.saveMap();       // saves to ecosystem map
    }
Exemplo n.º 2
0
    /// <summary>
    /// load the creature editor menu using the ecosystem editor
    /// </summary>
    public void loadLandResMenu(EcosystemEditor ee)
    {
        ecoEditor = ee;

        uIParent.SetActive(true);

        //TODO: load information into menu from prev created resource
    }
Exemplo n.º 3
0
    /// <summary>
    /// load the creature editor menu using the ecosystem editor
    /// </summary>
    public void loadCreatMenu(EcosystemEditor ec)
    {
        ecoCreator      = ec;
        creatureCreator = ec.creatureCreator;
        uIParent.SetActive(true);

        //TODO: load information into menu from prev created creature
    }
Exemplo n.º 4
0
    /// <summary>
    /// Set basic parameters for entire ecosystem.
    /// </summary>
    /// <param name="ecoEditor">Ecosystem wrapper.</param>
    /// <param name="abilityPtsPerCreat">The maximum number of ability points that each creature is alloted (gives creatures the capacity to perform certain actions better).</param>
    /// <param name="commBits">The number of communication bits per creature (not currently in use).</param>
    /// <param name="renewInterval">The number of steps between each renewal of all resources on all Lands.</param>
    /// <param name="uniformRenewal">Renew resources across entire map.</param>
    /// <param name="clusterRenewal">Only renew resources in the clusters in which they were created (if using clusters to distribute).</param>
    /// <param name="useClusterColors">Indicated whether or not to use K-Means to cluster into 3 groups, associated with red, green, and blue</param>

    public static void setEcoParams(EcosystemEditor ecoEditor, int abilityPtsPerCreat, int commBits,
                                    int renewInterval, bool uniformRenewal, bool clusterRenewal, bool useClusterColors)
    {
        ecoEditor.setAbilityPointsPerCreature(10);
        ecoEditor.setCommBits(4);
        ecoEditor.setDistinctPhenotypeNum(4);
        ecoEditor.setRenewInterval(50);
        ecoEditor.setUniformRenewal(uniformRenewal);
        ecoEditor.setClusterRenewal(clusterRenewal);
        ecoEditor.setUseClusterColors(useClusterColors);
    }
Exemplo n.º 5
0
    /// <summary>
    /// Add resource to be stored on Land spaces.
    /// </summary>
    /// <param name="ecoEditor">Wrapper for ecosystem.</param>
    /// <param name="name">Name of resource. Use this same name when creating creature resources.</param>
    /// <param name="initialAmt">Initial amount stored on a Land. Note: this parameter may be ignored by MapEditor when distributing the resource.</param>
    /// <param name="maxAmt">Max amount stored on a Land.</param>
    /// <param name="consumedPerTime">Amount of the resource consumed per unit of time.</param>
    /// <param name="proportionExtract">Proportion of the amount consumed that is actually extracted. This proportion is modified by the creature's ability to extract this resource.</param>
    /// <param name="renewAmt">The amount of the resource renewed every renew interval (see setEcoParams).</param>
    public static void addResource(EcosystemEditor ecoEditor, string name, float initialAmt, float maxAmt,
                                   float consumedPerTime, float proportionExtract, float renewAmt)
    {
        LandResourceEditor lre = ecoEditor.addResource(name);

        lre.setAmountOfResource(initialAmt);
        lre.setMaxAmt(maxAmt);
        lre.setAmtConsumedPerTime(consumedPerTime);
        lre.setProportionExtracted(proportionExtract); // higher proportion extracted for primary resources
        lre.setRenewalAmt(renewAmt);
    }
    /// <summary>
    /// Constructor
    /// </summary>
    public CreatureEditor(Creature creature, EcosystemEditor ecoCreator)
    {
        this.creature = creature;
        initializeNetworkStructure();
        this.distinctPhenotypes = ecoCreator.ecosystem.distictPhenotypes;
        this.ecoCreator         = ecoCreator;
        tentativeAbilities      = new Dictionary <string, Ability>();

        // copy abilities in from creature
        foreach (string ability in creature.abilities.Keys)
        {
            tentativeAbilities[ability] = creature.abilities[ability];
        }
    }
Exemplo n.º 7
0
    /*
     * set ecosystem parameters,
     * create resources,
     * create map,
     * add resource to map
     * */
    public void createEcosystem(int mapWidth)
    {
        ecosystem = new Ecosystem();

        ecoCreator = new EcosystemEditor(ecosystem);
        // set basic ecosystem parameters
        EcoCreationHelper.setEcoParams(ecoCreator, 10, 4, 50, false, true, false);

        // create resources A, B, and C
        EcoCreationHelper.addResource(ecoCreator, "A", 100, 150, 10, .4f, 1f);
        ecoCreator.saveResource();

        EcoCreationHelper.addResource(ecoCreator, "B", 100, 150, 10, .4f, 1f);
        ecoCreator.saveResource();


        EcoCreationHelper.addResource(ecoCreator, "C", 100, 150, 10, .2f, 0); // not renewed
        ecoCreator.saveResource();

        EcoCreationHelper.addResource(ecoCreator, "D", 100, 150, 10, .2f, 0); // not renewed
        ecoCreator.saveResource();

        ecoCreator.saveResourceOptions(); // adds all resources to ecosystem resources

        // generate map
        ecoCreator.createMap();
        // max size ~ 320 X 320 (100,000 cells)
        // TODO: account for asymetric maps
        ecoCreator.mapEditor.generateMap(mapWidth, mapWidth);
        ecoCreator.mapEditor.addClusteredResource("A", .8f, 100, 30);
        ecoCreator.mapEditor.addClusteredResource("B", .8f, 100, 30);
        // small starting amount of B and C
        ecoCreator.mapEditor.addUniformResource("C", .2f);
        ecoCreator.mapEditor.addUniformResource("D", .2f);
        ecoCreator.saveEditedMap(); // saves to tentative map
        ecoCreator.saveMap();       // saves to ecosystem map
    }
Exemplo n.º 8
0
 /// <summary>
 /// creates an ecosystem creator from the provided ecosystem
 /// </summary>
 public void loadEcoMenu(Ecosystem eco)
 {
     ecoEditor = new EcosystemEditor(eco);
     uIParent.SetActive(true);
     // TODO: properly populate menu from eco data
 }