I've done some Roblox in the past and after reading the Core documentation without finding answers wonder if I can make a persistent server game on Core.
I hope the Core team can answer me whether Core has the following essential mechanics:
-
Can I store persistent data on a per-server (rather than per-player) basis?
This is required to have a changing world over time where all players make changes to the world. Note that it cannot be in player-date bcause as soon as that player logs the world would change.
There would also be a need to be able to reset the world at some point, which would also free up the server data.
-
Can the player choose (any of the) the world(s) (servers) that he has been (in and altered) previously?
Note that all these persistent servers have their own state since they were changed differently by the players on it.
Answers would be appreciated as would be short reference to the relevant api doc. If not possible it would be nice to know if and when it's planned to be implemented, or why not.
Thanks
Someone with better knowledge might answer this with more details.
But AFAIK you CAN store some persistent information not linked to a player. Not sure of the method nor the limitations.
Checkout this game: LetsPaint! by Chris - Core Games
And this Redirecting...
Also might be useful to know that you can read (not write) the Storage of an Offline Player. So maybe the "customization" that a player makes to his "World" can be saved in its personal Storage and you should be able to read it from any server instance.
HeeroYuy, thank you for your reply.
As I understand it, Shared Data is still Player data but shared between games, so that won't help in this regard.
The save server data on players and then get it back offline seems a good one on first thought but I think it will run into trouble with many players over time. When a server is respawned it then needs to rebuild the world from all players that ever played, filtered for what it needs. I guess that will take too much of a time and I read the loading offline data may fail, which would break the world.
Roblox has server-data or at least game-data but here on Core I can't find any reference. Maybe, as you say someone else knows. Not having it would limit the type of games one can build to what I call static games, which would ba a shame.
I also am no closer to finding out if there is any control in to which server you join. This is more or less linked to having server data in the first place I guess, because without every server instance is the same.
Try to use the leaderboard storage space to store game data.
Great question.
Sounds very similar to what I would like to do as well - if you do find a solution then I would be grateful if you could follow up with how you solved this problem!
Hey there,
I just did exactly what you are looking for in We were here
This is how I solved it:
I created a global leaderboard with 1000 entries max. Sadly this is a total limit, but with a bit of knowledge you could split the data on those 1000 players.
In my case I wanted to have players draw down their names multiple times in different colors.
So what I did is when a player sprays down his name, I safe this junk of data (location, rotation, scale, color) at this specific player. Furthermore I add this player to the global leaderboard with the score of 1.
(Any score would do)
Now when a server starts (first player joins) my server script runs through the leaderboard and for each entry gets the offlinestorage where all the data is safed.
If your data is not player specific at all, you can just reuse the first player of the leaderboard to store all data.
It takes some time. Thats right. But migth also be a cool animation and should only affect the first player. Maybe while they are in a loading screen so they don't see it.
Roblox has server-data or at least game-data but here on Core I can't find any reference. Maybe, as you say someone else knows. Not having it would limit the type of games one can build to what I call static games, which would ba a shame.
Sadly I couldn't find anything too. The only global storage is the offline data of players and the leaderboard (which only can store a few extra characters as string).
A Global Persistent Storage (not player focused) like a database would be awesome.
Snippet of the StartUp Logic.
Server
function SendAll()
if #Game.GetPlayers() > 0 then
for playerName, signStorage in pairs(signs) do
print("Sending sign of " .. playerName)
for i = 1, #signStorage do
local sign = signStorage[i]
while Events.BroadcastToAllPlayers("SignCreatedEvent", playerName, sign.position, sign.rotation, sign.scale, sign.color) == BroadcastEventResultCode.EXCEEDED_RATE_LIMIT do
print("Sign rate limit exceeded for " .. playerName .."'s sign. Trying again")
Task.Wait(0.1)
end
end
end
end
end
-- StartUP
function StartUp()
print("Initializing Signs")
while not Leaderboards.HasLeaderboards() do -- just keep checking until this until the Leaderboards are loaded
Task.Wait(1) -- wait one second
end
local leaderboard = Leaderboards.GetLeaderboard(propLeaderboard, LeaderboardType.GLOBAL)
for _, entry in ipairs(leaderboard) do
local signStorage = Storage.GetOfflinePlayerData(entry.id)
if signStorage then
signs[entry.name] = signStorage
end
end
setupFinished = true
SendAll()
print("Signs initialized")
end
StartUp()
Client
function OnSignCreated(text, location, rotation, scale, color)
local signText = World.SpawnAsset(propSignText, {position = location, rotation = rotation, scale = scale, parent = propSignFolder})
signText.text = text
if color == nil then
color = "#FFFFFFFF"
end
signText:SetColor(Color.FromStandardHex(color))
signText.name = "SIGN_LOCAL_" .. text
print("Sign created: " .. text)
end
Events.Connect("SignCreatedEvent", OnSignCreated)
1 Like