Hi! This is my first time posting so please pardon me if I missed anything! Recently bought this great assets!
I am trying to create a multiplayer game, to simplify things, I have mySQL storing all the files that were created by individual players. eg:
-5 players files are saved as a blob in mySQL (5 PlayerData.ES3)
-Each file contains let's say Username, and first name in each Json
-Is there a way where I can loop through all the above 5 files to check the username for duplication somehow like how SQL works? Don't have to be like SQL but any method to loop and does not affect performance issue
Hope to hear from you soon!
Best Method to Search Values on Files
Re: Best Method to Search Values on Files
Hi there, and thanks for getting in contact.
The most efficient way to access keys in a file is to load them into the cache. I.e. something like this:
For more information on caching please see this guide:
https://docs.moodkie.com/easy-save-3/es ... rformance/
All the best,
Joel
The most efficient way to access keys in a file is to load them into the cache. I.e. something like this:
Code: Select all
var settings = new ES3Settings(ES3.Location.Cache);
foreach(var file in ES3.GetFiles())
{
ES3.CacheFile(file);
var username = ES3.Load<string>("username", settings);
var firstName = ES3.Load<string>("firstName", settings);
}
https://docs.moodkie.com/easy-save-3/es ... rformance/
All the best,
Joel
Re: Best Method to Search Values on Files
Hi Joel,
Thank you for your fast response! Does that mean that if I have 1000 players, I have to load all the files to cache? Sorry as I tried to read the documentation and are not able to catch it due to my own fault I actually wanted to do a highscore by getting all the same keys and compare the scores.
Thanks again Joel, this asset is really amazing!
Thank you for your fast response! Does that mean that if I have 1000 players, I have to load all the files to cache? Sorry as I tried to read the documentation and are not able to catch it due to my own fault I actually wanted to do a highscore by getting all the same keys and compare the scores.
Thanks again Joel, this asset is really amazing!
Re: Best Method to Search Values on Files
Hi there,
That is correct, as it's not possible to know what's inside a file without opening it. I would recommend using ES3.Load to load from each of them first, and if you're finding this causes issues with performance then try using caching.
All the best,
Joel
That is correct, as it's not possible to know what's inside a file without opening it. I would recommend using ES3.Load to load from each of them first, and if you're finding this causes issues with performance then try using caching.
All the best,
Joel