Skip to content

Starting battle on LAN Websocket address #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
electricSoda opened this issue Jun 18, 2024 · 9 comments
Closed

Starting battle on LAN Websocket address #96

electricSoda opened this issue Jun 18, 2024 · 9 comments
Assignees

Comments

@electricSoda
Copy link

The bug
When you start a Robocode Tank Royale server from the GUI on any LAN Websocket address, boot up bots to connect to the server through the command line (e.g. java -cp ../lib/* AvoidWall.java), and then try and start up a match between these bots through the GUI, the match doesn't start.

To Reproduce

  • Go to the server.properties file and add your computer's LAN address converted to a websocket address (e.g. ws://192.168.1.20:3000) to the server-urls property

  • Select the the IP address from Server > Select Server from the GUI

  • Start up a server on this new websocket address through the GUI (Server > Start Server)

  • On a separate computer (or on the same computer), change the SERVER_URL environment variable (by doing set SERVER_URL=<url>) to the same websocket address you did in the server.properties file

  • Also make sure to configure the secret for the bots by doing set SERVER_SECRET=<secret>; you can find the bots-secrets in the server.properties file

  • Then go in command prompt or terminal and then boot up a bot e.g. java -cp ../lib/* Corners.java

  • It should show that it's connected on the battle menu thingy on the GUI (in the Joined Bots (local/remote))

  • Add that remote bot for battle

  • Boot up another bot from a local directory through the GUI (not from command line)

  • Click start battle

  • You will see that the pop up for selecting bots disappears like it's going to start a match, but then nothing shows up on the main screen (the battle interface doesn't show up)

Desktop (please complete the following information):

  • Windows 10

Java info:

  • Java 16.0.2 (yeah I need to update Java lol)
  • Vendor: Oracle
@flemming-n-larsen
Copy link
Contributor

@electricSoda Thank you for reporting this as a bug and providing really good information for how to reproduce the issue you see. 😊👌

I will have a look into this issue.

@flemming-n-larsen
Copy link
Contributor

flemming-n-larsen commented Jun 18, 2024

I reproduced the problem 👍 So I will figure out how to fix that

@electricSoda When you start a local server, it will start up at localhost:, not the address(es) specified with the 'Select Server' dialog. This dialog is mainly meant for which server the GUI will connect to, which could be an external server or local server. It might even run from a Docker container or Linux shell within Windows.

That said, I believe the local IP address and localhost must be resolved equally, meaning that the GUI should be able to connect to the server. So it is still a bug, and a dialog should show up for sure.

@electricSoda
Copy link
Author

Sounds good 👍

@flemming-n-larsen
Copy link
Contributor

@electricSoda I just released 0.24.1 with fixes for this issue. I should like you to try out, if it works for you as well. ❓

Also notice, that I updated the check when entering/adding a new URL, so you don't need to do this manually via a text editor. 😉

@flemming-n-larsen flemming-n-larsen added solved? and removed in progress Issue is in progress labels Jul 13, 2024
@electricSoda
Copy link
Author

Still doesn't work :(. If I select a LAN server like ws://192.168.1.28.:3000 (which is my machine's local LAN address), boot up some bots from the GUI, and some from the terminal, and then click start battle, the battle doesn't show up on the GUI...

@flemming-n-larsen
Copy link
Contributor

flemming-n-larsen commented Jul 14, 2024

@electricSoda
I am sorry. I think I misunderstood you, and feel a bit embarrassed, as I did not fix at least the main issue with the GUI. My bad! And I think the GUI needs more work, so it is less confusing, and will be smarter to work with.

If I get you right, the main issue is that the GUI automatically starts up a server locally on the default (Robocode) port 7654. That is at ws://localhost:7654, where local IP addresses like e.g. 192.168.1.28 will work too, but only if you use the same port, i.e. ws://192.168.1.28:7654. The Select Server dialog only lets you select any server including your own (local server). And you can hit the Test button to check if the server is up and running. Note that this is useful, if you are trying to reach an external server outside your system, or if you have multiple servers running, e.g. started an independent server in the background on another port than 7654, e.g. 3000.

Then, when you add the server URL ws://192.168.1.28:3000 and try to start a battle nothing happens! Which is what this issue is about.
This is caused by no server running on port 3000 unless you start one in the background, which is possible. Nevertheless, the GUI should alert you that no server is running on port 3000.

To fix this issue, I have some proposals I will start working on. If you have other suggestions, make sure to add those to this thread.

  1. The GUI should alert the user when a selected server is not running, which is the main issue. The alert should provide the URL of the server, which is not running.

  2. There should be a configuration for the server, where it is possible to set the default port so the default port can be changed from 7654 to e.g. 3000.

  3. Perhaps I need to add something to the Select Server dialog to let people know that the dialog is not used for setting the possible local IP addresses and port(s) of the server, but only for choosing which server to use when starting battles.

  4. I could improve the Select Server dialog so the list of servers indicates which servers are online and offline, e.g. by an icon beside the URL.

  5. The Start Server (in the Server menu) should ask the user if the default port should be used, or if another port must be used. This could use the configuration from 2)

@SirStone
Copy link
Collaborator

Hi
I would like to give my 2 cents here, but first I want state that this is a not-issue to me; in case someone wants to boot a server in a remote machine, the server configuration can stay as "localhost" and still be able to connect with remote bots up until the firewall and network rules are set correctly.

Said so...I think I can reproduce the same issue with a single machine and without using the official GUI. I'm not 100% sure if this is exactly the same problem, as far as I understand the reported bug states that starting the server using the lan ip, for example 192.168.xxx.yyy, instead of the "localhost" or "127.0.0.1" the match doesn't start.

I'm going to use my alternative GUI project, so maybe I can easily see more some details than @electricSoda.

  1. Start a server giving as lan adderss my local lan, that is on 192.168.178.xxx. I leave the port random.
  2. Connect a controller without issues
  3. Start 2 bots offical bots (sample bots) to be sure that the bots are not the issue
  4. start the match
  5. observe that the match doesn't start

Server output at point 5

image

Messages sent and received by the controller at point 5

controller_weboscket

Green arrow are the messages sent from Controller to Server, red arrows the messages received from the Server.


Now repeating the point 1 to 5 but reverting the server ip as 127.0.0.1

Server output at point 5

image

Messages sent and received by the controller at point 5

image


What I observe is that when using the lan address instead of localhost or 127.0.0.1 the server is able to make Controllers and bots join correctly but as soon as the game starts the server is unable to communicate correctly with them, in particular I see that the bots are not receiving the "game-started-event-for-bot" and so the bots can't respond with a "bot-ready".

It's the same issue I've reported in #97 but in that case the problem was related to my machine, if I use "localhost", it is translated in ip V6 "::1" instead of "127.0.0.1", and the bots could join but could not receive the "game-started-event-for-bot", as in this open issue.

Are you maybe switching the messaging system from direct to broadcast? Could be here that there's a translation issue of addresses?

flemming-n-larsen added a commit that referenced this issue Sep 18, 2024
…dow was opened when starting a battle. Now an error message will show up plus the dialog for selecting a (local) server.
@flemming-n-larsen
Copy link
Contributor

@electricSoda I have just release version 0.24.4 which now shows an error message if a remote server is being used for starting the battles. Currently, only local server battles are supported.

@flemming-n-larsen
Copy link
Contributor

@electricSoda
I have made a version 0.26.0, which supports remote servers as well as local servers.
Has the issue you saw been fixed by now?

I am closing the issue now. Please re-open it, if the original issue is still present or create a new issue.

@flemming-n-larsen flemming-n-larsen removed the in progress Issue is in progress label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants