Skip to content

Commit 3dff90b

Browse files
Remove latency 1 and 2 experiments (#325)
The results of these haven't been good enough to use in production.
1 parent aa2449a commit 3dff90b

21 files changed

Lines changed: 127 additions & 550 deletions

example/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ n.on('ready', () => {
8080
lobbies.forEach(lobby => {
8181
const li = document.createElement('li')
8282
li.id = lobby.code
83-
li.innerHTML = `<a href="javascript:void(0)" class="code">${lobby.code}</a> - <span class="map_name">${lobby.customData?.map as string ?? 'unknown map'}</span> - <span class="players">${lobby.playerCount}</span> players (${lobby.latency ?? '<unknown>'}ms)`
83+
li.innerHTML = `<a href="javascript:void(0)" class="code">${lobby.code}</a> - <span class="map_name">${lobby.customData?.map as string ?? 'unknown map'}</span> - <span class="players">${lobby.playerCount}</span> players`
8484
el.appendChild(li)
8585
if (n.currentLobby === undefined) {
8686
li.querySelector('a.code')?.addEventListener('click', () => {

features/latency.feature

Lines changed: 0 additions & 174 deletions
This file was deleted.

features/latency2.feature

Lines changed: 0 additions & 58 deletions
This file was deleted.

features/support/steps/network.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ After(async function (this: World) {
88
this.players.clear()
99
})
1010

11-
async function playerIsConnectedAndReadyForGame (this: World, playerName: string, peerID: string, gameID: string, lat?: number, lon?: number): Promise<void> {
12-
const player = await this.createPlayer(playerName, gameID, lat, lon)
11+
async function playerIsConnectedAndReadyForGame (this: World, playerName: string, peerID: string, gameID: string): Promise<void> {
12+
const player = await this.createPlayer(playerName, gameID)
1313
const event = await player.waitForEvent('ready')
1414
if (event == null) {
1515
throw new Error(`unable to add player ${playerName} to network`)
@@ -23,10 +23,6 @@ Given('{string} is connected as {string} and ready for game {string}', async fun
2323
await playerIsConnectedAndReadyForGame.call(this, playerName, peerID, gameID)
2424
})
2525

26-
Given('{string} is connected as {string} with lat,lon as {float},{float} and ready for game {string}', async function (this: World, playerName: string, peerID: string, lat: number, lon: number, gameID: string) {
27-
await playerIsConnectedAndReadyForGame.call(this, playerName, peerID, gameID, lat, lon)
28-
})
29-
3026
async function areJoinedInALobby (this: World, playerNamesRaw: string, publc: boolean): Promise<void> {
3127
const playerNames = playerNamesRaw.split(',').map(s => s.trim())
3228
if (playerNames.length < 2) {
@@ -158,10 +154,6 @@ Given('these peers exist:', async function (this: World, peers: DataTable) {
158154

159155
if (value === 'null') {
160156
v.push('NULL')
161-
} else if (key === 'latency_vector') {
162-
v.push(`ARRAY[${value.substring(1, value.length - 1)}]::vector(11)`)
163-
} else if (key === 'geo') {
164-
v.push(`ll_to_earth(${value})`)
165157
} else {
166158
v.push(`'${value}'`)
167159
}
@@ -494,16 +486,3 @@ Then('{string} failed to join the lobby', function (playerName: string) {
494486
throw new Error(`player is in lobby ${player.network.currentLobby as string}`)
495487
}
496488
})
497-
498-
When('the next peer\'s latency vector is set to:', function (latencies: string) {
499-
if (latencies === 'null') {
500-
this.latencyVector = null
501-
return
502-
}
503-
504-
const lv = latencies.split(',').map(s => parseInt(s.trim(), 10))
505-
if (lv.length !== 11) {
506-
throw new Error('latency vector must have 11 elements')
507-
}
508-
this.latencyVector = lv
509-
})

features/support/world.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export class World extends CucumberWorld {
3636
public testproxyURL?: string
3737
public useTestProxy: boolean = false
3838
public databaseURL?: string
39-
public latencyVector: number[] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
4039

4140
public players: Map<string, Player> = new Map<string, Player>()
4241
public lastError: Map<string, Error> = new Map<string, Error>()
@@ -49,21 +48,15 @@ export class World extends CucumberWorld {
4948
}
5049
}
5150

52-
public async createPlayer (playerName: string, gameID: string, lat?: number, lon?: number): Promise<Player> {
51+
public async createPlayer (playerName: string, gameID: string): Promise<Player> {
5352
return await new Promise((resolve) => {
5453
const config: PeerConfiguration = {}
5554
if (this.useTestProxy) {
5655
config.testproxyURL = this.testproxyURL
5756
}
58-
config.testLatency = {
59-
vector: this.latencyVector
60-
}
61-
6257
let signalingURL = this.signalingURL
63-
if (lat !== undefined && lon !== undefined && signalingURL !== undefined) {
58+
if (signalingURL !== undefined) {
6459
const url = new URL(signalingURL)
65-
url.searchParams.set('lat', lat.toString())
66-
url.searchParams.set('lon', lon.toString())
6760
signalingURL = url.toString()
6861
}
6962

@@ -117,7 +110,6 @@ AfterAll(function () {
117110

118111
Before(function (this: World) {
119112
this.scenarioRunning = true
120-
this.latencyVector = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
121113
})
122114
After(function (this: World, { result }) {
123115
this.scenarioRunning = false

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/jackc/pgx/v5 v5.8.0
99
github.com/koenbollen/logging v0.0.0-20230520102501-e01d64214504
1010
github.com/ory/dockertest/v3 v3.12.0
11-
github.com/pgvector/pgvector-go v0.3.0
1211
github.com/poki/mongodb-filter-to-postgres v1.0.7
1312
github.com/rs/cors v1.11.1
1413
github.com/rs/xid v1.6.0
@@ -44,7 +43,6 @@ require (
4443
github.com/pkg/errors v0.9.1 // indirect
4544
github.com/rogpeppe/go-internal v1.14.1 // indirect
4645
github.com/sirupsen/logrus v1.9.3 // indirect
47-
github.com/x448/float16 v0.8.4 // indirect
4846
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
4947
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
5048
github.com/xeipuuv/gojsonschema v1.2.0 // indirect

0 commit comments

Comments
 (0)