Greetings,
After uploading my game Profile.txt with S3, I will download all player profiles in the game every time.
But I found that the way Corona provided was quite slow.
local function AllPlayerDataFun(Order)
local lines = {}
local path = system.pathForFile( “AllData”…Order…".txt", system.DocumentsDirectory )
local file, errorString = io.open( path, “r” )
if not file then
– print( "File error: " … errorString )
else
for line in file:lines() do
table.insert( lines, line)
end
io.close( file )
Player_UID[Order] = tostring(lines[1])
Player_DisplayName[Order] = tostring(lines[2])
Player_LV[Order] = tonumber(lines[3])
Player_Head[Order] = tostring(lines[4])
Player_HeadFrame[Order] = tonumber(lines[5])
Player_TotalPower[Order] = tonumber(lines[6])
end
file = nil
lines = nil
end
for i=1,100000 do
AllPlayerDataFun(i)
end
I only tested 100,000 records (which is a very small value for online games), and it ran for 30 seconds!
I want to know if there is a faster way.
The second method I considered was to keep the information of all person in one file and upload it individually.
But this practice will cause everyone’s data to be out of sync.