To add on to what @overtorment said, I came up with a very easy way to scale your servers. For all of my games/services, I always create an update.lua file that runs right after main.lua. In that file, depending on what the app is, I check the app has internet, check the version code of the current version the user is using matches with the version code stored on my server, and if its a game with stored settings, I download the newest settings from my server and save them into json files using the loadsave library. In one of my games, I have multiple game modes. One very easy way for me to scale the game would be to store a php array on my server saying something like:
$settings = array(); $settings['modes'] = array( //SET THE NOOBHUB IP'S FOR EVERY MODE 'mode1' =\> '000.000.000.000', 'mode2' =\> '000.000.000.000', 'mode3' =\> '000.000.000.000', ); echo json\_encode($settings);
000.000.000.000 would be replaced with the ip of each different server that you want to use for each different mode. Then in my update.lua file, I would network.request that php file on my server, then I would say:
local modeInfo = {}
local response = json.decode(event.response)
for key,value in pairs(response) do
if key == ‘modes’ then
for key,value in pairs(value) do
modeInfo[key] = value
end
end
end
loadsave.saveTable(modeInfo, “modeInfo.json”)
Now you can go into the different lua files for each mode, and if its mode 1 for example, say:
local modeInfo = loadsave.loadTable(“modeInfo.json”)
–this will be the variable we input into the new hub connection as the ip to use
local ipUse = modeInfo[‘mode1’]
and Bam. you now control what ip address every mode uses just by changing a simple array on your website. Sorry if that was a bit lengthy, but hope it helps!
Tyler