#What's the most optimized way to creator a global marketplace other than httpservice.
1 messages · Page 1 of 1 (latest)
@brave flame
Use a datastore
And keep doing updateasync
But don't cache the data
Always use the value passed into the update function
In order to reduce calls you can batch operations into 1 call
is that it?
Yes
I'm not sure what players have to do with it
i dont know if roblox datastores can handle it
thats one of my concerns
bc i looked up on the devforum
and it said it could overload
and no register data
What about it are you worried it can't handle
not*
just like transfering the data to everyone across all servers
im worried it might not register
What are you transferring to everyone
Won't you just be loading the datastore once per server and sending that value to everyone
like for example i decide to sell a gun for 100 coins and i put it on the global marketplace and then i want someone to be able to purchase it in a different server and recieve it in their inv for example
its gonna update as people put in items to it
So each player can update a data store 10 times per minute
And the server can update a data store 60 times per minute
But
You should not expect the shop to be real time
What you should do is
Make the server update every 10 seconds
yeah I would expect like a delay
would that cause performance or server issues?
sorry if im asking dumb questions
its 3 am
💀
Would updating every 10 seconds be worse then updating as soon as a player adds a item to the datastore
Depends how often players are interacting with it
definitely not im just asking this if I were to update like every 30 seconds for example and make it reset each item in 24 hours and remove it off the market, and have like a 10 minute cooldown on uploading items to the market would it work fine?
You could even update once every second and it would be fine
oh alr
so this would work and I wouldnt need httpservice correct?
But the main problem is if 2 servers try to update the data store at the same time the update function can run multiple times
what would you do against that
Update every 10 seconds instead of 1 second
ok
You could have local items and global items
Then every 10 seconds move local items into the global items
lastly should I dedicate a whole datastore on like managing the marketplace items?
When you sell a item you would need to do a updateasync to remove the item
And you can't give the item to the player untill then
ok
an even better way is to
Not just blindly loop
But have like a debounce
So if an update has not happened in the last 10 seconds then instantly allow the action
But if a second player comes along then have then wait until the 10 second debouce has ended but you can still take the item from there hands and let it wait in a queue
can u keep this forum open so I can reference it