palworld-server-docker icon indicating copy to clipboard operation
palworld-server-docker copied to clipboard

Orange Pi 5 Max Performance improvement

Open DummyTitan opened this issue 11 months ago • 12 comments

Is your feature request related to a problem? Please describe

The main issue is that at first it was running perfectly, with of course a low fps (23 to 25 fps). The thing is, the Orange Pi 5 processor is double the performance of the RPi5, and I know of people running this fine in their RPi5. Perhaps it requires a little bit of coding or research, but no one has any info on the net currently.

Whenever I was playing with my cousin, the system tended to lag a little, but it wasn't much. After a while playing and starting our bases, a lot of lag started happening, and traspasing floors or walls wasn't uncommon, which is frustrating, and I believe it might have something to do with the emulation or some kind of setting I put.

Describe the solution you'd like

As such, if there is any way that you could add to the ARM64_DEVICE some kind of setting for the rk3588 processor, which includes multiple SOC, it would be great; if it cannot be done, no problem. And if you could make a template for making it run in something like Puferpanel, which would allow me to see in live the issues presented in the Docker, it might also help (tried with pterodactyl and it had many issues with the panel so i was unable to install it).

Describe alternatives you've considered

I have attempted turning off the multithreading and turning it on, also changing the settings for the "BOX64_DYNAREC_STRONGMEM", "BOX64_DYNAREC_BIGBLOCK", "BOX64_DYNAREC_SAFEFLAGS", "BOX64_DYNAREC_FASTROUND", "BOX64_DYNAREC_FASTNAN", "BOX64_DYNAREC_X87DOUBLE".

Additional context

env.txt json-code.txt The env.text file is the .env file I used after changing the settings a little to see if there was any improvement, and the json-code.txt is a code I made to use as a template in pufferpanel that, unfortunately, didn't get farther than pulling the Docker image.

Feature Report Checklist

  • [ ] I am willing to implement this feature

DummyTitan avatar Dec 17 '24 21:12 DummyTitan

I've added ARM64_DEVICE=rk3588 in the arm64 base image. You'll be able to test it as soon as @thijsvanloef updates the image tag. I'm not familiar with Puferpanel (and it's out of the "arm64-exclusive" scope) so I'll leave that to him as well :)

sonroyaalmerol avatar Dec 18 '24 02:12 sonroyaalmerol

@sonroyaalmerol @DummyTitan You should be able to test ARM64_DEVICE=rk3588 with the thijsvanloef/palworld-server-docker:dev image :)

thijsvanloef avatar Dec 18 '24 14:12 thijsvanloef

I reset my Box64 env config just in case and made sure to use the ARM64_DEVICE=rk3588, but did not use multithreading just in case and the lag and glitches are as always, the fps didnt see much improvement. Just in case i will try again with the multithreading on to see if there is any diffrence.

DummyTitan avatar Dec 19 '24 00:12 DummyTitan

The multithreading helped with the waiting time in the load screen, but the fps became actually a bit more erratic; when I first get in it's at 4 fps, and after a while it goes to 21, 22, and can go down to 18 or less. Just in case this is the Docker compose code I'm using. services: palworld: image: thijsvanloef/palworld-server-docker:dev restart: unless-stopped container_name: palworld-server stop_grace_period: 30s # Set to however long you are willing to wait for the container to gracefully stop ports: - 8212:8212/udp - 27015:27015/udp # - 8212:8212/tcp # Port for REST API if REST_API_ENABLED: true env_file: - /srv/dev-disk-by-uuid-044ded6a-869c-4981-ad61-d131a8ab5a5d/Storage_and_Cache/palworld/enviorment/.env volumes: - /srv/dev-disk-by-uuid-044ded6a-869c-4981-ad61-d131a8ab5a5d/Storage_and_Cache/palworld:/palworld/ devices: - '/dev/dri:/dev/dri' - '/dev/dma_heap:/dev/dma_heap' - '/dev/mali0:/dev/mali0' - '/dev/rga:/dev/rga' - '/dev/mpp_service:/dev/mpp_service' The devices I put are for the internal GPU, just in case, because I didn't know if it might make a difference since it does at least when transcoding in jellyfin. I just changed the .env file and started the Docker container again after. I don't know if I needed to delete something or not, but when I do that, OMV just rebuilds it. (Open Media Vault 7)

DummyTitan avatar Dec 19 '24 00:12 DummyTitan

Don't bother mounting your GPU device. Game servers, in general, almost never use the GPU as they're not rendering any graphics.

Unfortunately, providing a Box64 build for the rk3588 is all I can do here. I'm not a Box64 contributor, nor an expert at it.

Try playing around with the Box64 dynarec env vars again. Also, you can try setting BOX64_DYNAREC_PAUSE to either 0, 1, 2, or 3 and see if either of those makes any difference.

See the Box64 docs for more options you can experiment with: https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md

Considering the system requirements of running a Palworld server + emulation overhead, I'd say that's more or less the performance I'd expect from single board computers like your Orange Pi based on my exp.

sonroyaalmerol avatar Dec 19 '24 00:12 sonroyaalmerol

I think for Orange PI, with 8-core RK3588 chip, the default worker thread count can also be increased, maybe to 7 according to this section in Palworld docs: https://tech.palworldgame.com/settings-and-operation/arguments#regarding-performances

To apply this, we can change scripts/start.sh at line 77 (https://github.com/thijsvanloef/palworld-server-docker/blob/main/scripts/start.sh#L77) to this:

    STARTCOMMAND+=("-useperfthreads" "-NoAsyncLoadingThread" "-UseMultithreadForDS" "-NumberOfWorkerThreadsServer=$(nproc -all)")

ichlaffterlalu avatar Jan 19 '25 13:01 ichlaffterlalu

For anyone here, I wonder whether 15-20 server FPS when only 1 player connecting is considered normal or not? That seems a bit underwhelming on my Orange Pi 5 Ultra, and seemed to pale in comparison even with Raspberry Pi 5 even though Orange Pi has stronger CPU and GPU.

FYI, I've already implemented every optimization possibilities discussed here, including the one that I've requested myself. Sadly the Palworld server seemed to not fully utilizing RK3588's computational power.

ichlaffterlalu avatar Jan 21 '25 15:01 ichlaffterlalu

With performance issues like these, it usually comes down to Box64's optimizations to that specific chip. There's probably more RPi5 support due to its "popularity".

You might have better chances going through their existing issues (or you can create your own) to see if there are recommended configs for the RK3588.

Let us know if there are things that worked for you so we can integrate it into the container.

sonroyaalmerol avatar Jan 26 '25 21:01 sonroyaalmerol

After I investigate further by getting into the container's shell, seems like ARM64_DEVICE environment variable doesn't do anything.

I looked onto the code and the ARM64_DEVICE is only used once in the repository: as an ENV in Dockerfile (https://github.com/thijsvanloef/palworld-server-docker/blob/main/Dockerfile#L161). To use RK3588's potential, we need to use box64-rk3588 app. I've installed that manually on my container using apt install box64-rk3588, so it replaces the generic box64.

The performance impact is around 2 times more server FPS than using the generic box64. Usually my server runs at about 15-20 server FPS when I'm not in a base, now it runs at 35-45 server FPS. When I'm in a base, there are some occasional frame drops to 2-5 server FPS. It's expected due to having 50 pals in a single base all working 😅 It is still better than 1 server FPS using generic box64 though.

Palworld with box64-rk3588

So, I think, maybe we need to add different variations of the Docker image for each of supported ARM64 devices, as box64 isn't something you are installing after the container is made. @thijsvanloef

ichlaffterlalu avatar Jan 28 '25 16:01 ichlaffterlalu

@ichlaffterlalu It's strange, this repo uses https://github.com/sonroyaalmerol/steamcmd-arm64 which should bring all compiled variants of box64 for different devices, and the one that is used is chosen at container runtime based on the environment variable ARM64_DEVICE, not at image build time.

That being said, I am also getting really bad performance (18 FPS on RPI5 16GB) and you got a really good improvement when you installed the version for your device, so maybe there's something actually going on here @thijsvanloef?

davidreis97 avatar Jun 28 '25 00:06 davidreis97

@ichlaffterlalu It's strange, this repo uses https://github.com/sonroyaalmerol/steamcmd-arm64 which should bring all compiled variants of box64 for different devices, and the one that is used is chosen at container runtime based on the environment variable ARM64_DEVICE, not at image build time.

That being said, I am also getting really bad performance (18 FPS on RPI5 16GB) and you got a really good improvement when you installed the version for your device, so maybe there's something actually going on here @thijsvanloef?

I've installed box64-rk3588 with Dockerfile and got 35-45 fps from 10-20 fps on my Orange Pi 5 Max 16 GB

FROM thijsvanloef/palworld-server-docker:latest
RUN apt update -y && apt install -y box64-rk3588

Lanakod avatar Jul 12 '25 23:07 Lanakod

I did the same as https://github.com/thijsvanloef/palworld-server-docker/issues/640#issuecomment-3066264654, went from 5/6 FPS to 40 FPS, 60 in some less intense areas... There's definitely something weird going on with box64 / box86 @thijsvanloef

davidreis97 avatar Jul 13 '25 20:07 davidreis97