aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/mainmenu/common.lua')
-rw-r--r--builtin/mainmenu/common.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index 81e28f2bb..471360581 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -45,6 +45,27 @@ local function configure_selected_world_params(idx)
end
end
+-- retrieved from https://wondernetwork.com/pings with (hopefully) representative cities
+-- Amsterdam, Auckland, Brasilia, Denver, Lagos, Singapore
+local latency_matrix = {
+ ["AF"] = { ["AS"]=258, ["EU"]=100, ["NA"]=218, ["OC"]=432, ["SA"]=308 },
+ ["AS"] = { ["EU"]=168, ["NA"]=215, ["OC"]=125, ["SA"]=366 },
+ ["EU"] = { ["NA"]=120, ["OC"]=298, ["SA"]=221 },
+ ["NA"] = { ["OC"]=202, ["SA"]=168 },
+ ["OC"] = { ["SA"]=411 },
+ ["SA"] = {}
+}
+function estimate_continent_latency(own, spec)
+ local there = spec.geo_continent
+ if not own or not there then
+ return nil
+ end
+ if own == there then
+ return 0
+ end
+ return latency_matrix[there][own] or latency_matrix[own][there]
+end
+
function render_serverlist_row(spec)
local text = ""
if spec.name then