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

Can't start dedicated server loaging savedgame #4618

Closed
Xavicrist opened this issue Jul 12, 2023 · 5 comments · Fixed by #4621
Closed

Can't start dedicated server loaging savedgame #4618

Xavicrist opened this issue Jul 12, 2023 · 5 comments · Fixed by #4621
Assignees

Comments

@Xavicrist
Copy link

Hi,
I'm currently running about 8 megamek server (4 on 0.48.0, 2 on 0.49.X, and 2 other on 0.49.latest) Each one iwth it's own configuration ports and such.

A user requested to run a new dedicated server wich automatically loads a savedgame. Looking on the description of the project...
It says:

If you want the dedicated server to load a saved game, supply the filename after the -dedicated switch, like this: "-dedicated savedgame.sav". To stop the server, you will need to tell the Java machine to halt execution, which is CTRL + C on most platforms.

Well, I'm working on megamek 0.48.0 and I'm trying to setup that server requested (which loads a saved game). And I'm unable to.

Command Tries / output:
TEST A
java -jar MegaMek.jar -dedicated savedgame.sav --> Seems to ignore savegame
java -jar MegaMek.jar -dedicated savedgame.sav.gz --> Seems to ignore savegame
java -jar MegaMek.jar -dedicated <full_path>/savedgame.sav --> Seems to ignore savegame
java -jar MegaMek.jar -dedicated <full_path>/savedgame.sav.gz --> Seems to ignore savegame

TEST B
java -jar MegaMek.jar -dedicated savedgame.sav -port 3346 --> Megameklog.txt says it is ignoring parameter -port and says it is unable to load savegame 3346
(and all it's variants playing with PATH/savegame file name report same behaviour)

(Extract from log)
##########
##########
13:58:59,081 INFO [megamek.server.Server] {main}
loadGame(), line 1325 : s: loading saved game file '3346'

13:58:59,081 INFO [megamek.server.Server] {Connection Listener}
run(), line 31558 : s: listening for clients...

13:58:59,082 ERROR [megamek.server.Server] {main}
loadGame(), line 1332 : Unable to load file: 3346
java.io.FileNotFoundException: 3346 (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.(FileInputStream.java:157)
at megamek.server.Server.loadGame(Server.java:1328)
at megamek.server.Server.loadGame(Server.java:1310)
at megamek.server.DedicatedServer.start(DedicatedServer.java:57)
at megamek.MegaMek.startDedicatedServer(MegaMek.java:289)
##########
##########

TEST C
java -jar MegaMek.jar -dedicated -port 3346 savedgame.sav --> Megameklog.txt says it is ignoring savedgame
(and all it's variants playing with PATH/savegame file name report same behaviour)

(Extract from log)
##########
##########
14:18:29,639 INFO [megamek.server.Server] {main}
(), line 442 : s: starting a new server...

14:18:29,642 INFO [megamek.server.Server] {main}
(), line 459 : s: hostname = '' port = 3346
s: hosting on address = 127.0.1.1

14:18:29,642 INFO [megamek.server.Server] {main}
(), line 464 : s: password = null

14:18:29,647 INFO [megamek.server.Server] {Connection Listener}
run(), line 31558 : s: listening for clients...
##########
##########

@pakfront pakfront assigned pakfront and unassigned pakfront Jul 12, 2023
@pakfront
Copy link
Collaborator

I found the issue in nightlies and can fix. The -host command resolves the path, the -dedicated does not.
Meanwhile you should be able to use a path relative to the executable dir:
-dedicated ./savegames/mysave.sav.gz

@Xavicrist
Copy link
Author

Hi, thank you, it's one of the approeaches I tried, but then, it loads the map, but ignores port specified.

For example:
Command used:

java -Xms2048m -Xmx2048m -jar MegaMek.jar -dedicated ./savegames/Savedgame.sav.gz -port 3346

But then on megameklog.txt it shows that yes it loads the map but port is getting setted at random, doesn't use 3346 as especified for example.

########
log extract
########
06:23:19,269 INFO [megamek.server.Server] {main}
(), line 442 : s: starting a new server...

06:23:19,272 INFO [megamek.server.Server] {main}
(), line 459 : s: hostname = '' port = 33993 <<<<<<-------- Here you can see it uses port 33993 instead of 3346
s: hosting on address = 127.0.1.1

06:23:19,272 INFO [megamek.server.Server] {main}
(), line 464 : s: password = null

06:23:19,277 INFO [megamek.server.Server] {main}
loadGame(), line 1325 : s: loading saved game file './savegames/Savedgame.sav.gz'

06:23:19,277 INFO [megamek.server.Server] {Connection Listener}
run(), line 31558 : s: listening for clients...
Set option 'game_turn_limit' to '25'.

On Operating system you can see it was specified port 3346 but instead listening on 33993

root# ps -ef | grep 3346 <<<<<------- check PID of command executed
megamek 279548 1 1 06:23 ? 00:00:04 /usr/bin/java -Xms2048m -Xmx2048m --illegal-access=warn -jar MegaMek.jar -dedicated ./savegames/Savedgame.sav.gz -port 3346

root# netstat -pan | grep 279548 <<<<<-------- check port used by PID
tcp6 0 0 :::33993 :::* LISTEN 279548/java
unix 3 [ ] STREAM CONNECTED 1132409 279548/java
unix 2 [ ] STREAM CONNECTED 1134015 279548/java

@pakfront
Copy link
Collaborator

pakfront commented Jul 13, 2023

savegame should be last argument: -dedicated -port 3333 ./savegames/mysave.sav.gz
I will update the docs to make this clear

@Xavicrist
Copy link
Author

Hi htank you, but using savegame path parameter on last argument it doesn't take (savegame) on account.
If I use savegame path just after "-dedicated" it taken on account savegame but not port, and thus it uses a random port.

Putting both cases down here (remember this is on megamek 0.48)

Command: java -jar MegaMek.jar -dedicated -port 3346 ./savegames/WoM-Cliff.sav.gz

10:04:56,441 INFO [megamek.MegaMek] {main}
startDedicatedServer(), line 288 : Starting Dedicated Server. args: [-port 3346 ./savegames/WoM-Cliff.sav.gz]
MMRandom: generating RNG type #1
Set option 'tacops_bap' to 'true'.
Set option 'tacops_prone_fire' to 'true'.
Set option 'team_initiative' to 'false'.
Set option 'tacops_vtol_attacks' to 'true'.
Set option 'bridgeCF' to '120'.
Set option 'minefields' to 'true'.
Set option 'vtol_strafing' to 'true'.
Set option 'tacops_walk_backwards' to 'true'.
Set option 'tacops_angel_ecm' to 'true'.
Set option 'tacops_eccm' to 'true'.
Set option 'simultaneous_targeting' to 'true'.
Set option 'inf_deploy_even' to 'true'.
Set option 'exclusive_db_deployment' to 'false'.
Set option 'no_clan_physical' to 'true'.
Set option 'simultaneous_firing' to 'true'.
Set option 'use_bv_destroyed' to 'true'.
Set option 'show_bay_detail' to 'true'.
Set option 'ejected_pilots_flee' to 'true'.
Set option 'auto_ams' to 'false'.
Set option 'skip_ineligable_firing' to 'true'.
Set option 'woods_burn_down_amount' to '10'.
Set option 'skip_ineligable_movement' to 'true'.
Set option 'tacops_grappling' to 'true'.
Set option 'simultaneous_physical' to 'true'.
Set option 'clan_ignore_eq_limits' to 'true'.
Set option 'era_based' to 'true'.
Set option 'woods_burn_down' to 'true'.
Set option 'assault_drop' to 'true'.
Set option 'turn_timer' to '2'.
Set option 'lobby_ammo_dump' to 'true'.
Set option 'push_off_board' to 'false'.
Set option 'use_game_turn_limit' to 'true'.
Set option 'allow_illegal_units' to 'true'.
Set option 'techlevel' to 'Advanced'.
Set option 'initiative_streak_compensation' to 'true'.
Set option 'tacops_battle_wreck' to 'true'.
Set option 'inf_move_even' to 'true'.

10:04:56,744 INFO [megamek.server.Server] {main}
(), line 442 : s: starting a new server...

10:04:56,748 INFO [megamek.server.Server] {main}
(), line 459 : s: hostname = '' port = 3346

s: hosting on address = 127.0.1.1

10:04:56,748 INFO [megamek.server.Server] {main}
(), line 464 : s: password = null

10:04:56,753 INFO [megamek.server.Server] {Connection Listener}
run(), line 31558 : s: listening for clients...

#################
#################
#################

Command: java -jar MegaMek.jar -dedicated ./savegames/WoM-Cliff.sav.gz -port 3346

10:09:11,245 INFO [megamek.MegaMek] {main}
startDedicatedServer(), line 288 : Starting Dedicated Server. args: [./savegames/WoM-Cliff.sav.gz -port 3346]
MMRandom: generating RNG type #1
Set option 'tacops_bap' to 'true'.
Set option 'tacops_prone_fire' to 'true'.
Set option 'team_initiative' to 'false'.
Set option 'tacops_vtol_attacks' to 'true'.
Set option 'bridgeCF' to '120'.
Set option 'minefields' to 'true'.
Set option 'vtol_strafing' to 'true'.
Set option 'tacops_walk_backwards' to 'true'.
Set option 'tacops_angel_ecm' to 'true'.
Set option 'tacops_eccm' to 'true'.
Set option 'simultaneous_targeting' to 'true'.
Set option 'inf_deploy_even' to 'true'.
Set option 'exclusive_db_deployment' to 'false'.
Set option 'no_clan_physical' to 'true'.
Set option 'simultaneous_firing' to 'true'.
Set option 'use_bv_destroyed' to 'true'.
Set option 'show_bay_detail' to 'true'.
Set option 'ejected_pilots_flee' to 'true'.
Set option 'auto_ams' to 'false'.
Set option 'skip_ineligable_firing' to 'true'.
Set option 'woods_burn_down_amount' to '10'.
Set option 'skip_ineligable_movement' to 'true'.
Set option 'tacops_grappling' to 'true'.
Set option 'simultaneous_physical' to 'true'.
Set option 'clan_ignore_eq_limits' to 'true'.
Set option 'era_based' to 'true'.
Set option 'woods_burn_down' to 'true'.
Set option 'assault_drop' to 'true'.
Set option 'turn_timer' to '2'.
Set option 'lobby_ammo_dump' to 'true'.
Set option 'push_off_board' to 'false'.
Set option 'use_game_turn_limit' to 'true'.
Set option 'allow_illegal_units' to 'true'.
Set option 'techlevel' to 'Advanced'.
Set option 'initiative_streak_compensation' to 'true'.
Set option 'tacops_battle_wreck' to 'true'.
Set option 'inf_move_even' to 'true'.

10:09:11,553 INFO [megamek.server.Server] {main}
(), line 442 : s: starting a new server...

10:09:11,557 INFO [megamek.server.Server] {main}
(), line 459 : s: hostname = '' port = 40219

s: hosting on address = 127.0.1.1

10:09:11,557 INFO [megamek.server.Server] {main}
(), line 464 : s: password = null

10:09:11,561 INFO [megamek.server.Server] {main}
loadGame(), line 1325 : s: loading saved game file './savegames/WoM-Cliff.sav.gz'

10:09:11,561 INFO [megamek.server.Server] {Connection Listener}
run(), line 31558 : s: listening for clients...
Set option 'game_turn_limit' to '25'.

@pakfront
Copy link
Collaborator

pakfront commented Jul 16, 2023

Hmm, OK, I guess I con't help you with 0.48, but I have submitted a fix to the development version that fixes this in the next release.

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

Successfully merging a pull request may close this issue.

2 participants