Other Frameworks

Kotlin’s multiplatform capabilities make it an interesting choice for developing many different styles of applications. There are a number of frameworks in development that extend Kotlin’s core capabilities into surprising areas.

Web frameworks

With the ability to compile to JS, Kotlin is an interesting choice for a web server.

  • Ktor provides Kotlin native asynchronous client and server functionality.
  • Javalin is another alternative, lightweight web framework.
  • Doodle provides a web UI framework that works with Kotlin/JS to provide full featured interactive applications for the web.

Game Engines

Since it can interoperate with Java seamlessly, and consume Java libraries, Kotlin can work with Java game engines.

  • LibGDX is a longstanding Open Source engine. KTX provides Kotlin utilities that extend LibGDX and allow you to write your entire game in Kotlin.
  • There are Kotlin bindings for the Godot engine but the are still in early development stages.
  • KorGE is a full game engine written entirely in Kotlin.

Example: KorGE

KorGE has a Kotlin plugin that makes it simple to get up and running quickly.

  1. In IntelliJ IDEA, install the plugin from the Plugin - Marketplace.
  2. Create a new project. Select KorGE:

KorGE wizard KorGE wizard

By default, you get a Kotlin Multiplatform (KMP) project that supports Windows, macOS, iOS and Android! Under Run, pick the appropriate platform and it should compile and run the KorGE equivilant of “Hello World”.

Here’s the starter code running under macOS ARM:

KorGE sample KorGE sample

Here it is under the iOS Simulator1.

image-20220320192432570 image-20220320192432570

The code for this project looks surprisingly familiar:

suspend fun main() = Korge(width = 512, height = 512, bgcolor = Colors["#2b2b2b"]) {
	val minDegrees = (-16).degrees
	val maxDegrees = (+16).degrees

	val image = image(resourcesVfs["korge.png"].readBitmap()) {
		rotation = maxDegrees
		anchor(.5, .5)
		scale(.8)
		position(256, 256)
	}

	while (true) {
		image.tween(image::rotation[minDegrees], time = 1.seconds, easing = Easing.EASE_IN_OUT)
		image.tween(image::rotation[maxDegrees], time = 1.seconds, easing = Easing.EASE_IN_OUT)
	}
}

Korge provides a top-level application object, representing the window - much as JavaFX might want to do.

You can see from the imports that the engine includes a large number of graphical primitives: images, particles, sounds, scenes and so on.


  1. You need to be running on a Mac, with Xcode setup for multiplatform builds. ↩︎