KaukausInsurgency / ki-dcs

Kaukasus Insurgency
5 stars 2 forks source link

Optimize network code #139

Open Igneous01 opened 6 years ago

Igneous01 commented 6 years ago

There are lots of places that the network traffic can be reduced and optimized.

From UpdatePlayer request, the Name property can be removed (we already have this in DB from GetOrAddPlayer)

{
    "Action": "UpdatePlayer",
    "BulkQuery": true,
    "Data": [{
        "Lives": 5,
        "Name": "Igneous01",
        "Ping": 0,
        "Role": "",
        "ServerID": 1,
        "Side": 0,
        "UCID": "a68afce32e6b1f57a6c8d10da24f1516"
    }]
}
Igneous01 commented 6 years ago

AddOrUpdateDepot

{
    "Action": "AddOrUpdateDepot",
    "BulkQuery": true,
    "Data": [{
        "Capacity": 400,
        "CurrentCapacity": 148,
        "LatLong": "43 09.899'N   44 33.885'E", -- only needed one time
        "MGRS": "38T MN 64618 79227",          -- only needed one time
        "Name": "Beslan Depot",
        "ResourceString": "Resource|Count\nInfantry|40\nWatchtower Wood|4\nOutpost Pipes|4\nAmmo Truck|4\nWatchtower Supplies|4\nPower Truck|4\nOutpost Wood|4\nCargo Crates|8\nTank|8\nFuel Tanks|8\nCommand Truck|4\nOutpost Supplies|4\nFuel Truck|4\nAPC|8\n", -- cut this into 2 strings, first is the names of resources, the second is the counts, then the first part can be ignored after first send
        "ServerID": 1,
        "Status": "Online",
        "X": 840963.0625, -- only needed one time
        "Y": -153586.4375 -- only needed one time
    },
}
Igneous01 commented 6 years ago

AddOrUpdateCapturePoint

{
    "Action": "AddOrUpdateCapturePoint",
    "BulkQuery": true,
    "Data": [{
        "BlueUnits": 41,
        "LatLong": "42 39.612'N   44 38.500'E", -- only needed one time
        "MaxCapacity": 30,
        "MGRS": "38T MN 70631 23143",         -- only needed one time
        "Name": "Kazbegi Village",
        "RedUnits": 0,
        "ServerID": 1,
        "Status": "Blue",
        "Text": -9999,                             -- only needed one time
        "Type": "CAPTUREPOINT",         -- only needed one time
        "X": 855097.1875,                      -- only needed one time
        "Y": -208836.171875                  -- only needed one time
    },
Igneous01 commented 6 years ago

AddOrUpdateSideMission

{
    "Action": "AddOrUpdateSideMission",
    "BulkQuery": true,
    "Data": [{
        "Image": "camp",  -- only needed 1 time
        "IsAdd": false, 
        "LatLong": -9999, -- only needed 1 time
        "MGRS": -9999,    -- only needed 1 time
        "ServerID": 1,
        "ServerMissionID": 1,
        "Status": "Active",
        "TaskDesc": -9999,   -- only needed 1 time
        "TaskName": -9999,   -- only needed 1 time
        "TimeRemaining": 3570,
        "X": -9999,    -- only needed 1 time
        "Y": -9999     -- only needed 1 time
    }]
}