Oarcinae / FactorioScenarioMultiplayerSpawn

A custom scenario for Factorio which provides each player a unique starting spawn point in a multiplayer game.
MIT License
50 stars 29 forks source link

Spawn saving issue #43

Closed Cyberzoid1 closed 6 years ago

Cyberzoid1 commented 6 years ago

While testing the server before going line. I'm finding that I cant seem to save my spawn position. I've changed the cooldown in the config file to 1 minute, and clicked on "set New respawn loacation" but then when I leave and reenter, I'm back at the starting position.

Half related. Is this the correct way to load a scenario save on startup? ExecStart=/opt/factorio/bin/x64/factorio --server-settings /opt/factorio/data/server-settings.json --start-server-load-scenario FactorioScenarioMulti

AusKarlos commented 6 years ago

Spawn time cooldown refers to the amount of time needed to pass before you can set a new spawn point for your team. In the config.lua go to line 270 "MIN_ONLINE_TIME_IN_MINUTES" and change that value. By default its 15mins. If you leave within 15mins of joining the server your base will be removed.

Oarcinae commented 6 years ago

@Cyberzoid1 Yes, that looks like the right way to load the scenario. As long as the scenario folder is correctly named and inside the /factorio/scenarios/ folder, it should work.

When you say that you "leave and re-enter", does that mean you are leaving the game within the first 15 mins of playtime? Are you seeing the welcome message and spawn options again? As AusKarlos mentioned, you can try disabling that first and seeing if you still have issues. The setting to change your default spawn only changes your respawn location for when you die.

Try with MIN_ONLINE_TIME_IN_MINUTES = 0 and see what happens, then you don't need to wait 15 minutes to try leaving and entering the game to change your spawn. Set your spawn location to a new location, then go and die to aliens or kill yourself with grenades or something. You should respawn at the new location that you chose.

Cyberzoid1 commented 6 years ago

Ok so currently after waiting for the respawn timer cooldown and setting the spawn, I can leave the server and rejoin and correctly spawn in my base. So that part is good.

However, If i stop and restart the server then re-join, I'm taken back to the initial spawn. The save is at "/opt/factorio/saves/FactorioScenarioMultiplayerSpawn.zip" and with correct permissions like every other save.

When i restart the server, my timeplayed is at zero again shown by EvoGUI

My config.lua for reference: https://pastebin.com/7Kx0PsK0

Cyberzoid1 commented 6 years ago

For a split moment, I thought I had it. The scenario was not fully spelled out so the game probably was using the first match. Fixed that. Now i have: ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-scenario FactorioScenarioMultiplayerSpawn --server-settings /opt/factorio/data/server-settings.json

Server does not seem to be reading/loading a save

Dec 18 11:29:24 games factorio[1796]:    1.066 Info PlayerData.cpp:65: Local player-data.json available, timestamp 1513625359
Dec 18 11:29:24 games factorio[1796]:    1.066 Info PlayerData.cpp:72: Cloud player-data.json unavailable
Dec 18 11:29:24 games factorio[1796]:    1.068 Custom inputs active: 0
Dec 18 11:29:24 games factorio[1796]:    1.068 Factorio initialised
Dec 18 11:29:24 games factorio[1796]:    1.069 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
Dec 18 11:29:24 games factorio[1796]:    1.069 Info ServerMultiplayerManager.cpp:693: mapTick(4294967295) changing state from(Ready) to(PreparedToHostGame)
Dec 18 11:29:24 games factorio[1796]:    1.069 Info ServerMultiplayerManager.cpp:693: mapTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
Dec 18 11:29:38 games factorio[1796]:   15.070 Info BlueprintLibrary.cpp:53: Loaded external blueprint storage: playerIndex = 65535, nextRecordID = 0; timestamp = 0; records:
Dec 18 11:29:39 games factorio[1796]:   15.134 Loading Level.dat: 1035112 bytes.
Dec 18 11:29:39 games factorio[1796]:   15.140 Info Scenario.cpp:135: Map version 0.16.5-0
Dec 18 11:29:39 games factorio[1796]:   15.225 Info BlueprintLibrary.cpp:232: Loaded library shelves:
Dec 18 11:29:39 games factorio[1796]:   15.225 Info BlueprintLibrary.cpp:798: Game shelf: playerIndex = 65535, nextRecordID = 0; timestamp = 0; records:
Dec 18 11:29:39 games factorio[1796]:   15.226 Info BlueprintLibrary.cpp:53: Loaded external blueprint storage: playerIndex = 65535, nextRecordID = 0; timestamp = 0; records:
Dec 18 11:29:39 games factorio[1796]:   15.238 Checksum for script /opt/factorio/temp/currently-playing/control.lua: 4291097165
...
Dec 18 11:29:39 games factorio[1796]:   15.269 Checksum for script __ZCS-Trash-Landfill-Continued__/control.lua: 4093727606
Dec 18 11:29:39 games factorio[1796]:   15.319 Info UDPSocket.cpp:27: Opening socket at (0.0.0.0:34197)
Dec 18 11:29:39 games factorio[1796]:   15.319 Hosting game at 0.0.0.0:34197
Dec 18 11:29:39 games factorio[1796]:   15.319 Info HttpSharedState.cpp:54: Downloading https://auth.factorio.com/generate-server-padlock-2
Dec 18 11:29:39 games factorio[1796]:   15.515 Info HttpSharedState.cpp:127: Status code: 200
Dec 18 11:29:39 games factorio[1796]:   15.515 Info AuthServerConnector.cpp:109: Obtained serverPadlock for serverHash (fnUDBabMV7BW1tyBuOEpv7BR2XmyHU38) from the auth server.
Dec 18 11:29:39 games factorio[1796]:   15.515 Info ServerMultiplayerManager.cpp:693: mapTick(0) changing state from(CreatingGame) to(InGame)
Dec 18 11:29:39 games factorio[1796]:   15.515 Info UDPSocket.cpp:39: Opening socket for broadcast

normal saves would show up

Dec 18 11:37:19 games factorio[2441]:    1.008 Info ServerMultiplayerManager.cpp:693: mapTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
Dec 18 11:37:19 games factorio[2441]:    1.012 Loading map /opt/factorio/saves/world.zip: 10118559 bytes.
Dec 18 11:37:19 games factorio[2441]:    1.036 Loading Level.dat: 20996424 bytes.
Cyberzoid1 commented 6 years ago

Figured it out. Turns out you need to use both commands

# create senario
#ExecStart=/opt/factorio/bin/x64/factorio  --start-server-load-scenario FactorioScenarioMultiplayerSpawn --server-settings /opt/factorio/data/server-settings.json

# start senario save?
ExecStart=/opt/factorio/bin/x64/factorio  --start-server /opt/factorio/saves/FactorioScenarioMultiplayerSpawn.zip --server-settings /opt/factorio/data/server-settings.json

The save file already includes the scenario so all I had to do was load the save. Thanks to a hint in #40

Oarcinae commented 6 years ago

Oh yeah.... sorry, you need 1 command --start-server-load-scenario to start a NEW game. and --start-server-load-latest to CONTINUE a previous game. I didn't understand what you meant :)

You can do --start-server-load-latest or --start-server and point to your save file like you did.

Oarcinae commented 6 years ago

Resolved as not a bug. I can add more clear instructions to the readme for how to start/stop scenarios though.