-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roguelike. Мультиплеер. #4
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # game-server/src/main/kotlin/ru/ifmo/sd/httpapi/routes/GameRoutes.kt # game-server/src/main/kotlin/ru/ifmo/sd/world/configuration/GameConfiguration.kt
…ayer-client # Conflicts: # game-client/src/main/kotlin/ru/ifmo/sd/stuff/ServerAPI.kt
Изначально запускается мультиплеер. Для этого нужно ввести свое уникальное имя для идентификации (нормальной проверки корректности имени пока нет)
|
Странно, что сразу коннектит, а не предлагает выбрать, но ок
Ага, еще карта лагает и мобы чего-то совсем не двигаются( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 баллов
// val hpLabel = JLabel("HP: ") | ||
// infoPanel.add(hpLabel, BorderLayout.WEST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опять какие-то закомментированные куски
} | ||
println("Trying to start local server at port=${port}") | ||
println(System.getProperty("user.dir")) | ||
val cmd = "../game-server/build/install/game-server/bin/game-server" // TODO call .bat for windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это вот весьма странный способ. На win не будет работать, ага
println(e.localizedMessage) | ||
started = false | ||
} | ||
if (started) break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хотя бы
while (!started) { ...
а лучше вообще
while (true) {
try {
joinLocal()
break
} catch (e: Exception) {
println(e.localizedMessage)
}
}
До break
просто не дойдем, если исключение произошло
} | ||
} | ||
|
||
internal fun resetMapSize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А зачем они internal
?
private fun isAvailable(portNr: Int): Boolean { | ||
var portFree: Boolean | ||
try { | ||
ServerSocket(portNr).use { portFree = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут тоже return
прямо внутри try
подошел бы лучше, кажется
|
||
private fun placeEnemies(maze: Maze, healths: UnitsHealthStorage, npc: NpcEventProvider) { | ||
val countOfEnemies = (maze.size() * gameDifficulty).toInt() | ||
freePos.forEach { maze.freePos.add(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maze.freePos.addAll(freePos)
forEach
в идеале не должен нигде изменений делать
val npcMove = gameLevel.npcEventProvider.move(playerPos, maze) | ||
npcMove.forEach { maze[it.position] = it.newMazeObj } | ||
val newPlayerPos = | ||
if (maze[playerPos] != null) playerPos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше скобоки ставить, а то совсем нечитаемая елка получается
No description provided.