decodesoft

Logowanie Rejestracja
Wątek zamknięty 
Kotlin MMO Game LibGDX Ktor beta Starszy wątek
Autor
Liczba postów: 63
Liczba wątków: 7
Dołączył: Nov 2024
Reputacja: 0
Wiadomość
05-06-2025, 09:34 PM #1
Kotlin MMO Game (LibGDX + Ktor)
A simple 2D multiplayer online RPG built with LibGDX and Ktor using Kotlin.
Gracze mogą się logować, tworzyć postacie, poruszać, rozmawiać i walczyć w czasie rzeczywistym za pomocą komunikacji WebSocket.


Funkcje
  • Logowanie, tworzenie i wybór postaci
  • Multiplayer przez WebSocket z backendem w Ktor
  • Ruch w czasie rzeczywistym, aktualizacje życia, czat
  • System klas i podstawowe umiejętności
  • Mechanika śmierci i respawnu
  • Interfejs oparty o sceny LibGDX


Stos technologiczny
Client: Kotlin + LibGDX 
Server: Kotlin + Ktor WebSockets 
Networking: WebSocket 

build.gradle.kts (client)

plugins {    kotlin("jvm") version "2.1.10"
    kotlin("plugin.serialization") version "2.1.20"
    application                            // <<< dodajemy plugin application
}
group = "pl.decodesoft"
version = "1.0-SNAPSHOT"

repositories {    mavenCentral()
}
val gdxVersion = "1.12.1"
val ktorVersion = "2.3.4"

dependencies {    implementation("io.ktor:ktor-client-core:$ktorVersion")
    implementation("io.ktor:ktor-client-websockets:$ktorVersion")
    implementation("io.ktor:ktor-client-cio:$ktorVersion")
    implementation("ch.qos.logback:logback-classic:1.4.12")
    implementation("com.badlogicgames.gdx:gdx-freetype:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop")
    implementation("com.badlogicgames.gdx:gdx:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
    // Logowanie, Rejestracja
    implementation("at.favre.lib:bcrypt:0.9.0")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
    implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
    // Zależności LibGDX
    implementation("com.badlogicgames.gdx:gdx:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
}
// Konfiguracja zadań do uruchamiania klienta i serwera
tasks.register<JavaExec>("runClient") {    group = "application"
    mainClass.set("pl.decodesoft.DesktopLauncher")
    classpath = sourceSets["main"].runtimeClasspath
    standardInput
= System.`in`
    workingDir
= file("assets")
    // Jeśli masz zasoby aplikacji, stworzy katalog assets jeśli nie istnieje
    doFirst {        file("assets").mkdirs()
    }}
tasks.register<JavaExec>("runServer") {    group = "application"
    mainClass.set("pl.decodesoft.ServerKt")
    classpath = sourceSets["main"].runtimeClasspath
    standardInput
= System.`in`
}
tasks.test {    useJUnitPlatform()
}
tasks.withType<Jar> {    manifest {        attributes["Main-Class"] = "pl.decodesoft.MMOGame.Launcher"
    }}
kotlin {    jvmToolchain(21)
}



build.gradle.kts (server)

plugins {    kotlin("jvm") version "2.1.10"
    kotlin("plugin.serialization") version "2.1.20"
}
group = "pl.decodesoft"
version = "1.0-SNAPSHOT"

repositories {    mavenCentral()
}
val gdxVersion = "1.12.1"
val ktorVersion = "2.3.4"

dependencies {    // Twoje istniejące zależności
    implementation("io.ktor:ktor-client-core:$ktorVersion")
    implementation("io.ktor:ktor-client-websockets:$ktorVersion")
    implementation("io.ktor:ktor-client-cio:$ktorVersion")
    implementation("ch.qos.logback:logback-classic:1.4.12")
    // Zależności do serwera (jeśli są potrzebne w tym samym projekcie)
    implementation("io.ktor:ktor-server-core:$ktorVersion")
    implementation("io.ktor:ktor-server-netty:$ktorVersion")
    implementation("io.ktor:ktor-server-websockets:$ktorVersion")
    // Logowanie, Rejestracja
    implementation("at.favre.lib:bcrypt:0.9.0")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
    implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
    // Zależności LibGDX
    implementation("com.badlogicgames.gdx:gdx:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion")
    implementation("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
}
tasks.test {    useJUnitPlatform()
}
tasks.withType<Jar> {    manifest {        attributes["Main-Class"] = "pl.decodesoft.Main"
    }
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    from({        configurations.runtimeClasspath.get()
            .filter { it.name.endsWith("jar") }            .map { zipTree(it) }    })
}
kotlin {    jvmToolchain(21)
}


Licencja
Cytat:Copyright [2025] [Platefobrain] 
Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at: 
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

Cytat:Licencja: Wszelkie prawa zastrzeżone. 
Możesz używać, modyfikować, kopiować i dystrybuować ten projekt do własnych celów, 
ale nie możesz używać go do celów komercyjnych, chyba że uzyskasz zgodę od autora. 
Projekt jest dostarczany "tak jak jest", bez żadnych gwarancji. 
Używasz go na własne ryzyko. 
Autor: Copyright [2025] [Platefobrain]



Download
Kod:
https://decodesoft.pl/download/server-mmo.zip

Kod:
https://decodesoft.pl/download/client-mmo.zip

Kod:
https://github.com/Platefobrain/Simple-MMO-Game-greenvale


Screeny

[Obrazek: character_select.png?raw=true]

[Obrazek: game.png]
(Ten post był ostatnio modyfikowany: 05-06-2025, 09:53 PM przez: platefobrain)
Wątek zamknięty 


Użytkownicy przeglądający ten wątek: 1 gości

Polskie tłumaczenie © 2007-2026 Polski Support MyBB
© 2002-2026 MyBB Group.

Decodesoft