Mydayyy / Valheim-ServerSideMap

This plugin completely moves the explored map and created pins to the server. As clients explore, they will send their explored areas to the server who will then distribute it to all connected clients. When a client joins, the server will synchronize the currently explored areas to the client. Pins are shared as well but default to false and need to be enabled. When pin sharing is used, all newly created pins are send to the server who saves them along with the explored area.
38 stars 1 forks source link

[Issue] Map markers disappearing after exiting and entering world #47

Open ghost opened 1 year ago

ghost commented 1 year ago

Hey Mydayyy :)

Since the Mistlands update, the markers you place on the map are no longer shared or even saved. You can place them and they'll be gone the next time you log in.

Reproducing

  1. Enable the EnableMarkerShare in the config file
  2. Go into a world
  3. Place some markers
  4. Log out
  5. Log back in, and realize the markers are gone

I guess you probably don't maintain this mod anymore, but I'd really appreciate it if you had the time to look into it.

Thanks a lot!

Mydayyy commented 1 year ago

Greetings,

thanks for bringing this to my attention, I will look into this as soon as possible during this week!

Best Regards Mydayyy

Mydayyy commented 1 year ago

Greetings,

so I took a look at it today and I was not able to reproduce the issue. I followed the steps as provided and also did some testing and the markers were saved correctly every time. In addition, the server log also provided the correct output (pin received) and printed the correct pin count upon a client connecting.

Can you check your server logs for any anomalies? You can also provide them but you need to make sure to erase any sensitive information.

Best Regards Mydayyy

ghost commented 1 year ago

Problem is there's literally nothing happening in the log :( Also tried using /convertpins, but that doesn't do anything either.

Not sure if that's because I have -crossplay enabled or something? (using playfab)

I also have some other mods enabled on the server, but none of them should interfere with the markers?? But I'm not expert, so it could also be one of those mods conflicting. The list of mods: AzuAntiCheat BetterNetworking ItemDrawers Server Devcommands ServerSideMap WardIsLove WhereYouAt

I've tried ServerSideMap with every mod before, except the WardIsLove. So it might be that one?? Not sure if it has anything to with markers, except the one it places, when you put down a ward

Logs: (LogOutput.log) https://paste.ec/paste/MaAZL4Jk#rxa6CTR3Q26e+XXxPIvC3lXpDjkjzEKzqHluGYPI+cK

Example https://gfycat.com/FreshSplendidHairstreak The right-side is live output from the LogOutput.log file using tail

ghost commented 1 year ago

Ah god damn it, it's the WardIsLove mod. Just tried removing it, and now the map pins are being placed just fine.

Not sure if you can do anything about it? The source code can be found here

Mydayyy commented 1 year ago

Greetings,

I will look into it and report back when I have more information.

Mydayyy commented 1 year ago

So by checking the source code I did not find anything that I suspected would clash with my mod so I proceeded to install it, and it works on my side, with running the default config.

Could you pass me your Ward config so I might be able to reproduce it?

Checking the logs you attached I found one anomaly:

[Info   :WhereYouAt] Invoking version check
[Info   : Unity Log] Sending WhereYouAt version 1.0.7 and minimum version 1.0.7 to the client.
[Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
ZNet.ListContainsId (SyncedList list, System.String id) (at <617986ed2f06468487af280e8d8f7c04>:0)
PieceManager.RegisterClientRPCPatch.Postfix (ZNet __instance, ZNetPeer peer) (at <834b54fc9d0a40e3bd8931140ce452e8>:0)
(wrapper dynamic-method) ZNet.DMD<ZNet::OnNewConnection>(ZNet,ZNetPeer)
ZNet.CheckForIncommingServerConnections () (at <617986ed2f06468487af280e8d8f7c04>:0)
ZNet.Update () (at <617986ed2f06468487af280e8d8f7c04>:0)

Ward is love appears to throw an error during initialization on your side, which does not happen on mine, I am sure whether that interferes with any functionality tho.

ghost commented 1 year ago

Thank you so much for looking into it, and sorry if it's been a nuisance.

The requested file If you just want the WardIsLove config, the wardIsLoveData and the world file, you can download that here: https://gofile.io/d/R2rBHM

Password for the 7z is mydayyy

The entire setup I'm using this docker image

docker-compose.yml

version: "3.9"

services:
  valheimserver01:
    container_name: valheimserver01
    image: ghcr.io/lloesche/valheim-server
    cap_add:
      - sys_nice
    env_file:
      - /opt/docker-all/valheimserver01/valheim.env
    ports:
      - "2456-2457:2456-2457/udp"
      - "9001:9001/tcp"
    volumes:
      - /opt/docker-all/valheimserver01/config:/config
      - /opt/docker-all/valheimserver01/data:/opt/valheim
    stop_grace_period: 2m
    restart: unless-stopped

Using this valheim.env file: https://paste.ec/paste/-PqHhBIZ#TSOHidn4YGtECuby6VrwYfHOVemAEh24Eji77B076C+

My entire /opt/docker-all/valheimserver01 folder can be downloaded here: https://gofile.io/d/Idabcd

Password for the 7z is mydayyy

The modpack used for the client: https://valheim.thunderstore.io/package/NSCBOX/NSCBOX_ModPack/

Mydayyy commented 1 year ago

Greetings,

I tried to reproduce it with the configs and modlist of yours, but unfortunately I did not manage to get it to run. Connecting to the server always failed with an error message.

Looking at it from a different perspective:

Do your server mates have the same issue? Maybe the mod on the server is working fine and its your client which does not send the pin properly.

ghost commented 1 year ago

Hey again! Thank you so much for the help so far diagnosing whatever's going on.

I think I figured out what causes it. It's the -crossplay option, which enables something called PlayFab, which enables crossplay.

When disabling that, everything works fine. The error that previously popped up, that you mentioned in another comment, is also gone when removing the -crossplay argument from the steamcmd launcher.

It would be nice if the -crossplay could be supported, since that seems to make the networking a bit more stable in Valheim. If it's not possible, then oh well, back to the regular network 👍

Mydayyy commented 1 year ago

Hey!

Thanks for getting back to me on that. And nice job on tracing it back down to -crossplay, I did not even know that that option exists. I will look into what exactly that command does behind the scenes.

Best Regards

Dshadeslayer commented 1 year ago

This is happening to me, how did you get it to work? We have none of the mods that other person is talking about.

Dshadeslayer commented 1 year ago

Also, disabling this mod makes it so the mod MoreSlots doesn't work visually.

ghost commented 1 year ago

This is happening to me, how did you get it to work? We have none of the mods that other person is talking about.

To remove the PlayFab server magic, you'll need to remove the -crossplay from your SteamCMD launch options, when you're launching your server.

I'm not sure how exactly you're running your server, so I hope that whatever I wrote makes sense in your server environment.

Dshadeslayer commented 1 year ago

This is happening to me, how did you get it to work? We have none of the mods that other person is talking about.

To remove the PlayFab server magic, you'll need to remove the -crossplay from your SteamCMD launch options, when you're launching your server.

I'm not sure how exactly you're running your server, so I hope that whatever I wrote makes sense in your server environment.

I don't have that in my launch options, and we've not been launching with Crossplay, unless you mean somehow making it so the option for crossplay in Valheim never shows up.

Dshadeslayer commented 1 year ago

To clarify also, we're not doing a dedicated- we are simply doing "I launch the game and enable server".

Weirdly, one map marker stayed but NONE of the others will now. It's very, very confusing.

All we want is a way to have the map shared between us so we can see things between the two of us.

Schtorsk commented 1 year ago

I'm experiencing the same issue. It looks like it's working great if the world save is local ( saved in C:\Users\XXX\AppData\LocalLow\IronGate\Valheim\worlds_local ), but it won't work if the world saved uses Steam Cloud ( saved in C:\Program Files (x86)\Steam\userdata\XXX\892970\remote\worlds ).

Is there any chance this could be fixed? I would hate to lose my world because I can't use Steam Cloud anymore.

My two cents: With local save, I get the following logs:

[Info   :ServerSideMap] World .explored save path: C:/Users/XXX/AppData/LocalLow/IronGate/Valheim/worlds_local/Jolltun
[Info   :ServerSideMap] loaded from existing explore file

With Steam Cloud, I get:

[Info   :ServerSideMap] World .explored save path: /worlds/Jolltun
[Info   :ServerSideMap] new explore file generated

Even though I do have the .mod.serversidemap.explored file in C:\Program Files (x86)\Steam\userdata\XXX\892970\remote\worlds For some reason, in SaveWorld.cs, world.GetDBPath() is returning an absolute path when the save is local and a relative path when the world is in cloud save. The issue might be that the correct relative path would be worlds/Jolltun and not /worlds/Jolltun, you need to trim the first slash. Hope this helps!

Mydayyy commented 1 year ago

@Schtorsk

Are you using a dedicated stand alone server or did you tick the Start Server checkbox when starting the game?

As far as I can see the situation with cloud saves is the following:

1) Valheim stores whether a world is saved locally or inside the cloud

2) If it is saved locally, valheim is using normal file operation to load/save the file and additionally knows the exact save path of the world

3) If it is saved inside the steam cloud, valheim does not know the actual file save path (and neither will I be able to) since it is using the steam api to save/write cloud save files. The path you see /worlds/Jolltun is passed to the steam api as: Put this into the users cloud folder under /worlds/Jolltun. The game does not have any knowledge where the save is located.

My mod then in turns tries to open /worlds/Jolltun for which it hopefully does not have any permissions, since it thinks thats where the path for the world file is located.

So basically there are two options:

1) Disable the plugin for saves that are using cloud saves

2) Use a user supplied directory to store the .explored file in, this has caveats:

Schtorsk commented 1 year ago

I am using the "Start Server" checkbox directly ingame.

I see. Is there no mod utility that allows to communicate with Steam Cloud's API?

Mydayyy commented 1 year ago

Greetings,

I am using the "Start Server" checkbox directly ingame.

Yea, so it appears that this is due to the steamcloud issue.

I see. Is there no mod utility that allows to communicate with Steam Cloud's API?

There should be, but unfortunately I do not have much time currently to spend on this; I'd be happy to accept a PR if someone wants to submit it - otherwise I would go with an easier solution

Muramas commented 1 year ago

My friend and I are also experiencing this issue. We are launching with thunderstore and when we leave the server all the new markers are gone.

Mydayyy commented 1 year ago

My friend and I are also experiencing this issue. We are launching with thunderstore and when we leave the server all the new markers are gone.

Hi! How are you starting the server? Is it a dedicated one or the client built-in? And if the latter, are you using cloud saves?

Muramas commented 1 year ago

They are starting it from in-game built-in, do you think disabling steam cloud save on valheim would fix it?

Muramas commented 1 year ago

okay I think we did a workaround

On the server (and possibly on the clients) -Open the game and go to character select, manage the character and change it to local from cloud -Exit game -Right click the game in steam and disable steam cloud save -Run the game again as normal

We did this for both of us and it worked. Without changing the character to local they will not show up....also might want to turn it back on later to save character after done playing if you want to preserve the character.

Mydayyy commented 1 year ago

They are starting it from in-game built-in, do you think disabling steam cloud save on valheim would fix it?

Yea sadly thats the situation currently. Cloud saves were added later on and thus the plugin was written without it. Additionally they were implemented in a way where the mod silently fails if they are enabled