Skip to content
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

Unify --network-ai into server startup command #5148

Open
hugeblank opened this issue Aug 10, 2024 · 4 comments
Open

Unify --network-ai into server startup command #5148

hugeblank opened this issue Aug 10, 2024 · 4 comments

Comments

@hugeblank
Copy link

hugeblank commented Aug 10, 2024

Description

I'd like to be able to merge the two commands necessary to get AI onto a server into one. It looks like this is possible, the only hitch being that the AI joining the server takes precedence over the server listener. I feel like the current behavior is more of a bug, and that the two required steps are out of order.

Steps to reproduce

  1. Set up server as usual following NETWORKING.md.
  2. run the following command using the compiled binary: ./bin/supertuxkart --server-config=server_config.xml --disable-polling --unlock-all --network-console --connect-now=localhost:2759 --network-ai=11

Expected result: Server starts listener then AI joins the server. The behavior could even be extended to drop the --connect-now and --server-password arguments and just directly join the server with the provided server_config.xml information.
Actual result: AI eternally attempts joining while the server arguments are presumably ignored.

Configuration

STK release version: e6d0df3

STK Source: git

System: Arch Linux 6.10.2-arch1-1

Graphics card: Radeon RTX 6600 XT

CPU: Ryzen 5800 X3D

Additional information

stdout.log:

[verbose  ] main: Error messages and other text output will be logged to /home/hugeblank/.config/supertuxkart/config-0.10/server_config.log.
[error  ] User Config: Unknown value for non_ge_fullscreen_desktop; expected true or false
[error  ] User Config: Couldn't find parameter group server-bookmarks-order
[info   ] [FileManager]: Data files will be fetched from: '../data/'
[info   ] [FileManager]: Data files will be fetched from: '../data/../../stk-assets/'
[info   ] [FileManager]: User directory is '/home/hugeblank/.config/supertuxkart/config-0.10/'.
[info   ] [FileManager]: Addons files will be stored in '/home/hugeblank/.local/share/supertuxkart/addons/'.
[info   ] [FileManager]: Screenshots will be stored in '/home/hugeblank/.local/share/supertuxkart/screenshots/'.
[info   ] [FileManager]: User-defined grand prix will be stored in '/home/hugeblank/.local/share/supertuxkart/grandprix/'.
[info   ] [FileManager]: Asset 0 will be loaded from '../data/challenges/'.
[info   ] [FileManager]: Asset 1 will be loaded from '../data/gfx/'.
[info   ] [FileManager]: Asset 2 will be loaded from '../data/grandprix/'.
[info   ] [FileManager]: Asset 3 will be loaded from '../data/gui/icons/'.
[info   ] [FileManager]: Asset 4 will be loaded from '../data/gui/screens/'.
[info   ] [FileManager]: Asset 5 will be loaded from '../data/gui/dialogs/'.
[info   ] [FileManager]: Asset 6 will be loaded from '../data/replay/'.
[info   ] [FileManager]: Asset 7 will be loaded from '../data/shaders/'.
[info   ] [FileManager]: Asset 8 will be loaded from '../data/skins/'.
[info   ] [FileManager]: Asset 9 will be loaded from '../data/ttf/'.
[info   ] [FileManager]: Asset 10 will be loaded from '../data/po/'.
[info   ] [FileManager]: Asset 11 will be loaded from '../data/../../stk-assets/library/'.
[info   ] [FileManager]: Asset 12 will be loaded from '../data/../../stk-assets/models/'.
[info   ] [FileManager]: Asset 13 will be loaded from '../data/../../stk-assets/music/'.
[info   ] [FileManager]: Asset 14 will be loaded from '../data/../../stk-assets/sfx/'.
[info   ] [FileManager]: Asset 15 will be loaded from '../data/../../stk-assets/textures/'.
[info   ] [FileManager]: Asset 16 will be loaded from '../data/../../stk-assets/tracks/'.
[info   ] main: STK config will be read from stk_config.xml.
..:: Antarctica Rendering Engine 2.0 ::..
[error  ] skin: Could not read XML file '../data/skins/peach/stkskin.xml'.
[error  ] GUI: Could not load skin, reverting to default.
[info   ] GUI: Loading skin data from file: ../data/skins/classic/stkskin.xml
[info   ] HTTPRequest: Sending userid=481947&token=************************ to https://online.supertuxkart.net/api/v2/user/saved-session/
[info   ] GrandPrixManager: Loading Grand Prix files from ../data/grandprix/
[info   ] GrandPrixManager: Loading Grand Prix files from /home/hugeblank/.local/share/supertuxkart/grandprix/
[info   ] STKHost: Host initialized.
Available command:
help, Print this.
quit, Shut down the server.
kickall, Kick all players out of STKHost.
kick #, kick # peer of STKHost.
kickban #, kick and ban # peer of STKHost.
listpeers, List all peers with host ID and IP.
listban, List IP ban list of server.
speedstats, Show upload and download speed.
[info   ] ConnectToServer: SETUP
[info   ] ProtocolManager: A 15ConnectToServer protocol has been started.
[info   ] Achievements: Synching achievement 1,2,4,5,7,9,11 to server.
[info   ] HTTPRequest: Sending userid=481947&token=************************&achievementid=1%2C2%2C4%2C5%2C7%2C9%2C11 to https://online.supertuxkart.net/api/v2/user/achieving/
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 32997, retry remain: 3
[info   ] HTTPRequest: Sending userid=481947&token=************************&visitingid=481947 to https://online.supertuxkart.net/api/v2/user/get-friends-list/
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 32997, retry remain: 2
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 32997, retry remain: 1
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 32997, retry remain: 0
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 59427, retry remain: 10
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 59427, retry remain: 9
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 59427, retry remain: 8
[info   ] ConnectToServer: Trying connecting to [::1]:2759 from port 59427, retry remain: 7
@kimden
Copy link
Contributor

kimden commented Aug 10, 2024

To my knowledge, AI that connect to the server are supposed to be another process (client as opposed to server), and so you have to run them separately, and that's why you cannot combine --server-config and --connect-now.

I agree that it would be slightly more convenient in some situations if STK managed that itself, but on the other hand, with what happens now, bots can be connected and disconnected at any desired moment, which can also be useful.

@hugeblank
Copy link
Author

with what happens now, bots can be connected and disconnected at any desired moment, which can also be useful.

Yeah I agree with this, but I don't see why both features cannot exist at the same time. The particular use case I have in mind is with the ai-handling tag in the server config. Since my server handles AI by itself and is not accepting AI from anywhere, I'd just like to always have the max amount (minus connected players), which doesn't feel like a situation that should demand 2 processes. Heck maybe the feature could be implemented in a way that could be a tie-in value with that tag. Something like:
<ai-handling auto-balance="true" auto-join="true" /> (where auto-balance is what is currently value)

@kimden
Copy link
Contributor

kimden commented Aug 13, 2024

Apparently there's an option --server-ai which seems to do exactly what you wanted. I'm not really sure about when exactly it can/cannot be used, it was added long ago and maybe even doesn't work completely now (e.g. for me server with --server-ai=1 crashes upon second join, I can make an issue if the option is planned to be supported).

@hugeblank
Copy link
Author

hugeblank commented Aug 13, 2024

ooh! The --server-ai option appears to (mostly) work , though I can't test multiple joins at the moment. The only other issues:

  • It seems to max out at 10 bots even if the provided amount is higher.
  • It isn't listed in --help and definitely should be.

Edit - by "second join" I thought you meant two players joining at the same time. I see now you meant joining, then leaving, then joining again, as I just was able to reproduce the crash.

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
@hugeblank @kimden and others