robocode-dev / tank-royale

Git repository for Robocode Tank Royale
Apache License 2.0
122 stars 23 forks source link

booted bots can't join the battle #79

Closed alex-314214 closed 3 months ago

alex-314214 commented 6 months ago
  1. I started robocode-tankroyale-gui-0.22.0.jar on Windows 10.
  2. Selected Config Menu -> "Bot Root Directory" and added the path to the sample bots
  3. Selected Server Menu -> Start Server
  4. Selected Server Menu -> Select Server -> Test -> "server is running"
  5. Selected Battle Menu -> Start Battle -> Selected some bots from "Bot Directories (local only)" and clicked on Boot-Button.
  6. Selected Bots were shown on "Booted Bots (local only)" list
  7. "Joined Bots (local/remote)" list stays empty. So I can't add a bot to "Selected Bots(local/remote)" list and the "Start Battle" Button remains disabled.

What wents wrong?

flemming-n-larsen commented 6 months ago

@alex-314214:

In order to see what is going on, we need to start the bot from a terminal window.

So you should cd your way into the bots directory, e.g. the Corners bot, and write:

java -cp ../lib/* Corners.java

I expect that the Corners bot will run or write an error to standard out.

You can do the same thing for any Java bot, so if Corners works, but not your own, you should try out running your bot instead from the terminal the same way.

Please note that a server must be started in advantage.

Please note that you will run into this error:

Disconnected from: ws://localhost:7654, status code: 1008, reason: Invalid secret

This is because the server is protected with an server key that the bot needs to provide in order to connect to the server. You can find the key in the generated server.properties file located at the directory where the GUI is started from. It will look similar to this:

bots-secrets=ZKfl1TOEvabzxqm6YRC0og
controller-secrets=QlgOL13TnWrdQoqnKcIEpA

Now, before calling the java -cp ../lib/* Corners.java command, you should set the SERVER_SECRET environment variable to the secret you find in the server.properties file under bots-secrets.

if you use PowerShell:

$env:SERVER_SECRET="ZKfl1TOEvabzxqm6YRC0og"

if you instead use Command Prompt:

set SERVER_SECRET=ZKfl1TOEvabzxqm6YRC0og

(of course you need to use the server secret generated for your server instead of the one used above)

Now you should be able to connect to the server with java -cp ../lib/* Corners.java.

What it written out to the console in your case, when you try to start the bot?

alex-314214 commented 6 months ago

Thank you for your hints. But I found a solution on https://github.com/robo-code/robocode/releases that works.

flemming-n-larsen commented 6 months ago

Anybody else encountering this issue, and what are your findings written out by the bot(s)?

flemming-n-larsen commented 6 months ago

One observation on my side is, that this happens sometime when running on Linux. Hence, this needs more investigation.

flemming-n-larsen commented 3 months ago

Closing it for now.