Getting started
Let’s setup your Planet Lia environment for Planetization game.
1. Download
- Download Planet Lia CLI for your operating system and unzip it into a folder of your liking. The tool is portable so you don’t need to install it.
- Install Java on your system. Planetization game is written in Java and it needs it in order to run. On most system it is already installed.
- Setup programming language that you will use for writing your bot. If you have used the language before, you most likely already have everything that you need.
2. Play a game
Open up a Cmd.exe or PowerShell.exe on Windows or a Terminal on Linux or macOS, move to the unzipped Planet Lia CLI directory and run the commands below.
First we will download the Planetization game and set it as our default game.
Then we will create a new starting bot john
written in Java and battle it against itself.
To choose a different language for your bot simply replace the java
part of the first command with python3
or kotlin
.
The first time you play a match with your bot it may take some time as a couple of libraries need to be downloaded, later runs will be much faster.
lia.exe game download planetization
lia.exe game set planetization
lia.exe bot new java john
lia.exe play john john
.\lia.exe game download planetization
.\lia.exe game set planetization
.\lia.exe bot new java john
.\lia.exe play john john
./lia game download planetization
./lia game set planetization
./lia bot new java john
./lia play john john
After running the commands above, wait until the match is generated and voila, a browser window is opened displaying the replay of the generated match!
Also a new directory named john
is created in your current working directory.
This directory contains all the code for your bot. We will dig into it in the next section.
3. Understand your bot
With your favorite text editor open up your bot’s main file. If you have created Java
bot then open up john/src/MyBot.java
, if Python3
then john/my_bot.py
and if Kotlin
then john/src/MyBot.kt
.
You can also open the whole bot directory (eg. john
) in an IDE. Check Using an IDE example to learn more.
Read through the code to see how it works! If you need help, check out our API.
Note that during the development you can structure your bot directory as you like, as long as the MyBot
file acts as your “main” file.
This means that you can create additional files which you then import into MyBot
.
To delete a bot, simply delete it’s directory, in our case the directory named john
.
4. Debug your bot
A more detail guide on how to debug your bot using a step debugger integrated into your favourite IDE, is available here.
Note if you use the -d
flag with play
command (eg. lia.exe play -d john john
), you can get a very useful debug view while the match is generating, as shown below.
It will let you to pause the match generation, step through it, view details of game entities, API calls and more.
5. Generate many matches at once
You can generate multiple matches using -n
flag with play
command as shown below.
By providing a number after -n
flag you can specify how many matches you want to generate.
This is really useful for comparing quality of two bots as the end result also prints out the number of times each bot has won.
lia.exe play -n 20 john john
.\lia.exe play -n 20 john john
./lia play -n 20 john john
Next up
Check out the game rules.
Next: Game rules