Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to efficiently make a cross server shop?

Asked by 8 years ago

Hey guys, I'm in the process of making a big game, and need help with an idea. I want to make a cross server shop, but I'm afraid that won't be so easy, as DataStore has a limit on how many times it can be updated, and it has to be updated every time someone buys/sells something there. I'm not sure how to use HTTP Services. So can anyone help point me in the right directions?

0
Updated the answer to provide more info. You may find it of use. User#6546 35 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

Trust your gut

Apparently guts are really good. I'm a dragon I would know.
You can use DataStores. Just make sure that you leave yourself enough room for any other requests you need and you'll be good to go. When people do stuff, add it to a queue on the server, and then make sure that you only update the list every 5 seconds or so. 5 seconds is plenty fast enough, and given the 60+10*playerCount limit for servers, it is sure not to go over the limit.

Don't worry about it. Make sure you throttle your requests appropriately, and engineer your request/response structure properly - DataStores are incredibly robust, and suitable, but not magic.


Data Structure

Your data is simple enough. You won't be surpassing any storage limits, hopefully. Make sure you keep an array or dictionary of the items for sale, and the amount. Where possible, make sure that you can infer the cost or other data from within the game without having to load it in from DataStores. This will keep the data size and request costs down.

Request

Your requests are simple. Queue them up so that they're all ready to go when needed - When you add something, tell the server, but don't send it yet. See if anything else needs adding, and in a few seconds update the DataStore with all of the buy/sell requests.

Response

When you update stuff, you have a great advantage - You only need 1 request. You're getting the new data, and you're setting the new data. This has the greatly useful advantage of you being able to infer your new data without making excessive requests, and allows you to update all the new listings when you make the requests.

0
Erh, I accepted that, then realized. I'm already using DataStores for several other things.. :/ For example: Stats. Then I've created an in game friend system. So, that also adds onto it. I'm gonna go do my calculations real quick. Hopefully I can make this work. :P TinyPanda273 110 — 8y
0
I figured out a way to make this all work! :) Thank you! TinyPanda273 110 — 8y
Ad

Answer this question