Start working on networking
This commit is contained in:
@@ -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...")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user