Platform Setup (Developer) - UM-LPM/GIANT GitHub Wiki
The platform consists of three parts: Unity, Web API, and EARS framework. To set up the platform follow the instructions listed below for each component.
- Install Unity Hub from the official website.
- From the Unity Hub install the Unity LTS version for 2022 or higher.
- Clone the repository on your local machine from the GitHub.
- Add and open the cloned project in the Unity Hub.
- Configure Unity Editor (Edit -> Project Settings -> Physics) if the settings don't match the ones displayed in the image below.
-
To test run the Unity setup, navigate to Assets -> Problem Domains -> Robostrike and open RobostrikeBaseScene and in your API platform of choice create the following request:
POST request to: http://localhost:4000 { "EvalEnvInstances": ["http://localhost:4444/"], "EvalRangeStart": 0, "EvalRangeEnd": 2 }
-
The response from the request should look something like this:
{ "IndividualFitnesses": [ { "IndividualID": 0, "Value": -1.0, "IndividualMatchResults": [ { "OpponentsIDs": [ 1 ], "MatchName": "0_RobostrikeGameScene_RobostrikeAgentScene_e69e2f5d-181e-43ed-9d35-9b30ac970d26", "Value": -15.1665993, "IndividualValues": { "SectorExploration": -2.6666, "SurvivalBonus": -10.0, "PowerUp_Pickup_Shield": -2.5 } }, { "OpponentsIDs": [ 1 ], "MatchName": "0_RobostrikeGameScene_RobostrikeAgentScene_e58332d9-5300-471d-b3ba-9635a7ba7b6d", "Value": -15.1665993, "IndividualValues": { "SectorExploration": -2.6666, "PowerUp_Pickup_Shield": -2.5, "SurvivalBonus": -10.0 } } ], "AvgMatchResult": { "OpponentsIDs": null, "MatchName": "Avg Match Result", "Value": 0.0, "IndividualValues": { "SectorExploration": -2.6666, "SurvivalBonus": -10.0, "PowerUp_Pickup_Shield": -2.5 } }, "AdditionalValues": null }, { "IndividualID": 1, "Value": 0.0, "IndividualMatchResults": [ { "OpponentsIDs": [ 0 ], "MatchName": "0_RobostrikeGameScene_RobostrikeAgentScene_e69e2f5d-181e-43ed-9d35-9b30ac970d26", "Value": -15.1665993, "IndividualValues": { "SectorExploration": -2.6666, "PowerUp_Pickup_Shield": -2.5, "SurvivalBonus": -10.0 } }, { "OpponentsIDs": [ 0 ], "MatchName": "0_RobostrikeGameScene_RobostrikeAgentScene_e58332d9-5300-471d-b3ba-9635a7ba7b6d", "Value": -15.1665993, "IndividualValues": { "SectorExploration": -2.6666, "SurvivalBonus": -10.0, "PowerUp_Pickup_Shield": -2.5 } } ], "AvgMatchResult": { "OpponentsIDs": null, "MatchName": "Avg Match Result", "Value": 0.0, "IndividualValues": { "SectorExploration": -2.6666, "PowerUp_Pickup_Shield": -2.5, "SurvivalBonus": -10.0 } }, "AdditionalValues": null } ] }
-
Build the project by navigating to File -> Build Settings, select the correct platform and press Build.
-
Install MS VisualStudio or any other code editor that supports reading .cs files.
-
In the cloned repository navigate to the WebAPI folder, open WebAPI.sln, and start the API.
-
Navigate to
http://localhost:5016/swagger/index.html
to see if the API ran successfully. -
API can be tested with a POST request to the http://localhost:5016/api/JsonToSoParser with the following request body:
{ "CoordinatorURI": "http://localhost:4000", "EvalEnvInstanceURIs": ["http://localhost:4444"], "SourceFilePath": "your path...\\jsonBody.json", "DestinationFilePath": "your path...\\GIANT\\EvaluationEnironments\\UnityEvalEnv\\Assets\\Resources\\JSONs\\problem domain\\", "LastEvalIndividualFitnesses": null }
-
Install IntelliJ IDEA on your machine.
-
Clone EARS repository from GitHub.
-
Open the cloned project in IntelliJ IDEA
-
Create a run configuration (If not already defined).
-
Update file ./.idea/gradle.xml.
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="GradleSettings"> <option name="linkedExternalProjectsSettings"> <GradleProjectSettings> <option name="delegatedBuild" value="false" /> <!--Add this line of code--> <option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="gradleJvm" value="#JAVA_HOME" /> <option name="modules"> <set> <option value="$PROJECT_DIR$" /> </set> </option> </GradleProjectSettings> </option> </component> </project>
-
Update ./.idea/misc.xml.
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="17" project-jdk-type="JavaSDK" > <output url="file://$PROJECT_DIR$/out" /> <!--Add this line of code--> </component>
-
Install Swing UI Designer
-
Start WebAPI and run GPInterface configuration.
-
Load
ears_config_robostrike.json
in the Configuration tab. -
Press Run to start the evolution process. After the process is successfully executed the result should be displayed in the UI.