Added network doctor stats.

This commit is contained in:
genxium 2023-01-22 11:34:02 +08:00
parent 1c6ad5c8f8
commit 59767c1ed5
11 changed files with 489 additions and 211 deletions

View File

@ -108,3 +108,4 @@ Moreover, in practice I found that to spot sync anomalies, the following tools a
- Detection of [type#2 forceConfirmation on the backend](https://github.com/genxium/DelayNoMore/blob/v0.9.19/battle_srv/models/room.go#L1259). - Detection of [type#2 forceConfirmation on the backend](https://github.com/genxium/DelayNoMore/blob/v0.9.19/battle_srv/models/room.go#L1259).
There's also some useful information displayed on the frontend when `true == Map.showNetworkDoctorInfo`. There's also some useful information displayed on the frontend when `true == Map.showNetworkDoctorInfo`.
![networkstats](./charts/networkstats.png)

BIN
charts/networkstats.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

File diff suppressed because one or more lines are too long

View File

@ -77,12 +77,6 @@
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 48
},
{
"__id__": 49
},
{ {
"__id__": 50 "__id__": 50
}, },
@ -91,6 +85,12 @@
}, },
{ {
"__id__": 52 "__id__": 52
},
{
"__id__": 53
},
{
"__id__": 54
} }
], ],
"_prefab": null, "_prefab": null,
@ -158,7 +158,7 @@
"__id__": 5 "__id__": 5
}, },
{ {
"__id__": 47 "__id__": 49
} }
], ],
"_prefab": null, "_prefab": null,
@ -247,10 +247,10 @@
"__uuid__": "670b477e-61a1-4778-879b-35913f7c79d2" "__uuid__": "670b477e-61a1-4778-879b-35913f7c79d2"
}, },
"boundRoomIdLabel": { "boundRoomIdLabel": {
"__id__": 24 "__id__": 26
}, },
"countdownLabel": { "countdownLabel": {
"__id__": 31 "__id__": 33
}, },
"resultPanelPrefab": { "resultPanelPrefab": {
"__uuid__": "c4cfe3bd-c59e-4d5b-95cb-c933b120e184" "__uuid__": "c4cfe3bd-c59e-4d5b-95cb-c933b120e184"
@ -281,6 +281,9 @@
"rollbackFramesLabel": { "rollbackFramesLabel": {
"__id__": 19 "__id__": 19
}, },
"skippedRenderFrameCntLabel": {
"__id__": 21
},
"_id": "d12gkAmppNlIzqcRDELa91" "_id": "d12gkAmppNlIzqcRDELa91"
}, },
{ {
@ -292,13 +295,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 41 "__id__": 43
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 46 "__id__": 48
} }
], ],
"_prefab": null, "_prefab": null,
@ -360,20 +363,20 @@
{ {
"__id__": 6 "__id__": 6
}, },
{
"__id__": 30
},
{ {
"__id__": 32 "__id__": 32
}, },
{ {
"__id__": 36 "__id__": 34
},
{
"__id__": 38
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 40 "__id__": 42
} }
], ],
"_prefab": null, "_prefab": null,
@ -442,7 +445,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 29 "__id__": 31
} }
], ],
"_prefab": null, "_prefab": null,
@ -536,7 +539,7 @@
"array": [ "array": [
0, 0,
0, 0,
216.50635094610968, 210.16474188040044,
0, 0,
0, 0,
0, 0,
@ -617,15 +620,18 @@
}, },
{ {
"__id__": 20 "__id__": 20
},
{
"__id__": 22
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 27 "__id__": 29
}, },
{ {
"__id__": 28 "__id__": 30
} }
], ],
"_prefab": null, "_prefab": null,
@ -652,7 +658,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-447.294, -447.294,
135.702, 138.942,
0, 0,
0, 0,
0, 0,
@ -701,20 +707,20 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 12.24, "width": 18.33,
"height": 28.98 "height": 22.61
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
64, 0,
85.51, 88.695,
0, 0,
0, 0,
0, 0,
@ -755,10 +761,12 @@
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 22, "_fontSize": 22,
"_lineHeight": 23, "_lineHeight": 37,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": {
"_isSystemFontUsed": true, "__uuid__": "a564b3db-b8cb-48b4-952e-25bb56949116"
},
"_isSystemFontUsed": false,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 0, "_N$horizontalAlign": 0,
@ -793,20 +801,20 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 12.24, "width": 18.33,
"height": 28.98 "height": 22.61
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
64, 0,
56.53000000000001, 66.08499999999998,
0, 0,
0, 0,
0, 0,
@ -847,10 +855,12 @@
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 22, "_fontSize": 22,
"_lineHeight": 23, "_lineHeight": 37,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": {
"_isSystemFontUsed": true, "__uuid__": "a564b3db-b8cb-48b4-952e-25bb56949116"
},
"_isSystemFontUsed": false,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 0, "_N$horizontalAlign": 0,
@ -885,20 +895,20 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 12.24, "width": 18.33,
"height": 28.98 "height": 22.61
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
64, 0,
27.550000000000004, 43.47499999999998,
0, 0,
0, 0,
0, 0,
@ -939,10 +949,12 @@
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 22, "_fontSize": 22,
"_lineHeight": 23, "_lineHeight": 37,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": {
"_isSystemFontUsed": true, "__uuid__": "a564b3db-b8cb-48b4-952e-25bb56949116"
},
"_isSystemFontUsed": false,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 0, "_N$horizontalAlign": 0,
@ -977,20 +989,20 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 12.24, "width": 18.33,
"height": 28.98 "height": 22.61
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
64, 0,
-1.4299999999999962, 20.86499999999998,
0, 0,
0, 0,
0, 0,
@ -1031,10 +1043,12 @@
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 22, "_fontSize": 22,
"_lineHeight": 23, "_lineHeight": 37,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": {
"_isSystemFontUsed": true, "__uuid__": "a564b3db-b8cb-48b4-952e-25bb56949116"
},
"_isSystemFontUsed": false,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 0, "_N$horizontalAlign": 0,
@ -1044,6 +1058,100 @@
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "77aNARt1VATLsjIzwbqvkh" "_id": "77aNARt1VATLsjIzwbqvkh"
}, },
{
"__type__": "cc.Node",
"_name": "skippedCnt",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 21
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 243,
"g": 225,
"b": 11,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 18.33,
"height": 22.61
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-1.7450000000000188,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "cdlF8Z8TZEdLRHQQ8T8qX7"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_useOriginalSize": false,
"_string": "0",
"_N$string": "0",
"_fontSize": 22,
"_lineHeight": 37,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "a564b3db-b8cb-48b4-952e-25bb56949116"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "2flWrlaK1PeJMUB/in+S1W"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "RoomIdIndicator", "_name": "RoomIdIndicator",
@ -1053,19 +1161,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 21 "__id__": 23
}, },
{ {
"__id__": 23 "__id__": 25
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 25 "__id__": 27
}, },
{ {
"__id__": 26 "__id__": 28
} }
], ],
"_prefab": null, "_prefab": null,
@ -1121,13 +1229,13 @@
"_name": "label", "_name": "label",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 20 "__id__": 22
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 22 "__id__": 24
} }
], ],
"_prefab": null, "_prefab": null,
@ -1183,7 +1291,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 21 "__id__": 23
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
@ -1211,13 +1319,13 @@
"_name": "BoundRoomIdLabel", "_name": "BoundRoomIdLabel",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 20 "__id__": 22
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 24 "__id__": 26
} }
], ],
"_prefab": null, "_prefab": null,
@ -1273,7 +1381,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 23 "__id__": 25
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
@ -1301,7 +1409,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 20 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"_layoutSize": { "_layoutSize": {
@ -1334,7 +1442,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 20 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
@ -1456,7 +1564,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 31 "__id__": 33
} }
], ],
"_prefab": null, "_prefab": null,
@ -1512,7 +1620,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 30 "__id__": 32
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1546,7 +1654,7 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 33 "__id__": 35
} }
], ],
"_active": true, "_active": true,
@ -1604,16 +1712,16 @@
"_name": "Background", "_name": "Background",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 32 "__id__": 34
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 34 "__id__": 36
}, },
{ {
"__id__": 35 "__id__": 37
} }
], ],
"_prefab": null, "_prefab": null,
@ -1669,7 +1777,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 33 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1703,7 +1811,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 33 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
@ -1734,7 +1842,7 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 37 "__id__": 39
} }
], ],
"_active": true, "_active": true,
@ -1792,16 +1900,16 @@
"_name": "Background", "_name": "Background",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 36 "__id__": 38
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 38 "__id__": 40
}, },
{ {
"__id__": 39 "__id__": 41
} }
], ],
"_prefab": null, "_prefab": null,
@ -1857,7 +1965,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 37 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1891,7 +1999,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 37 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
@ -1949,16 +2057,16 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 42 "__id__": 44
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 44 "__id__": 46
}, },
{ {
"__id__": 45 "__id__": 47
} }
], ],
"_prefab": null, "_prefab": null,
@ -2014,13 +2122,13 @@
"_name": "Joystick", "_name": "Joystick",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 41 "__id__": 43
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 43 "__id__": 45
} }
], ],
"_prefab": null, "_prefab": null,
@ -2076,7 +2184,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 42 "__id__": 44
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -2110,7 +2218,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 41 "__id__": 43
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -2144,7 +2252,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 41 "__id__": 43
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
@ -2297,10 +2405,10 @@
"__id__": 3 "__id__": 3
}, },
"stickhead": { "stickhead": {
"__id__": 42 "__id__": 44
}, },
"base": { "base": {
"__id__": 41 "__id__": 43
}, },
"joyStickEps": 0.1, "joyStickEps": 0.1,
"magicLeanLowerBound": 0.414, "magicLeanLowerBound": 0.414,
@ -2321,10 +2429,10 @@
"linearMovingEps": 0.1, "linearMovingEps": 0.1,
"scaleByEps": 0.0375, "scaleByEps": 0.0375,
"btnA": { "btnA": {
"__id__": 32 "__id__": 34
}, },
"btnB": { "btnB": {
"__id__": 36 "__id__": 38
}, },
"_id": "e9oVYTr7ROlpp/IrNjBUmR" "_id": "e9oVYTr7ROlpp/IrNjBUmR"
} }

View File

@ -362,7 +362,7 @@
"array": [ "array": [
0, 0,
0, 0,
216.50635094610968, 216.6734179122529,
0, 0,
0, 0,
0, 0,

View File

@ -77,12 +77,6 @@
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 47
},
{
"__id__": 48
},
{ {
"__id__": 49 "__id__": 49
}, },
@ -91,6 +85,12 @@
}, },
{ {
"__id__": 51 "__id__": 51
},
{
"__id__": 52
},
{
"__id__": 53
} }
], ],
"_prefab": null, "_prefab": null,
@ -291,6 +291,7 @@
"rollbackFramesLabel": { "rollbackFramesLabel": {
"__id__": 20 "__id__": 20
}, },
"skippedRenderFrameCntLabel": null,
"_id": "e5xQdv12xLoIRr0b36Pie+" "_id": "e5xQdv12xLoIRr0b36Pie+"
}, },
{ {
@ -302,13 +303,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 41 "__id__": 43
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 46 "__id__": 48
} }
], ],
"_prefab": null, "_prefab": null,
@ -370,20 +371,20 @@
{ {
"__id__": 7 "__id__": 7
}, },
{
"__id__": 30
},
{ {
"__id__": 32 "__id__": 32
}, },
{ {
"__id__": 36 "__id__": 34
},
{
"__id__": 38
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 40 "__id__": 42
} }
], ],
"_prefab": null, "_prefab": null,
@ -452,7 +453,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 29 "__id__": 31
} }
], ],
"_prefab": null, "_prefab": null,
@ -546,7 +547,7 @@
"array": [ "array": [
0, 0,
0, 0,
216.50635094610968, 216.6734179122529,
0, 0,
0, 0,
0, 0,
@ -627,12 +628,15 @@
}, },
{ {
"__id__": 21 "__id__": 21
},
{
"__id__": 23
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 28 "__id__": 30
} }
], ],
"_prefab": null, "_prefab": null,
@ -708,12 +712,12 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 22.25, "width": 12.24,
"height": 50.4 "height": 28.98
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
@ -721,7 +725,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
71.7, 76.48,
0, 0,
0, 0,
0, 0,
@ -761,14 +765,14 @@
"_useOriginalSize": false, "_useOriginalSize": false,
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 40, "_fontSize": 22,
"_lineHeight": 40, "_lineHeight": 23,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": null,
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 1, "_N$horizontalAlign": 0,
"_N$verticalAlign": 1, "_N$verticalAlign": 1,
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
@ -800,12 +804,12 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 22.25, "width": 12.24,
"height": 50.4 "height": 28.98
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
@ -813,7 +817,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
23.899999999999995, 38.239999999999995,
0, 0,
0, 0,
0, 0,
@ -853,14 +857,14 @@
"_useOriginalSize": false, "_useOriginalSize": false,
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 40, "_fontSize": 22,
"_lineHeight": 40, "_lineHeight": 23,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": null,
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 1, "_N$horizontalAlign": 0,
"_N$verticalAlign": 1, "_N$verticalAlign": 1,
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
@ -892,12 +896,12 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 22.25, "width": 12.24,
"height": 50.4 "height": 28.98
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
@ -905,7 +909,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-23.90000000000001, -7.105427357601002e-15,
0, 0,
0, 0,
0, 0,
@ -945,14 +949,14 @@
"_useOriginalSize": false, "_useOriginalSize": false,
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 40, "_fontSize": 22,
"_lineHeight": 40, "_lineHeight": 23,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": null,
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 1, "_N$horizontalAlign": 0,
"_N$verticalAlign": 1, "_N$verticalAlign": 1,
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
@ -984,12 +988,12 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 22.25, "width": 12.24,
"height": 50.4 "height": 28.98
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
@ -997,7 +1001,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-71.70000000000002, -38.24000000000001,
0, 0,
0, 0,
0, 0,
@ -1037,20 +1041,114 @@
"_useOriginalSize": false, "_useOriginalSize": false,
"_string": "0", "_string": "0",
"_N$string": "0", "_N$string": "0",
"_fontSize": 40, "_fontSize": 22,
"_lineHeight": 40, "_lineHeight": 23,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": null, "_N$file": null,
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
"_spacingX": 0, "_spacingX": 0,
"_batchAsBitmap": false, "_batchAsBitmap": false,
"_N$horizontalAlign": 1, "_N$horizontalAlign": 0,
"_N$verticalAlign": 1, "_N$verticalAlign": 1,
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "b1otN9g0xJP7pEDUey3UUZ" "_id": "b1otN9g0xJP7pEDUey3UUZ"
}, },
{
"__type__": "cc.Node",
"_name": "skippedCnt",
"_objFlags": 0,
"_parent": {
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 22
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 235,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 18.33,
"height": 14.06
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-76.48000000000002,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "4etY2F7V5E36duhglRpOwR"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_useOriginalSize": false,
"_string": "0",
"_N$string": "0",
"_fontSize": 22,
"_lineHeight": 23,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "a564b3db-b8cb-48b4-952e-25bb56949116"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "8bw7zNg/dIv7MaYIupTzUw"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "RoomIdIndicator", "_name": "RoomIdIndicator",
@ -1060,19 +1158,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 22 "__id__": 24
}, },
{ {
"__id__": 24 "__id__": 26
} }
], ],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 26 "__id__": 28
}, },
{ {
"__id__": 27 "__id__": 29
} }
], ],
"_prefab": null, "_prefab": null,
@ -1128,13 +1226,13 @@
"_name": "label", "_name": "label",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 21 "__id__": 23
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 25
} }
], ],
"_prefab": null, "_prefab": null,
@ -1190,7 +1288,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 22 "__id__": 24
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
@ -1218,13 +1316,13 @@
"_name": "BoundRoomIdLabel", "_name": "BoundRoomIdLabel",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 21 "__id__": 23
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 25 "__id__": 27
} }
], ],
"_prefab": null, "_prefab": null,
@ -1280,7 +1378,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 24 "__id__": 26
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
@ -1308,7 +1406,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 21 "__id__": 23
}, },
"_enabled": true, "_enabled": true,
"_layoutSize": { "_layoutSize": {
@ -1341,7 +1439,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 21 "__id__": 23
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
@ -1437,7 +1535,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 31 "__id__": 33
} }
], ],
"_prefab": null, "_prefab": null,
@ -1493,7 +1591,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 30 "__id__": 32
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1527,7 +1625,7 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 33 "__id__": 35
} }
], ],
"_active": true, "_active": true,
@ -1585,16 +1683,16 @@
"_name": "Background", "_name": "Background",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 32 "__id__": 34
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 34 "__id__": 36
}, },
{ {
"__id__": 35 "__id__": 37
} }
], ],
"_prefab": null, "_prefab": null,
@ -1650,7 +1748,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 33 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1684,7 +1782,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 33 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
@ -1715,7 +1813,7 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 37 "__id__": 39
} }
], ],
"_active": true, "_active": true,
@ -1773,16 +1871,16 @@
"_name": "Background", "_name": "Background",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 36 "__id__": 38
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 38 "__id__": 40
}, },
{ {
"__id__": 39 "__id__": 41
} }
], ],
"_prefab": null, "_prefab": null,
@ -1838,7 +1936,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 37 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -1872,7 +1970,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 37 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
@ -1930,16 +2028,16 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 42 "__id__": 44
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 44 "__id__": 46
}, },
{ {
"__id__": 45 "__id__": 47
} }
], ],
"_prefab": null, "_prefab": null,
@ -1995,13 +2093,13 @@
"_name": "Joystick", "_name": "Joystick",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 41 "__id__": 43
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 43 "__id__": 45
} }
], ],
"_prefab": null, "_prefab": null,
@ -2057,7 +2155,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 42 "__id__": 44
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -2091,7 +2189,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 41 "__id__": 43
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
@ -2125,7 +2223,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 41 "__id__": 43
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
@ -2260,10 +2358,10 @@
"__id__": 3 "__id__": 3
}, },
"stickhead": { "stickhead": {
"__id__": 42 "__id__": 44
}, },
"base": { "base": {
"__id__": 41 "__id__": 43
}, },
"joyStickEps": 0.1, "joyStickEps": 0.1,
"magicLeanLowerBound": 0.414, "magicLeanLowerBound": 0.414,
@ -2284,10 +2382,10 @@
"linearMovingEps": 0.1, "linearMovingEps": 0.1,
"scaleByEps": 0.0375, "scaleByEps": 0.0375,
"btnA": { "btnA": {
"__id__": 32 "__id__": 34
}, },
"btnB": { "btnB": {
"__id__": 36 "__id__": 38
}, },
"_id": "e9oVYTr7ROlpp/IrNjBUmR" "_id": "e9oVYTr7ROlpp/IrNjBUmR"
} }

View File

@ -113,6 +113,10 @@ cc.Class({
type: cc.Label, type: cc.Label,
default: null default: null
}, },
skippedRenderFrameCntLabel: {
type: cc.Label,
default: null
}
}, },
_inputFrameIdDebuggable(inputFrameId) { _inputFrameIdDebuggable(inputFrameId) {
@ -351,6 +355,7 @@ cc.Class({
self.rdfIdToActuallyUsedInput = new Map(); self.rdfIdToActuallyUsedInput = new Map();
self.networkDoctor = new NetworkDoctor(20); self.networkDoctor = new NetworkDoctor(20);
self.skipRenderFrameFlag = false;
self.countdownNanos = null; self.countdownNanos = null;
if (self.countdownLabel) { if (self.countdownLabel) {
@ -702,6 +707,7 @@ cc.Class({
self.lastRenderFrameIdTriggeredAt = performance.now(); self.lastRenderFrameIdTriggeredAt = performance.now();
// In this case it must be true that "rdf.id > chaserRenderFrameId". // In this case it must be true that "rdf.id > chaserRenderFrameId".
self.chaserRenderFrameId = rdf.Id; self.chaserRenderFrameId = rdf.Id;
self.networkDoctor.logRollbackFrames(0);
const canvasNode = self.canvasNode; const canvasNode = self.canvasNode;
self.ctrl = canvasNode.getComponent("TouchEventsManager"); self.ctrl = canvasNode.getComponent("TouchEventsManager");
@ -852,12 +858,12 @@ cc.Class({
-------------------------------------------------------- --------------------------------------------------------
*/ */
// The actual rollback-and-chase would later be executed in update(dt). // The actual rollback-and-chase would later be executed in update(dt).
self.networkDoctor.immediateRollbackFrames = (self.renderFrameId - renderFrameId1);
console.log(`Mismatched input detected, resetting chaserRenderFrameId: ${self.chaserRenderFrameId}->${renderFrameId1} by firstPredictedYetIncorrectInputFrameId: ${firstPredictedYetIncorrectInputFrameId} console.log(`Mismatched input detected, resetting chaserRenderFrameId: ${self.chaserRenderFrameId}->${renderFrameId1} by firstPredictedYetIncorrectInputFrameId: ${firstPredictedYetIncorrectInputFrameId}
lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId} lastAllConfirmedInputFrameId=${self.lastAllConfirmedInputFrameId}
recentInputCache=${self._stringifyRecentInputCache(false)} recentInputCache=${self._stringifyRecentInputCache(false)}
batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inputFrameId}]`); batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inputFrameId}]`);
self.chaserRenderFrameId = renderFrameId1; self.chaserRenderFrameId = renderFrameId1;
self.networkDoctor.logRollbackFrames(self.renderFrameId - self.chaserRenderFrameId);
}, },
onPeerInputFrameUpsync(peerJoinIndex, batch /* []*pb.InputFrameDownsync */ ) { onPeerInputFrameUpsync(peerJoinIndex, batch /* []*pb.InputFrameDownsync */ ) {
@ -874,7 +880,7 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
return; return;
} }
self.networkDoctor.logPeerInputFrameUpsync(batch[0].inputFrameId, batch[batch.length - 1].inputFrameId); let effCnt = 0;
//console.log(`Received peer inputFrameUpsync batch w/ inputFrameId in [${batch[0].inputFrameId}, ${batch[batch.length - 1].inputFrameId}] for prediction assistance`); //console.log(`Received peer inputFrameUpsync batch w/ inputFrameId in [${batch[0].inputFrameId}, ${batch[batch.length - 1].inputFrameId}] for prediction assistance`);
for (let k in batch) { for (let k in batch) {
const inputFrameDownsync = batch[k]; const inputFrameDownsync = batch[k];
@ -882,11 +888,15 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
if (inputFrameDownsyncId <= self.lastAllConfirmedInputFrameId) { if (inputFrameDownsyncId <= self.lastAllConfirmedInputFrameId) {
continue; continue;
} }
effCnt += 1;
self.getOrPrefabInputFrameUpsync(inputFrameDownsyncId); // Make sure that inputFrame exists locally self.getOrPrefabInputFrameUpsync(inputFrameDownsyncId); // Make sure that inputFrame exists locally
const existingInputFrame = self.recentInputCache.GetByFrameId(inputFrameDownsyncId); const existingInputFrame = self.recentInputCache.GetByFrameId(inputFrameDownsyncId);
existingInputFrame.InputList[peerJoinIndex - 1] = inputFrameDownsync.inputList[peerJoinIndex - 1]; // No need to change "confirmedList", leave it to "onInputFrameDownsyncBatch" -- we're just helping prediction here existingInputFrame.InputList[peerJoinIndex - 1] = inputFrameDownsync.inputList[peerJoinIndex - 1]; // No need to change "confirmedList", leave it to "onInputFrameDownsyncBatch" -- we're just helping prediction here
self.recentInputCache.SetByFrameId(existingInputFrame, inputFrameDownsyncId); self.recentInputCache.SetByFrameId(existingInputFrame, inputFrameDownsyncId);
} }
if (0 < effCnt) {
self.networkDoctor.logPeerInputFrameUpsync(batch[0].inputFrameId, batch[batch.length - 1].inputFrameId);
}
}, },
onPlayerAdded(rdf /* pb.RoomDownsyncFrame */ ) { onPlayerAdded(rdf /* pb.RoomDownsyncFrame */ ) {
@ -960,6 +970,11 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
Kindly note that Significantly different network bandwidths or delay fluctuations would result in frequent [type#1 forceConfirmation] too, but CAUSE FROM DIFFERENT LOCAL "update(dt)" RATE SHOULD BE THE FIRST TO INVESTIGATE AND ELIMINATE -- because we have control on it, but no one has control on the internet. Kindly note that Significantly different network bandwidths or delay fluctuations would result in frequent [type#1 forceConfirmation] too, but CAUSE FROM DIFFERENT LOCAL "update(dt)" RATE SHOULD BE THE FIRST TO INVESTIGATE AND ELIMINATE -- because we have control on it, but no one has control on the internet.
*/ */
if (self.skipRenderFrameFlag) {
self.networkDoctor.logSkippedRenderFrameCnt();
self.skipRenderFrameFlag = false;
return;
}
try { try {
let st = performance.now(); let st = performance.now();
const noDelayInputFrameId = gopkgs.ConvertToNoDelayInputFrameId(self.renderFrameId); const noDelayInputFrameId = gopkgs.ConvertToNoDelayInputFrameId(self.renderFrameId);
@ -996,6 +1011,7 @@ batchInputFrameIdRange=[${batch[0].inputFrameId}, ${batch[batch.length - 1].inpu
// Inside the following "self.rollbackAndChase" actually ROLLS FORWARD w.r.t. the corresponding delayedInputFrame, REGARDLESS OF whether or not "self.chaserRenderFrameId == self.renderFrameId" now. // Inside the following "self.rollbackAndChase" actually ROLLS FORWARD w.r.t. the corresponding delayedInputFrame, REGARDLESS OF whether or not "self.chaserRenderFrameId == self.renderFrameId" now.
const latestRdfResults = self.rollbackAndChase(self.renderFrameId, self.renderFrameId + 1, self.gopkgsCollisionSys, self.gopkgsCollisionSysMap, false); const latestRdfResults = self.rollbackAndChase(self.renderFrameId, self.renderFrameId + 1, self.gopkgsCollisionSys, self.gopkgsCollisionSysMap, false);
self.networkDoctor.logRollbackFrames(self.renderFrameId - self.chaserRenderFrameId);
let prevRdf = latestRdfResults[0], let prevRdf = latestRdfResults[0],
rdf = latestRdfResults[1]; rdf = latestRdfResults[1];
/* /*
@ -1026,6 +1042,7 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
++self.renderFrameId; // [WARNING] It's important to increment the renderFrameId AFTER all the operations above!!! ++self.renderFrameId; // [WARNING] It's important to increment the renderFrameId AFTER all the operations above!!!
self.lastRenderFrameIdTriggeredAt = performance.now(); self.lastRenderFrameIdTriggeredAt = performance.now();
let t3 = performance.now(); let t3 = performance.now();
self.skipRenderFrameFlag = self.networkDoctor.isTooFast();
} catch (err) { } catch (err) {
console.error("Error during Map.update", err); console.error("Error during Map.update", err);
self.onBattleStopped(); // TODO: Popup to ask player to refresh browser self.onBattleStopped(); // TODO: Popup to ask player to refresh browser
@ -1520,9 +1537,41 @@ actuallyUsedinputList:{${self.inputFrameDownsyncStr(actuallyUsedInputClone)}}`);
showNetworkDoctorLabels() { showNetworkDoctorLabels() {
const self = this; const self = this;
self.sendingQLabel.string = self.networkDoctor.statSending(); const [sendingFps, srvDownsyncFps, peerUpsyncFps, rollbackFrames, skippedRenderFrameCnt] = self.networkDoctor.stats();
self.inputFrameDownsyncQLabel.string = self.networkDoctor.statInputFrameDownsync(); if (self.sendingQLabel) {
self.peerInputFrameUpsyncQLabel.string = self.networkDoctor.statPeerInputFrameUpsync(); self.sendingQLabel.string = `${sendingFps} fps sending`;
self.rollbackFramesLabel.string = self.networkDoctor.statRollbackFrames(); if (sendingFps < self.networkDoctor.inputRateThreshold) {
self.sendingQLabel.node.color = cc.Color.RED;
} else {
self.sendingQLabel.node.color = cc.Color.WHITE;
}
}
if (self.inputFrameDownsyncQLabel) {
self.inputFrameDownsyncQLabel.string = `${srvDownsyncFps} fps srv-downsync`;
if (srvDownsyncFps < self.networkDoctor.inputRateThreshold) {
self.inputFrameDownsyncQLabel.node.color = cc.Color.RED;
} else {
self.inputFrameDownsyncQLabel.node.color = cc.Color.WHITE;
}
}
if (self.peerInputFrameUpsyncQLabel) {
self.peerInputFrameUpsyncQLabel.string = `${peerUpsyncFps} fps peer-upsync`;
if (peerUpsyncFps > self.networkDoctor.peerUpsyncFps) {
self.peerInputFrameUpsyncQLabel.node.color = cc.Color.RED;
} else {
self.peerInputFrameUpsyncQLabel.node.color = cc.Color.WHITE;
}
}
if (self.rollbackFramesLabel) {
self.rollbackFramesLabel.string = `rollbackFrames: ${rollbackFrames}`
if (rollbackFrames > self.networkDoctor.rollbackFramesThreshold) {
self.rollbackFramesLabel.node.color = cc.Color.RED;
} else {
self.rollbackFramesLabel.node.color = cc.Color.WHITE;
}
}
if (self.skippedRenderFrameCntLabel) {
self.skippedRenderFrameCntLabel.string = `${skippedRenderFrameCnt} frames skipped`
}
}, },
}); });

View File

@ -10,6 +10,11 @@ NetworkDoctor.prototype.reset = function(capacity) {
this.peerInputFrameUpsyncQ = new RingBuffer(capacity); this.peerInputFrameUpsyncQ = new RingBuffer(capacity);
this.peerInputFrameUpsyncCnt = 0; this.peerInputFrameUpsyncCnt = 0;
this.immediateRollbackFrames = 0; this.immediateRollbackFrames = 0;
this.skippedRenderFrameCnt = 0;
this.inputRateThreshold = gopkgs.ConvertToNoDelayInputFrameId(60);
this.peerUpsyncThreshold = 8;
this.rollbackFramesThreshold = 8; // Roughly the same as TurnAroundFramesToRecover
}; };
NetworkDoctor.prototype.logSending = function(stFrameId, edFrameId) { NetworkDoctor.prototype.logSending = function(stFrameId, edFrameId) {
@ -40,35 +45,50 @@ NetworkDoctor.prototype.logPeerInputFrameUpsync = function(stFrameId, edFrameId)
this.peerInputFrameUpsyncCnt += (edFrameId - stFrameId + 1); this.peerInputFrameUpsyncCnt += (edFrameId - stFrameId + 1);
}; };
NetworkDoctor.prototype.statSending = function() { NetworkDoctor.prototype.logRollbackFrames = function(x) {
if (1 >= this.sendingQ.cnt) return `0 fps sending`; this.immediateRollbackFrames = x;
};
NetworkDoctor.prototype.stats = function() {
let sendingFps = 0,
srvDownsyncFps = 0,
peerUpsyncFps = 0,
rollbackFrames = this.immediateRollbackFrames;
if (1 < this.sendingQ.cnt) {
const st = this.sendingQ.getByFrameId(this.sendingQ.stFrameId); const st = this.sendingQ.getByFrameId(this.sendingQ.stFrameId);
const ed = this.sendingQ.getByFrameId(this.sendingQ.edFrameId - 1); const ed = this.sendingQ.getByFrameId(this.sendingQ.edFrameId - 1);
const elapsedMillis = ed.t - st.t; const elapsedMillis = ed.t - st.t;
const fps = Math.round((ed.j - st.i) * 1000 / elapsedMillis); sendingFps = Math.round((ed.j - st.i) * 1000 / elapsedMillis);
return `${fps} fps sending`; }
}; if (1 < this.inputFrameDownsyncQ.cnt) {
NetworkDoctor.prototype.statInputFrameDownsync = function() {
if (1 >= this.inputFrameDownsyncQ.cnt) return `0 fps srv downsync`;
const st = this.inputFrameDownsyncQ.getByFrameId(this.inputFrameDownsyncQ.stFrameId); const st = this.inputFrameDownsyncQ.getByFrameId(this.inputFrameDownsyncQ.stFrameId);
const ed = this.inputFrameDownsyncQ.getByFrameId(this.inputFrameDownsyncQ.edFrameId - 1); const ed = this.inputFrameDownsyncQ.getByFrameId(this.inputFrameDownsyncQ.edFrameId - 1);
const elapsedMillis = ed.t - st.t; const elapsedMillis = ed.t - st.t;
const fps = Math.round((ed.j - st.i) * 1000 / elapsedMillis); srvDownsyncFps = Math.round((ed.j - st.i) * 1000 / elapsedMillis);
return `${fps} fps srv downsync`; }
}; if (1 < this.peerInputFrameUpsyncQ.cnt) {
NetworkDoctor.prototype.statPeerInputFrameUpsync = function() {
if (1 >= this.peerInputFrameUpsyncQ.cnt) return `0 fps peer upsync`;
const st = this.peerInputFrameUpsyncQ.getByFrameId(this.peerInputFrameUpsyncQ.stFrameId); const st = this.peerInputFrameUpsyncQ.getByFrameId(this.peerInputFrameUpsyncQ.stFrameId);
const ed = this.peerInputFrameUpsyncQ.getByFrameId(this.peerInputFrameUpsyncQ.edFrameId - 1); const ed = this.peerInputFrameUpsyncQ.getByFrameId(this.peerInputFrameUpsyncQ.edFrameId - 1);
const elapsedMillis = ed.t - st.t; const elapsedMillis = ed.t - st.t;
const fps = Math.round(this.peerInputFrameUpsyncCnt * 1000 / elapsedMillis); peerUpsyncFps = Math.round(this.peerInputFrameUpsyncCnt * 1000 / elapsedMillis);
return `${fps} fps peer upsync`; }
return [sendingFps, srvDownsyncFps, peerUpsyncFps, rollbackFrames, this.skippedRenderFrameCnt];
}; };
NetworkDoctor.prototype.statRollbackFrames = function() { NetworkDoctor.prototype.logSkippedRenderFrameCnt = function() {
return `${this.immediateRollbackFrames} rollback frames`; this.skippedRenderFrameCnt += 1;
}
NetworkDoctor.prototype.isTooFast = function() {
const [sendingFps, srvDownsyncFps, peerUpsyncFps, rollbackFrames, skippedRenderFrameCnt] = this.stats();
if (sendingFps >= this.inputRateThreshold && srvDownsyncFps >= this.inputRateThreshold) {
// At least my network is OK for both TX & RX directions.
if (rollbackFrames >= this.rollbackFramesThreshold && peerUpsyncFps < this.peerUpsyncThreshold) {
// I got many frames rolled back while none of my peers effectively helped my preciction.
return true;
}
}
return false;
}; };
module.exports = NetworkDoctor; module.exports = NetworkDoctor;

View File

@ -98,7 +98,7 @@ cc.Class({
const p2Vpos = gopkgs.WorldToVirtualGridPos(boundaryObjs.playerStartingPositions[1].x, boundaryObjs.playerStartingPositions[1].y); const p2Vpos = gopkgs.WorldToVirtualGridPos(boundaryObjs.playerStartingPositions[1].x, boundaryObjs.playerStartingPositions[1].y);
const colliderRadiusV = gopkgs.WorldToVirtualGridPos(12.0, 0); const colliderRadiusV = gopkgs.WorldToVirtualGridPos(12.0, 0);
const speciesIdList = [4096, 1]; const speciesIdList = [1, 4096];
const chConfigsOrderedByJoinIndex = gopkgs.GetCharacterConfigsOrderedByJoinIndex(speciesIdList); const chConfigsOrderedByJoinIndex = gopkgs.GetCharacterConfigsOrderedByJoinIndex(speciesIdList);
const startRdf = window.pb.protos.RoomDownsyncFrame.create({ const startRdf = window.pb.protos.RoomDownsyncFrame.create({

View File

@ -22,7 +22,7 @@ const (
GRAVITY_X = int32(0) GRAVITY_X = int32(0)
GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases
INPUT_DELAY_FRAMES = int32(8) // in the count of render frames INPUT_DELAY_FRAMES = int32(4) // in the count of render frames
INPUT_SCALE_FRAMES = uint32(2) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames) INPUT_SCALE_FRAMES = uint32(2) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames)
NST_DELAY_FRAMES = int32(16) // network-single-trip delay in the count of render frames, proposed to be (InputDelayFrames >> 1) because we expect a round-trip delay to be exactly "InputDelayFrames" NST_DELAY_FRAMES = int32(16) // network-single-trip delay in the count of render frames, proposed to be (InputDelayFrames >> 1) because we expect a round-trip delay to be exactly "InputDelayFrames"
@ -644,7 +644,7 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
if 0 == currPlayerDownsync.FramesToRecover { if 0 == currPlayerDownsync.FramesToRecover {
prevCapturedByInertia := currPlayerDownsync.CapturedByInertia prevCapturedByInertia := currPlayerDownsync.CapturedByInertia
isWallJumping := (currPlayerDownsync.Speed < intAbs(currPlayerDownsync.VelX)) isWallJumping := (chConfig.OnWallEnabled && chConfig.WallJumpingInitVelX == intAbs(currPlayerDownsync.VelX))
/* /*
if isWallJumping { if isWallJumping {
fmt.Printf("joinIndex=%d is wall jumping\n{renderFrame.id: %d, currPlayerDownsync.Speed: %d, currPlayerDownsync.VelX: %d}\n", currPlayerDownsync.JoinIndex, currRenderFrame.Id, currPlayerDownsync.Speed, currPlayerDownsync.VelX) fmt.Printf("joinIndex=%d is wall jumping\n{renderFrame.id: %d, currPlayerDownsync.Speed: %d, currPlayerDownsync.VelX: %d}\n", currPlayerDownsync.JoinIndex, currRenderFrame.Id, currPlayerDownsync.Speed, currPlayerDownsync.VelX)
@ -752,6 +752,8 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
if ATK_CHARACTER_STATE_ONWALL == currPlayerDownsync.CharacterState && !jumpedOrNotList[i] { if ATK_CHARACTER_STATE_ONWALL == currPlayerDownsync.CharacterState && !jumpedOrNotList[i] {
thatPlayerInNextFrame.VelX += GRAVITY_X thatPlayerInNextFrame.VelX += GRAVITY_X
thatPlayerInNextFrame.VelY = chConfig.WallSlidingVelY thatPlayerInNextFrame.VelY = chConfig.WallSlidingVelY
} else if ATK_CHARACTER_STATE_DASHING == currPlayerDownsync.CharacterState {
thatPlayerInNextFrame.VelX += GRAVITY_X
} else { } else {
thatPlayerInNextFrame.VelX += GRAVITY_X thatPlayerInNextFrame.VelX += GRAVITY_X
thatPlayerInNextFrame.VelY += GRAVITY_Y thatPlayerInNextFrame.VelY += GRAVITY_Y

View File

@ -551,9 +551,9 @@ var skills = map[int]*Skill{
}, },
}, },
12: &Skill{ 12: &Skill{
RecoveryFrames: int32(15), RecoveryFrames: int32(12),
RecoveryFramesOnBlock: int32(15), RecoveryFramesOnBlock: int32(12),
RecoveryFramesOnHit: int32(15), RecoveryFramesOnHit: int32(12),
ReleaseTriggerType: int32(1), ReleaseTriggerType: int32(1),
BoundChState: ATK_CHARACTER_STATE_DASHING, BoundChState: ATK_CHARACTER_STATE_DASHING,
Hits: []interface{}{ Hits: []interface{}{