IhanaMies / LootValue

2 stars 13 forks source link

Cached prices for multiplayer and remote server environments #11

Open esbe1175 opened 4 months ago

esbe1175 commented 4 months ago

With the boom in multiplayer SPT, a couple of issues have become noticeable.

Whenever you hover over items, the client requests flea price info from the server. Locally, this is not a problem, as the exchange is near-instant. However, when connected to a remote server (say, with 140 ping), you will experience severe stutters, as the client "freezes" while waiting for a response from the server. You can disable in-raid flea prices, which helps keep this issue out of actual gameplay, but this is a bit of a bandaid solution, given how useful LootValue is otherwise.

The second issue is that whenever multiple people are connected to the same server, the constant requesting of prices slows down the server noticeably. I am playing on a server with 5-10 players connected at once, and all the requests are causing issues.

I am not super knowledgeable about SPT from a coding perspective, but I would propose having prices cached server-side and then distributed to the clients periodically. This would transform many small requests into one larger request, as well as solve the stuttering issue since we would no longer be waiting for a response; we would just read the cached prices.

As to how often the price list should be distributed, it could be every hour, plus whenever you launch the client. Alternatively, it could be whenever you enter a raid or whatever makes the most sense.

I hope this is something you could take a look at 🤗

Vaelek commented 3 months ago

Seconded. Something needs to change with this for remote server use. Even just adding a band-aid setting for the cache time would help for now. Last I looked at the source it was 5 minutes. If I can set it to hours and then just deal with caching everything once per session that would be less painful. Moving the mouse over a pile of weapons with lots of attachments is the worst.

esbe1175 commented 3 months ago

Seconded. Something needs to change with this for remote server use. Even just adding a band-aid setting for the cache time would help for now. Last I looked at the source it was 5 minutes. If I can set it to hours and then just deal with caching everything once per session that would be less painful. Moving the mouse over a pile of weapons with lots of attachments is the worst.

as it happens, IhanaMies updated the Hub page to show that this is something that's being worked on, though without an ETA. Hopefuly shouldn't be too long!