
Making Games with Kotlin - veiset
https://kotlin.christmas/2019/11
======
buremba
People usually get confused when we tell them that we're using Kotlin for our
backend APIs. I can't blame them because we attended KotlinConf last year and
almost 90% of the audience were using Kotlin on the Android platform.

Hopefully, it gets more attraction from different platforms because staying in
the JVM land and being able to use an expressive & lightweight language is
great!

~~~
jillesvangurp
Sebastian Deleuze who is one of the Kotlin people working on Spring just gave
a presentation of the status of Kotlin support in Spring:
[https://www.infoq.com/presentations/spring-kotlin-boot-
kofu/](https://www.infoq.com/presentations/spring-kotlin-boot-kofu/).

In short, if you are using Spring and are ignoring Kotlin, you are missing out
a lot of good stuff. Or in other words, the same that happened to Java on
Android is now happening to backend Java. You can still use it but why would
you when things can be so much better with a simple upgrade to Kotlin (I've
migrated tens of thousands of lines of code, it's easy). And yes Java 9-14
added a bunch of things that are definitely nice/useful but it doesn't come
close to Kotlin in terms of expressiveness and language ergonomics.

Also, KotlinConf was on last week. There was a nice presentation about the
state of kotlin-js, which is getting some nice updates in the next year
including much better dead code elimination resulting in very compact minified
code (< 100kb is now feasible for simple stuff), better integration of
existing typescript type script defifinitions (i.e. support for most relevant
npms out there), better build tooling in the form of an improved gradle
plugin. Or put different, Kotlin might start doing to typescript/javascript
what it already did to Java. IMHO it's a more capable language than
typescript, which I consider to be pretty nice but it just lacks a bunch of
things and comes with a some ugliness that relates to backwards compatibility
with js.

In related news, Kotlin native is also happening. So, Kotlin is joining a list
of full stack languages that used to be really short.

~~~
jeremija
What's the status of Kotlin Native for writing backend apps? I really like it
but I wouldn't want to get dragged into Gradle, JARs and JDBC again...

~~~
jillesvangurp
The native compiler is maturing and they are moving the JVM and JS compilers
to the IR format they have developed for that. Additionally, they are going to
support a new type of library that compiles to IR and that is reusable for all
platforms.

They already have a few multi platform things. Mainly Ktor currently, which
kind of should work on native. Additionally, you can target the node-js
ecosystem via Kotlin-js. Also, one goal with Spring Kofu at least is also
supporting GraalVM at least.

They are also adding more platforms to the native target.

Reading between the lines with what was announced last week at Kotlinconf, I
expect a lot of this stuff might stay at least partially experimental through
the 1.4 cycle (current is 1.3.61) and would expect that they might start
pushing harder on backend native stuff around 1.5. Also there are still a lot
of question marks around things like WASM where e.g. MS has a more clear
strategy with .Net and Blazor.

~~~
jeremija
Thanks a lot for all the info! :)

------
vbsteven
I don't know the situation on mobile but for cross platform Desktop the JVM is
a great target for "write once, run everywhere", and Kotlin is a modern
language that fixes or improves a lot of Java's common complaints.

Assuming a JVM is installed, distribution is as simple as sending a packaged
.jar file.

There is a huge ecosystem of available libraries in Java, many with Kotlin
wrappers for idiomatic usage.

~~~
tus88
Didn't Java fail spectacularly in the desktop application space?

~~~
mhd
I wouldn't say "spectacularly", as I don't remember that many attempts at true
end-user apps. Enterprise is ripe with Swing.

Nowadays of course the web has blunted our pain receptors for memory bloat and
non-native UIs, thus you're probably running three Electron apps right now,
compared to which Java is Win32ASM.

And as others pointed out, for games it doesn't matter anyway. You're not
building a AAA-game or something for a 6510, so GC pauses and memory
consumption don't matter, either. Plus rapid-development, refactoring and a
setup where OOP actually makes good sense.

I wouldn't start Kotlin for that, but if you already know it, there's no
reason not to use it.

~~~
matsemann
GC is also not that big of an issue in these type of games if one's careful of
using pools for the various objects, and then release stuff at appropriate
times.

------
rumanator
On a side note, there seems to be a lot of links being posted from vanity TLDs
such as .christmas. Isn't there a risk of these links ending up broken in a
matter of nothing?

~~~
hkh28
.christmas seems to be owned by Uniregistry[0], which also owns at least 26
other TLDs, so I think we can expect them to continue providing service.

[0] [https://en.wikipedia.org/wiki/List_of_Internet_top-
level_dom...](https://en.wikipedia.org/wiki/List_of_Internet_top-
level_domains#C)

~~~
rumanator
My concern doesn't lie with the TLD registrar, but with the interest in, say,
maintaining a .christmas domain in non-christmas times of the year.

~~~
omnimus
There is chrismas every year.

~~~
rumanator
Yes, and it's relevant for a month tops?

Who will be more compelled to click on a Christmas link in, say, July? A
christmas-themed link in February or March seems stale as hell.

~~~
selbekk
We saw a steady flow of traffic all through last year on a few .christmas
domains from last year's advent calendars.

I don't think they seem stale, but perhaps out of season Either way, we're
committed to keep this content online for the foreseeable future, and write a
new edition next year if people find it interesting.

------
edem
Shameless plug: I'm working on a multiplatform library
([https://github.com/Hexworks/zircon](https://github.com/Hexworks/zircon))
which can be used to write roguelike games with ascii and/or tile based
graphics. The whole project is MPP Kotlin (99% common code). We have a LibGDX
renderer as well (although we're not using LibKTX yet).

------
selbekk
Kotlin seems to have a lot of the tooling required to make games pretty
quickly. That's not to say it's not a massive undertaking! The demo at the
bottom is just mindblowing

------
al_
My goal is to make a full kotlin android/iOS/backend game with shared business
logic. How fare are wew from that?

~~~
krilly
Why not unity? (It's an obligatory question at this point)

~~~
al_
Because I absolutely love Kotlin and I feel I'm much more productive with it.
I have a hard time working with script languages and feel confident on my code
nowadays.

Also, Kotlin let you use tons of java libraries.

~~~
juskrey
C# is hardly a script language, also Kotlin Native is hardly a tool for gaming
with its lack of real multithreading support

------
ww520
Is targeting iOS better now with libgdx? Couple years ago the iOS support was
kind of spotty.

~~~
dukoid
MS did not like competition to Xamarian so they have killed RoboVM
unfortunately...

EDIT: Apparently it's not dead and there seem to be up-to-date instructions
here: [https://medium.com/@bschulte19e/deploying-your-libgdx-
game-t...](https://medium.com/@bschulte19e/deploying-your-libgdx-game-to-ios-
in-2019-8d3796410d82)

~~~
babuskov
I can confirm that. I have a couple of games on App Store that use it. I built
them initially in 2015 and have updated them a couple of months ago with the
latest libGDX.

I used RoboVM just like that person in the article, but I used it with
Intellij IDEA instead of Android Studio.

It works and it's pretty easy and straightforward to set up.

------
skocznymroczny
I know that a killer feature for Kotlin is that you can use the same code to
compile to JS, JVM and Native. Is it actually feasible in practice? Can I make
a game that will compile to JS, JVM and Native all with the same code? I
assume the core logic would be shared and I'd have to implement platform-
specific routines for things like drawing and input, but would this actually
work?

~~~
davewritescode
Only if all the libraries you use aren't JVM specific. In this case, the
developer is using wrapper for a Java library so I doubt it's possible.

There's no reason the wrapper couldn't be enhanced to use the Java library on
the JVM and something else on native but it would probably be a lot of work.

------
hamoid
Although not strictly a game engine, OPENRNDR[0] could probably be used to
create one in Kotlin.

> OPENRNDR is a tool to create tools. It is an open source framework for
> creative coding, written in Kotlin for the Java VM that simplifies writing
> real-time interactive software.

[0]: [https://openrndr.org/](https://openrndr.org/)

------
thomascgalvin
Is LibGDX still a viable option for MacOS? I'm unclear about how well
supported OpenGL is after Catalina.

------
fdomig
We are using Kotlin in most of our backends running on AWS. We are very(!)
happy with the Kotlin developer experience as well as the adoption curve that
we have seen throughout our company. I can only highly recommend giving it a
try and do not believe it is only meant for App development.

------
Elrac
At the risk of seeming an ingrate: Does LibKtx also do 3D?

