- If you already have Visual Studio Code installed, skip to the next section.
- Visit https://code.visualstudio.com/Download and select your operating system.
- After the download completes, run the installer (Windows) or install the package (Linux/MacOS).
- After the install is completed, run Visual Studio code.
Next, visit the Installing Microclimate page to install and start Microclimate. Return to this page when done.
- In Visual Studio Code, select
View
(menu bar item) >Extensions
. UnderSearch Extensions in Marketplace
, enterMicroclimate
. - Select
Microclimate Developer Tools
, and click theInstall
button on the right-hand screen. - Reload Visual Studio Code.
- In the Microclimate browser UI, accept the Microclimate license and select an option on the telemetry page. You should now see the Microclimate introductory splash screen.
- Select the
Import Project
button. On the following page, selectGit
, then copy and paste the following repository location:
https://github.com/microclimate-dev2ops/rogue-cloud-client
- Click
Next
, then click theImport
button. - Once the code is imported, click the
Edit Code
button. You are now redirected to the code editor. - Before the code starts building, the container needs to initialize and download the Java and Maven dependencies for the underlying build system. This can take up to 7 to 10 minutes depending on CPU and network connection (this initialization is only required the first time you using Microclimate). You can use
docker logs -f microclimate-file-watcher
to watch its progress. - Once the build has initialized and downloaded the required dependencies, the build icon displays a green circle notification, like so:
Once the build completes, you can return to the Visual Studio Code window.
You should now have both Visual Studio Code and Microclimate installed. Next we need to configure the Visual Studio Code Tools to connect to the Microclimate service.
Ensure that Microclimate is up and running before proceeding with these steps.
- In Visual Studio Code, select
View
(menu bar item) >Explorer
. - On the left-hand panel, expand the
MICROCLIMATE
view. - In this view, click on
No Microclimate connections
. - This will bring up a text bar at the top of the screen asking you to
Enter the Port for the local Microclimate instance you want to connect to
: - Ensure that
9090
is the default value in this field, and press Enter. - You should see a notification indicating that the connection to Microclimate has been successfully created. You should also see the
roguecloudclient
application running in this view. This is the project we imported from Git in a previous step. - Right-click on
roguecloudclient
and selectOpen folder as workspace
.
See the Microclimate documentation for more information on connecting to Microclimate instance from Eclipse.
- In the code editor, press
CTRL-P
(Command-P
on Mac) and typeStartAgentServlet.java
, and selectStartAgentServlet.java
.
CTRL-P/Command-P
is a great way to quickly find Java classes in the Visual Studio Code editor.
- Edit the following fields in
StartAgentServlet.java
to create a new user and password.
public static final String USERNAME = "(specify a username here!)";
public static final String PASSWORD = "(specify a password here!)";
- These values are to ensure that only you can access and control your character.
- The username and password you specify are automatically registered when your code first begins controlling a character on the game map, and they do not have to correspond to an existing email address or account.
-
Press
CTRL-S
(Command-S
on Mac) in order to save your changes. -
Press
CTRL-P
(Command-P
on Mac) and typeSimpleAI.java
and selectSimpleAI.java
. -
This class is the main AI class. Changes made to this class are reflected in your AI running on the Liberty Server.
To watch your agent as it interacts with the game world, right-click on the roguecloudclient
project in the MICROCLIMATE
view and select Open in Browser
.
This will open a browser to the root of your application.
Add gameclient/StartAgent
to the end of the URL, such that it looks like:
http://localhost:(port)/gameclient/StartAgent
, where (port) is the randomly generated local port for the server.
Congratulations, your character is now exploring and interacting with the game world, and earning you points on the leaderboard!
Next, visit the next steps page to learn more about coding an agent for Rogue Cloud.