otavepto / gbe_fork

Fork of https://gitlab.com/Mr_Goldberg/goldberg_emulator
https://gitlab.com/Mr_Goldberg/goldberg_emulator
GNU Lesser General Public License v3.0
191 stars 55 forks source link

PLAYERS STATS (Steam_GameServerStats) #95

Closed cccpvs closed 3 months ago

cccpvs commented 3 months ago

Connection server console game "Survive the Nights"

FAILING TO GET THIS PLAYERS STATS RequestStats - failed, k_EResultFail result ?k_EResultOK
FAIL to get stats for user 7**611**01**27**7 1 time. Trying again.
otavepto commented 3 months ago

Please provide more details

Player stats APIs are working fine for other games

cccpvs commented 3 months ago

Debug log

ClientGame STEAM_LOG.txt ServerGame STEAM_LOG.txt ServerGameConsole serverlogerror.txt

What is your setup

debug steam_api64.dll

Did you try the other setup types

Standard api substitutions only

What are you even trying to achieve or do

Running the client and server with this api working. But when connecting to the server, an error comes out and the client is thrown to the main menu. The server continues to work.

How is this a problem, please explain what limitations is this imposing

When connecting to the server, the client has an error that it does not receive the parameters of its statistics. Therefore, the server disconnects it. The message comes out Clipboard 1

And a link to fix this error https://survivethenights.fandom.com/wiki/Issue

It would also help if you posted your steam_settings folder

steam_settings\achievements.json
steam_settings\mods.json
steam_settings\stats.txt
steam_settings\mods\2902526628\2902526628.sfv
steam_settings\mods\2902526628\Preview.png
steam_settings\mods\2902526628\ServerConfig.txt
steam_settings\mods\2902526628\ServerConfig.txt.meta
steam_settings\mods\2902526628\ServerUsers.txt
steam_settings\mods\2902526628\ServerUsers.txt.meta
steam_settings\mods\2902526628\ServerUsers_README.txt
steam_settings\mods\2902526628\ServerUsers_README.txt.meta
steam_settings\mods\2902526628\StreamLabs.meta
steam_settings\mods\2902526628\TpPresets.json
steam_settings\mods\2902526628\TpPresets.json.meta
steam_settings\mods\2902526628\TpPresets_README.txt
steam_settings\mods\2902526628\TpPresets_README.txt.meta
steam_settings\mods\2902526628\UserPermissions.json
steam_settings\mods\2902526628\UserPermissions.json.meta
steam_settings\mods\2902526628\UserPermissions_README.txt
steam_settings\mods\2902526628\UserPermissions_README.txt.meta
otavepto commented 3 months ago

Note to anyone interested, the APIs for the user data queried by Steam_GameServerStats are currently set to always fail, the issue described here comes from this function https://github.com/otavepto/gbe_fork/blob/a74f986b97ed20fcff4bb4964379675a9adb83e1/dll/steam_gameserverstats.cpp#L34-L41

The server will always fail to download/query the user data. The other user stats APIs are also not implemented yet.

otavepto commented 3 months ago

Got it working with the linked PR, I could join a locally hosted server. @cccpvs Test the build artifact from the attached PR, go with the debug build and ignore release build, just in case something goes wrong to share debug logs.

https://github.com/otavepto/gbe_fork/actions/runs/8399695586?pr=106

cccpvs commented 3 months ago

Logs Client-Server

log local connect.zip

Logs Client and DedicatedServer

log DedicatedServer connect.zip

Information

The connection was successful. It was not possible to test the operation completely. It will take some time. There is a problem that used to be on earlier versions of the game when emulating api. Zombies when hitting and falling to the ground, teleport to the player and hit again.

I will attach a video of the problem.

https://github.com/otavepto/gbe_fork/assets/93628981/52b07a9e-5bad-4d14-9e97-b2b72ed271a6

In the next few days I will try to see more detailed work of the server and client.

otavepto commented 3 months ago

The connection was successful. It was not possible to test the operation completely. It will take some time.

Nice, I'll merge this PR soon. As for the zombies problem, if you find any clues on what's missing or what might be the problem let me know any time. I'll see if I spot anything from the logs.

otavepto commented 3 months ago

Alright, so I made some mistakes which resulted in this behavior, now I could kill 2 zombies, unlock stats and achievements properly. Try the new build once it's done: https://github.com/otavepto/gbe_fork/actions/runs/8403939102?pr=106

cccpvs commented 3 months ago

LOGS

log DedicatedServer connect.zip

ZOMBI

Yes after the update zombies started behaving normally. But we'll have to see how it goes.

https://github.com/otavepto/gbe_fork/assets/93628981/2980a8e2-0769-49ff-9f58-5bc16d59cf81

achievements

After the update I noticed that the server log became smaller and there are no errors. And also appeared achievements. SurviveTheNights_Win_2024_03_24_18_58_08_428

I think I will check more tests of the game and describe something important.

cccpvs commented 3 months ago

Noticed a few things

Statistics retention

If you create in the folder with the game near steam_api64.dll folder settings steam_settings and insert there two files

and only then the folder in

C:\Users\user\AppData\Roaming\Goldberg SteamEmu Saves\541300\

with files stats and achievements is created. Here's a list of some of the files the game creates when you gain experience and level up.

541300\achievements.json
541300\stats\global_player_xp_v1
541300\stats\rounds_fired
541300\stats\zombies_total

But if you don't create steam_settings folder, then there will be no folder with files on local Goldberg SteamEmu Saves files.

Saving player level

Noticed if you connect to the server after each of its launch player level is constantly 1. Apparently the server does not save it to itself.

And yes in the original server it creates log files in the server folder. But here there is nothing.

Also the server contains files:

otavepto commented 3 months ago

You can't play this game without stats and achievements, both files in steam_settings are mandatory.

The way it is coded is to ask the user on startup for their stats and levels, then it will use them as initial values. Also after each update, the server sends the new data back to you as soon as possible, so the next time the server asks for this data you'd have updated values from last session.

All of the above will fail if you don't create the stats and achievements files in steam_settings folder. Also use the same folder on both the server and game, use the generate_emu_config tool.

Don't replace steamclient dll files for the server, instead replace steam_api64.dll inside the usual Unity data folder and use the same steam_settings folder which you used for the game.

Edit: Tried it again to be sure, and every time I restart both the server and the game I'm at level 6, plus my stats are kept between sessions.

cccpvs commented 3 months ago

Yes, apparently there is a problem with the levels of the missing character. I think the issue can be closed for now.