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

Player and level metrics #6

Open
bostrt opened this issue Feb 4, 2024 · 5 comments
Open

Player and level metrics #6

bostrt opened this issue Feb 4, 2024 · 5 comments

Comments

@bostrt
Copy link
Contributor

bostrt commented Feb 4, 2024

There's a trove of information the game save files. Look into using https://github.com/cheahjs/palworld-save-tools to parse the game save and reports metrics like:

  • Player levels
  • Bases
  • Pals captured
  • etc
  • etc

The current road block is the amount of resources used to parse Levels.sav.

@sh-cho
Copy link
Contributor

sh-cho commented Feb 5, 2024

I tried use palworld-save-tools but it takes nearly 30 seconds on my M1 max mac.. 🥲

$ time palworld-save-tools Level.sav
Converting Level.sav to JSON, saving to Level.sav.json
Decompressing sav file
Loading GVAS file
Writing JSON to Level.sav.json

palworld-save-tools Level.sav  31.39s user 0.64s system 99% cpu 32.249 total

Maybe some tools like uesave-rs would be faster? But I can't find any working palworld fork of that 🥲

$ uesave to-json -i Level.sav -o Level.json
Found non-standard magic: [92, f7, 33, 07] (��3) expected: GVAS, continuing to parse...
Error: at offset 6981079: io error: failed to fill whole buffer

@bostrt
Copy link
Contributor Author

bostrt commented Feb 5, 2024

There is this: https://github.com/DKingAlpha/palworld-uesave-rs but it doesn't seem to work for me.

I'll keep an eye on these and include them once they are functional with Palworld.

@bostrt
Copy link
Contributor Author

bostrt commented Feb 5, 2024

I'm still planning on working in a feature branch to demo how the metrics might look once a good enough Level.sav parser comes around

@bostrt
Copy link
Contributor Author

bostrt commented Feb 6, 2024

Example here shows how to parse Level.sav very quickly: https://github.com/zaigie/palworld-server-tool/blob/main/module/structurer.py

I have a local test running (on a laptop) in under a second that pulls a few player properties like name, level, health, etc.

@bostrt
Copy link
Contributor Author

bostrt commented Feb 10, 2024

Well, I was able to integrate the Level.sav parsing mentioned in my last comment but performance is still not great. I have a decent sized server with ~100 player saves and a 17MB Level.sav file. I am able to generate a metrics response in ~5s on a decent laptop but its consuming about 2g of memory each time (reading the Level.sav into memory).

The isn't create since metrics gather by Prometheus is 15s by default.

I'll keep looking at ways to optimize.

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

2 participants