Start working on networking

This commit is contained in:
2026-03-04 12:57:57 +00:00
parent ddab82ec7f
commit fe79c271fa
2 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
package com.iofferyoutea.WitchQueen
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Net
class Lobby {
//val localServers: MutableSetOf<String> = setOf<String>() <-- HashSet?
//val localPlayer: Player = <-- Should be local player. Has all their items etc.
//val lobby: MutableList<Player> = listOf<Player>(localPlayer) <-- Limit to lobby size (2)?
val serverSocket = Gdx.net.newServerSocket(
Net.Protocol.TCP,
"127.0.0.1",
2864,
null
)
val clientSocket = Gdx.net.newClientSocket(
Net.Protocol.TCP,
"127.0.0.1", // <- This should be other servers address
2864, // <- This should be other servers port
null
)
val inputStream = clientSocket.inputStream
private fun findLocalServer() {
Gdx.app.log("Lobby", "Finding local server...")
}
private fun replayHasLocalServer(remoteAddress: String, remotePort: Int) {
Gdx.app.log("Lobby", "Pinged by another client. Informing that we have an open lobby...")
}
private fun connectToServer(ip: String, port: Int) { // String is the ideal type for ip because v6 uses letters too?
Gdx.app.log("Lobby", "Connecting to $ip on port $port...")
}
}