Exemplo n.º 1
0
    /// <summary>
    /// saves all information that the user entered into the menu
    /// </summary>
    public void saveSettings()
    {
        // TODO : covert HelperSetter to ValidationHelper
        StringFunct setEcoName       = new StringFunct(ecoEditor.setName);
        bool        a                = HelperValidator.setName(ecoNameTextBox, errorObj, setEcoName);
        IntFunct    setAPPC          = new IntFunct(ecoEditor.setAbilityPointsPerCreature);
        bool        b                = HelperValidator.setIntegerFunct(abilityPtsPerCreatTextBox, setAPPC, errorObj);
        IntFunct    setCommBits      = new IntFunct(ecoEditor.setCommBits);
        bool        c                = HelperValidator.setIntegerFunct(commBitsText, setCommBits, errorObj);
        IntFunct    setDistinctPheno = new IntFunct(ecoEditor.setDistinctPhenotypeNum);
        bool        d                = HelperValidator.setIntegerFunct(distinctPhenoText, setDistinctPheno, errorObj);

        // saves tentative resource options to Ecosystem object
        ecoEditor.saveResourceOptions();

        // TODO : don't forget to call EcosystemEditor save methods


        /** call methods to save ecoEditor data to actual Ecosystem object **/

        // saves tentative resource options to Ecosystem object
        ecoEditor.saveResourceOptions();

        ecoEditor.saveFoundersToSpecies();

        ecoEditor.addCurrentPopulationToEcosystem();

        ecoEditor.saveMap();
    }
Exemplo n.º 2
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.º 3
0
    /*
     * Create populator (with population),
     * set population parameters
     * generate population
     * saves population and adds it to list of populations
     * adds population to map, and saves map
     * */
    public void populateSpecies(string name, float populationDeviation, int popSize, int maxPopSize)
    {
        SpeciesPopulator populator = ecoCreator.populateSpecies(name);

        populator.SetAbilityStandardDeviation(1);
        populator.setNetworkWeightStandardDeviation(populationDeviation);
        populator.setMaxPopSize(maxPopSize);
        populator.populateRandom(popSize);
        ecoCreator.saveCurrentPopulation();
        ecoCreator.addCurrentPopulationToEcosystem();
        ecoCreator.addCurrentPopulationToMap();
        ecoCreator.saveMap(); // need to save updated tentative map

        // TODO: Include system for saving a temporary map to the actual map.
        // this applies to both the MapEditor, and SpeciesPopulator.
    }
Exemplo n.º 4
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
    }